Skip to content

Commit f8abfdf

Browse files
committed
docs: Update coordinate systems and orientation documentation
- Move coordinates.rst from tutorials/ to reference/ for better discoverability in the sidebar. - Add the coordinates page to the Language Reference toctree. - Update the global coordinate system section to clarify Euler angle composition and intrinsic rotation order. - Revise the local coordinate system section to generalize parentOrientation behavior: - Most specifiers allow an optional parentOrientation override at level 3. - The :specifier: specifier sets parentOrientation automatically at level 2. - Added a note on tuple syntax ((3, 3, 3)) and linked to the specifiers page for more details. - Update the Orientation entry in the Data Types Reference to include a link to the coordinates page.
1 parent 579757d commit f8abfdf

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

docs/language_reference.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For details on the syntax for functions, loops, etc. inherited from Python, see
1616

1717
reference/general
1818
reference/data
19+
reference/coordinates
1920
reference/region_types
2021
reference/distributions
2122
reference/statements
@@ -33,4 +34,4 @@ The pages above describe the semantics of each of Scenic's constructs individual
3334
:maxdepth: 1
3435

3536
reference/scene_generation
36-
reference/dynamic_scenarios
37+
reference/dynamic_scenarios
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Global Coordinate System
1010
All objects in Scenic have an :prop:`orientation` property, which is their orientation in global coordinates.
1111
Scenic represents orientations internally using quaternions, though for convenience they can be created using Euler angles. Scenic follows the right hand rule with the Z,X,Y order of rotations. In other words, Euler angles are given as (Yaw, Pitch, Roll), in radians, and applied in that order.
1212

13-
:prop:`orientation` is derived from the values of 4 other properties, :prop:`parentOrientation`, :prop:`yaw`, :prop:`pitch`, and :prop:`roll`.
14-
The :prop:`parentOrientation` property defines the parent orientation of the object, which is the orientation with respect to which the intrinsic Euler angles :prop:`yaw`, :prop:`pitch`, and :prop:`roll` are interpreted.
13+
:prop:`orientation` is derived from the values of 4 other properties, :prop:`parentOrientation`, :prop:`yaw`, :prop:`pitch`, and :prop:`roll`.
14+
The :prop:`parentOrientation` property defines the parent orientation of the object, which is the orientation with respect to which the intrinsic Euler angles :prop:`yaw`, :prop:`pitch`, and :prop:`roll` are interpreted.
1515
Specifically, :prop:`orientation` is obtained as follows:
1616

1717
1. start from :prop:`parentOrientation`;
@@ -26,26 +26,33 @@ Below is an illustration of the global coordinate system
2626

2727
By default, :prop:`parentOrientation` is aligned with the global coordinate system, so that :prop:`yaw` for example is just the angle by which to rotate the object around the Z axis.
2828

29-
This corresponds to the :prop:`heading` property in older versions of Scenic. :prop:`heading` represents yaw in the global XY plane. Scenic represents headings in radians, measured anticlockwise from North, so that a heading of 0 is due North and a heading of π/2 is due West.
29+
This corresponds to the :prop:`heading` property in older versions of Scenic. :prop:`heading` represents yaw in the global XY plane. Scenic represents headings in radians, measured anticlockwise from North, so that a heading of 0 is due North and a heading of π/2 is due West.
3030

3131
For more information on orientations and heading please consult:
3232

3333
* Tutorial on Orientations :ref:`orientations_tutorial`
3434
* Reference on Orientations: :ref:`Orientation`.
3535
* Reference on Heading: :ref:`Heading`
3636

