Position
gradysim.protocol.position
This module contains some helpers useful when working with positions. Positions are used to localize the nodes inside the python simulation.
Position = Tuple[float, float, float]
module-attribute
Represents a node's position inside the simulation. It is a tuple of three floating point numbers representing the euclidean coordinates of the node.
rotate_position_2d(position, angle_degrees)
Rotates a position's (x, y) coordinates around the z-axis by angle_degrees (in degrees) counter-clockwise, keeping the z coordinate unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position |
Position
|
The original (x, y, z) position. |
required |
angle_degrees |
float
|
The angle in degrees to rotate by (counter-clockwise). |
required |
Returns:
| Type | Description |
|---|---|
Position
|
The rotated (x, y, z) position. |