MCPcopy Create free account
hub / github.com/Notgnoshi/generative / __init__

Method __init__

generative/lsystem/turtle.py:15–29  ·  view source on GitHub ↗

Initialize the turtle with the given position and rotation. Use a traditional RHS coordinate system with Z pointing up. Transformations are performed using intrinsic Euler angles, so rotations about an axis are relative to the turtle's local reference frame. :param

(self, position: np.ndarray = None, rotation: Rotation = None)

Source from the content-addressed store, hash-verified

13 """
14
15 def __init__(self, position: np.ndarray = None, rotation: Rotation = None):
16 """Initialize the turtle with the given position and rotation.
17
18 Use a traditional RHS coordinate system with Z pointing up.
19 Transformations are performed using intrinsic Euler angles, so rotations about an axis are
20 relative to the turtle's local reference frame.
21
22 :param position: The starting position of the turtle. Defaults to (0, 0, 0).
23 :param rotation: The starting rotation of the turtle, applied to the vector (0, 0, 1).
24 """
25 if rotation is not None and not isinstance(rotation, Rotation):
26 raise TypeError("Rotation must be a scipy.spatial.transform.Rotation")
27
28 self._position = np.array(position) if position is not None else np.array([[0, 0, 0]])
29 self.rotation = rotation if rotation is not None else Rotation.from_matrix(np.eye(3))
30
31 @property
32 def position(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected