From f4c79db263d42ec372328cb42fccdc9ef4da2622 Mon Sep 17 00:00:00 2001 From: Jonathan Wagenet Date: Wed, 24 Sep 2025 23:16:35 -0400 Subject: [PATCH] Change kwarg capitalization to fix #1026. Unindent code blocks, fix doublespace + formatting --- docs/location_arithmetic.rst | 136 +++++++++++++++++------------------ 1 file changed, 66 insertions(+), 70 deletions(-) diff --git a/docs/location_arithmetic.rst b/docs/location_arithmetic.rst index f26834e..a28c105 100644 --- a/docs/location_arithmetic.rst +++ b/docs/location_arithmetic.rst @@ -3,7 +3,6 @@ Location arithmetic for algebra mode ====================================== - Position a shape relative to the XY plane --------------------------------------------- @@ -19,134 +18,131 @@ For the following use the helper function: circle = Circle(scale * .8).edge() return (triad + circle).locate(plane.location) - 1. **Positioning at a location** - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1, 2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") - .. image:: assets/location-example-01.png +.. image:: assets/location-example-01.png 2) **Positioning on a plane** - .. code-block:: python +.. code-block:: python - plane = Plane.XZ + plane = Plane.XZ - face = plane * Rectangle(1, 2) + face = plane * Rectangle(1, 2) - show_object(face, name="face") - show_object(plane_symbol(plane), name="plane") + show_object(face, name="face") + show_object(plane_symbol(plane), name="plane") - .. image:: assets/location-example-07.png - - Note that the ``x``-axis and the ``y``-axis of the plane are on the ``x``-axis and the ``z``-axis of the world coordinate system (red and blue axis) +.. image:: assets/location-example-07.png +Note: The ``x``-axis and the ``y``-axis of the plane are on the ``x``-axis and the ``z``-axis of the world coordinate system (red and blue axis). Relative positioning to a plane ------------------------------------ 1. **Position an object on a plane relative to the plane** - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1,2) - box = Plane(loc) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) - # box = Plane(face.location) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) - # box = loc * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) + box = Plane(loc) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) + # box = Plane(face.location) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) + # box = loc * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") - show_object(box, name="box") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") + show_object(box, name="box") - .. image:: assets/location-example-02.png +.. image:: assets/location-example-02.png - The ``x``, ``y``, ``z`` components of ``Pos(0.2, 0.4, 0.1)`` are relative to the ``x``-axis, ``y``-axis or - ``z``-axis of the underlying location ``loc``. +The ``X``, ``Y``, ``Z`` components of ``Pos(0.2, 0.4, 0.1)`` are relative to the ``x``-axis, ``y``-axis or +``z``-axis of the underlying location ``loc``. - Note: ``Plane(loc) *``, ``Plane(face.location) *`` and ``loc *`` are equivalent in this example. +Note: ``Plane(loc) *``, ``Plane(face.location) *`` and ``loc *`` are equivalent in this example. 2. **Rotate an object on a plane relative to the plane** - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1,2) - box = Plane(loc) * Rot(z=80) * Box(0.2, 0.2, 0.2) + box = Plane(loc) * Rot(Z=80) * Box(0.2, 0.2, 0.2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") - show_object(box, name="box") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") + show_object(box, name="box") - .. image:: assets/location-example-03.png +.. image:: assets/location-example-03.png - The box is rotated via ``Rot(z=80)`` around the ``z``-axis of the underlying location - (and not of the z-axis of the world). +The box is rotated via ``Rot(Z=80)`` around the ``z``-axis of the underlying location +(and not of the z-axis of the world). - More general: +More general: - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1,2) - box = loc * Rot(20, 40, 80) * Box(0.2, 0.2, 0.2) + box = loc * Rot(20, 40, 80) * Box(0.2, 0.2, 0.2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") - show_object(box, name="box") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") + show_object(box, name="box") - .. image:: assets/location-example-04.png +.. image:: assets/location-example-04.png - The box is rotated via ``Rot(20, 40, 80)`` around all three axes relative to the plane. +The box is rotated via ``Rot(20, 40, 80)`` around all three axes relative to the plane. 3. **Rotate and position an object relative to a location** - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1,2) - box = loc * Rot(20, 40, 80) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) + box = loc * Rot(20, 40, 80) * Pos(0.2, 0.4, 0.1) * Box(0.2, 0.2, 0.2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") - show_object(box, name="box") - show_object(location_symbol(loc * Rot(20, 40, 80), 0.5), options={"color":(0, 255, 255)}, name="local_location") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") + show_object(box, name="box") + show_object(location_symbol(loc * Rot(20, 40, 80), 0.5), options={"color":(0, 255, 255)}, name="local_location") - .. image:: assets/location-example-05.png +.. image:: assets/location-example-05.png - The box is positioned via ``Pos(0.2, 0.4, 0.1)`` relative to the location ``loc * Rot(20, 40, 80)`` +The box is positioned via ``Pos(0.2, 0.4, 0.1)`` relative to the location ``loc * Rot(20, 40, 80)`` 4. **Position and rotate an object relative to a location** - .. code-block:: python +.. code-block:: python - loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) + loc = Location((0.1, 0.2, 0.3), (10, 20, 30)) - face = loc * Rectangle(1,2) + face = loc * Rectangle(1,2) - box = loc * Pos(0.2, 0.4, 0.1) * Rot(20, 40, 80) * Box(0.2, 0.2, 0.2) + box = loc * Pos(0.2, 0.4, 0.1) * Rot(20, 40, 80) * Box(0.2, 0.2, 0.2) - show_object(face, name="face") - show_object(location_symbol(loc), name="location") - show_object(box, name="box") - show_object(location_symbol(loc * Pos(0.2, 0.4, 0.1), 0.5), options={"color":(0, 255, 255)}, name="local_location") + show_object(face, name="face") + show_object(location_symbol(loc), name="location") + show_object(box, name="box") + show_object(location_symbol(loc * Pos(0.2, 0.4, 0.1), 0.5), options={"color":(0, 255, 255)}, name="local_location") - .. image:: assets/location-example-06.png - - Note: This is the same as `box = loc * Location((0.2, 0.4, 0.1), (20, 40, 80)) * Box(0.2, 0.2, 0.2)` +.. image:: assets/location-example-06.png +Note: This is the same as ``box = loc * Location((0.2, 0.4, 0.1), (20, 40, 80)) * Box(0.2, 0.2, 0.2)``