Function or value | Description |
Full Usage:
angleFrom d1 d2
Parameters:
Direction2D<'Coordinates>
d2 : Direction2D<'Coordinates>
Returns: Angle
|
![]() ![]() ![]() ![]() ![]() ![]() Find the counterclockwise angle from the first direction to the second. The result will be in the range -180 to 180 degrees
|
Full Usage:
componentIn d2 d1
Parameters:
Direction2D<'Coordinates>
d1 : Direction2D<'Coordinates>
Returns: float
|
![]() ![]() ![]() ![]() ![]() ![]() Find the component of one direction in another direction. This is equal to the cosine of the angle between the directions, or equivalently the dot product of the two directions converted to unit vectors. This is more general and flexible than using `xComponent` or `yComponent`, both of which can be expressed in terms of `componentIn`; for example, `Direction2d.xComponent direction` is equivalent to `Direction2d.componentIn Direction2d.x direction`.
|
|
|
|
|
Full Usage:
equalWithin angle rhs lhs
Parameters:
Angle
rhs : Direction2D<'Coordinates>
lhs : Direction2D<'Coordinates>
Returns: bool
|
![]() ![]() ![]() ![]() ![]() ![]() Compare two directions within an angular tolerance. Returns true if the absolute value of the angle between the two given directions is less than the given tolerance.
|
|
|
|
|
Full Usage:
fromComponents (x, y)
Parameters:
float
y : float
Returns: Direction2D<'Coordinates> option
|
|
Full Usage:
mirrorAcross axis d
Parameters:
Axis2D<'Units, 'Corodiantes>
d : Direction2D<'Coordinates>
Returns: Direction2D<'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Mirror a direction across a particular axis. Note that only the direction of the axis affects the result, since directions are position-independent.
|
|
|
|
|
Full Usage:
orthonormalize xVector xyVector
Parameters: Returns: (Direction2D<'Coordinates> * Direction2D<'Coordinates>) option
|
![]() ![]() ![]() ![]() ![]() ![]() Attempt to form a pair of perpendicular directions from the two given vectors by performing [Gram-Schmidt normalization](https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process): * The first returned direction will be equal to the direction of the first given vector * The second returned direction will be as close as possible to the second given vector while being perpendicular to the first returned direction
|
Full Usage:
perpendicularTo d
Parameters:
Direction2D<'Coordaintes>
Returns: Direction2D<'Coordaintes>
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a direction perpendicular to the given direction, by rotating the given direction 90 degrees counterclockwise. This is the same `Direction2D.rotateBy (Angle.degrees 90)` but is more efficient. Alias for `rotateCounterclockwise`.
|
Full Usage:
placeIn reference direction
Parameters:
Frame2D<'Units, 'GlobalCoordinates, 'LocalCoordinates>
direction : Direction2D<'LocalCoordinates>
Returns: Direction2D<'GlobalCoordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Take a direction defined in local coordinates relative to a given reference frame, and return that direction expressed in global coordinates.
|
|
|
|
|
|
|
Full Usage:
relativeTo frame d
Parameters:
Frame2D<'Units, 'GlobalCoordaintes, 'LocalCoordinates>
d : Direction2D<'GlobalCoordinates>
Returns: Direction2D<'LocalCoordaintes>
|
![]() ![]() ![]() ![]() ![]() ![]() Take a direction defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
|
Full Usage:
reverse direction
Parameters:
Direction2D<'Coordinates>
Returns: Direction2D<'Coordinates>
|
|
Full Usage:
rotateBy angle direction
Parameters:
Angle
direction : Direction2D<'Coordinates>
Returns: Direction2D<'Coordinates>
|
|
Full Usage:
rotateClockwise direction
Parameters:
Direction2D<'Coordinates>
Returns: Direction2D<'Coordinates>
|
|
Full Usage:
rotateCounterclockwise direction
Parameters:
Direction2D<'Coordinates>
Returns: Direction2D<'Coordinates>
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Convert a direction to a polar angle (the counterclockwise angle from the positive X direction). The result will be in the range -180 to 180 degrees.
|
|
|
Full Usage:
toVector d
Parameters:
Direction2D<'Coordiantes>
Returns: Vector2D<Unitless, 'Coordinates>
|
|
|
|
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Get a direction vector from the x and y components. This function takes care of normalizing the x and y components into the unit direction vector. This function also checks for the edge case where the x and y components are both zero. In that case, the function returns `None`.
|
|
![]() ![]() ![]() ![]() ![]() ![]() Get a direction vector from the x and y length components. This function takes care of normalizing the x and y components into the unit direction vector. This function also checks for the edge case where the x and y components are both zero. In that case, the function returns `None`.
|
|
![]() ![]() ![]() ![]() ![]() ![]() Create a direction vector from the x and y components. This function doesn't perform either zero magnitude checks nor does it normalize the input vectors. This function should only be used with input constants or when you are sure that you aren't going to create a direction with an invalid state.
|
|
|
|
|