Hide menu
Loading...
Searching...
No Matches
Axis2d

Defines a right-handed or left-handed axis in 2D.

An axis is defined by a location point and two perpendicular directions. yDirection is derived from xDirection and the handedness of the axis.

Constructors

Constructor

new Axis2d(location?, xDirection?, isCCWRotation?): Axis2d

Creates an axis.

By default, creates an axis with location `Point2d.origin()` (0, 0), xDirection `Direction2d.xDir()` (1, 0), and yDirection `Direction2d.yDir()` (0, 1).

The provided location point and xDirection are copied.

Parameters

location?

Point2d = ...

Location point of the axis.

xDirection?

Direction2d = ...

X direction of the axis.

isCCWRotation?

boolean = true

If true, yDirection is defined by counter-clockwise rotation of xDirection; otherwise by clockwise rotation.

Returns

Axis2d

Accessors

location

Get Signature

get location(): Point2d

Location point of the axis.

Returns

Point2d

Set Signature

set location(location): void

Sets the location point of the axis.

The coordinates are copied from the provided point.

Parameters

location

Point2d

Location point of the axis.

Returns

void


xDirection

Get Signature

get xDirection(): Direction2d

X direction of the axis.

Returns

Direction2d

Set Signature

set xDirection(direction): void

Sets the X direction of the axis.

The components are copied from the provided direction. Y direction is updated to remain perpendicular to X direction and preserve the current handedness of the axis.

Parameters

direction

Direction2d

X direction of the axis.

Returns

void


yDirection

Get Signature

get yDirection(): Direction2d

Y direction of the axis.

Returns

Direction2d

Set Signature

set yDirection(direction): void

Sets the Y direction of the axis.

The components are copied from the provided direction. X direction is updated to remain perpendicular to Y direction and preserve the current handedness of the axis.

Parameters

direction

Direction2d

Y direction of the axis.

Returns

void

Methods

clone()

clone(): Axis2d

Creates a new axis with the same location, xDirection, and yDirection as this axis.

Returns

Axis2d


copy()

copy(other): this

Copies the location, xDirection, and yDirection of other to this axis.

The values of the point and directions are copied without replacing the existing point and direction objects of this axis.

Parameters

other

Axis2d

Axis to copy.

Returns

this


setLocation()

setLocation(location): this

Sets the location point of the axis.

The coordinates are copied from the provided point.

Parameters

location

Point2d

Location point of the axis.

Returns

this


setXDirection()

setXDirection(direction): this

Sets the X direction of the axis.

Y direction is updated to remain perpendicular to X direction and preserve the current handedness of the axis.

Parameters

direction

Direction2d

X direction of the axis.

Returns

this


setYDirection()

setYDirection(direction): this

Sets the Y direction of the axis.

X direction is updated to remain perpendicular to Y direction and preserve the current handedness of the axis.

Parameters

direction

Direction2d

Y direction of the axis.

Returns

this