37+
.. note::
38+
When manually composing rotations in Scenic, remember that if rotation **A** is applied first, followed by rotation **B**, the resulting orientation is computed as **A * B**. This multiplication order is reversed relative to the typical extrinsic rotation convention, reflecting Scenic’s use of intrinsic Euler angles.
39+
3740
Local Coordinate System
3841
-----------------------
39-
If you want to specify an objects coordinate system relative to other objects, there are specifiers for the :prop:`orientation` to do so.
42+
When specifying an object's coordinate system relative to other objects, several position specifiers can influence its :prop:`parentOrientation`.
43+
44+
- Most position specifiers—such as the :specifier:`ahead of` specifier and the general operator :scenic:`{X} relative to {Y}`—allow you to optionally override the default :prop:`parentOrientation` at level 3 by appending a clause like :specifier:`with parentOrientation {value}`.
45+
46+
- In contrast, the :specifier:`on {region}` specifier automatically sets :prop:`parentOrientation` (at level 2) whenever the region in question has a preferred orientation. The region's associated vector field defines an orientation at each point, which is then used as the default for the object.
47+
48+
.. note::
49+
When using tuple syntax (e.g. ``(3, 3, 3)``) to specify positions, be aware that these tuples are interpreted as Vectors, which can sometimes yield unintuitive results. For more details, see the :ref:`specifiers` page.
50+
51+
- Additionally, the `OrientedPoint` class encapsulates a position along with an orientation (and its associated properties, including :prop:`parentOrientation`, :prop:`yaw`, etc.), thereby defining a complete local coordinate system.
4052

41-
1. The :specifier:`on {region}` specifier specifies :prop:`parentOrientation` whenever the region in question has a :term:`preferred orientation`: a `vector field` (another primitive Scenic type) which defines an orientation at each point in the region.
42-
2. The :specifier:`ahead of` specifier only specifies :prop:`parentOrientation` *optionally*, giving it a new default value: if you want a different value, you can override that default by explicitly writing :specifier:`with parentOrientation {value}`.
43-
3. The general operator :scenic:`{X} relative to {Y}` can interpret vectors and orientations as being in a variety of local coordinate systems
44-
4. The `OrientedPoint` class adds :prop:`position` and :prop:`orientation` (plus :prop:`parentOrientation`, :prop:`yaw`, etc.) to define a local coordinate sytem.
4553

4654
For more information on defining a local coordinate system, please consult:
4755

4856
* Tutorial on :scenic:`relative to`: :ref:`dependencies_and_modifying_specifiers`
4957
* Reference on :scenic:`relative to` for headings: :ref:`operators`
5058
* Reference on `OrientedPoint`: :ref:`OrientedPoint`
51-

docs/reference/data.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ Scenic rejects such expressions as being ambiguous: more explicit syntax like :s
6363

6464
Orientation
6565
===========
66-
Orientations represent orientations in 3D space.
67-
Scenic represents orientations internally using quaternions, though for convenience they can be created using Euler angles. Scenic follows the right hand rule with the Z,X,Y order of rotations. In other words, Euler angles are given as (Yaw, Pitch, Roll), in radians, and applied in that order. To help visualize, one can consider their right hand with fingers extended orthogonally. The index finger points along positive X, the middle finger bends left along positive Y, and the thumb ends up pointing along positive Z. For rotations, align your right thumb with a positive axis and the way your fingers curl is a positive rotation.
66+
Orientations represent rotations in 3D space. Scenic represents orientations internally using quaternions, though for convenience they can be created using Euler angles. Scenic follows the right hand rule with the Z,X,Y order of rotations. In other words, Euler angles are given as (Yaw, Pitch, Roll), in radians, and applied in that order.
67+
68+
For a more detailed explanation of coordinate systems and rotation composition in Scenic, see the :ref:`coordinates` page.
69+
70+
To help visualize an orientation, consider your right hand with fingers extended orthogonally. The index finger points along the positive X axis, the middle finger along the positive Y axis, and the thumb along the positive Z axis. When you align your right thumb with a positive axis, the way your fingers curl indicates a positive rotation.
6871

6972
.. versionadded:: 3.0
7073

@@ -135,4 +138,3 @@ When creating a `MeshShape`, if no dimensions are provided then dimensions will
135138
.. autoclass:: scenic.core.shapes.SpheroidShape
136139
:noindex:
137140
:no-show-inheritance:
138-

0 commit comments

Comments
 (0)