Point
Description
2D Point structure which has useful utility methods and is assign by value.
API overview
Constructor
Point
(
_x: Number
= 0
,
_y: Number
= 0
)
Constructor for Point with optional components.
Attributes
Public attributes
| length: Number |
read-only
Gets the length defined by the Point |
| lengthSquared: Number |
read-only
Gets the length2 defined by the Point |
| x: Number |
Direct access to the x and y components of the Point |
| y: Number |
Direct access to the x and y components of the Point |
Functions
Public functions
| __op_assignment ( p1: Point , p2: Point ): Point |
static Assigns p2 to p1 and returns p1 (required by struct types) |
| __op_divideassignment ( s: Number ): Void |
Divides This point by the scalar s |
| __op_minus ( p1: Point , p2: Point ): Point |
static Subtracts Point p2 from Point p1 and returns the result |
| __op_minusassignment ( p: Point ): Void |
Subtracts Point p from this Point |
| __op_multiplyassignment ( s: Number ): Void |
Multiplies This point by the scalar s |
| __op_plus ( p1: Point , p2: Point ): Point |
static Adds Point p2 to Point p1 and returns p1 |
| __op_plusassignment ( p: Point ): Void |
Adds Point p to this Point |
| add ( other: Point ): Point |
Adds the supplied Point to this Point |
| angle ( p1: Point , p2: Point ): Number |
static Returns the angle between p1 and p2, as though they were Vectors |
| clone (): Point |
Clones this Point to a new one |
| det ( p1: Point , p2: Point ): Number |
static Returns the determinant between p1 and p2, as though they were Vectors |
| distance ( p1: Point , p2: Point ): Number |
static Gets the distance between two Points |
| distanceSquared ( p1: Point , p2: Point ): Number |
static Gets the distance squared between two Points |
| dot ( p1: Point , p2: Point ): Number |
static Returns the dot product between p1 and p2, as though they were Vectors |
| equals ( p: Point ): Boolean |
Checks whether the Point is numerically equal to another Point |
| interpolate ( p1: Point , p2: Point , t: Number ): Point |
static Interpolates 2 points returning a new point at the specified time |
| normalize ( thickness: Number = 1 ): Void |
Normalizes the Point to a specified length |
| offset ( dx: Number , dy: Number ): Void |
Offsets the point by the given delta values |
| polar ( len: Number , angle: Number ): Point |
static Gets a polar Point given an angle and length |
| scale ( s: Number ): Void |
Scales the point by the given Scalar |
| subtract ( other: Point ): Point |
Subtracts the supplied Point from this Point |
Constructor
Attributes
Constants
ZERO: Point
static
Functions
__op_assignment ( p1: Point , p2: Point ): Point
static
Assigns p2 to p1 and returns p1 (required by struct types).
Parameters
| p1: Point | |
| p2: Point |
__op_minus ( p1: Point , p2: Point ): Point
static
Subtracts Point p2 from Point p1 and returns the result.
Parameters
| p1: Point | |
| p2: Point |
__op_multiplyassignment ( s: Number ): Void
Multiplies This point by the scalar s.
Parameters
| s: Number |
__op_plus ( p1: Point , p2: Point ): Point
static
Adds Point p2 to Point p1 and returns p1.
Parameters
| p1: Point | |
| p2: Point |
angle ( p1: Point , p2: Point ): Number
static
Returns the angle between p1 and p2, as though they were Vectors
Parameters
| p1: Point | |
| p2: Point |
det ( p1: Point , p2: Point ): Number
static
Returns the determinant between p1 and p2, as though they were Vectors
Parameters
| p1: Point | |
| p2: Point |
distance ( p1: Point , p2: Point ): Number
static
Gets the distance between two Points.
Parameters
| p1: Point | |
| p2: Point |
distanceSquared ( p1: Point , p2: Point ): Number
static
Gets the distance squared between two Points.
Parameters
| p1: Point | |
| p2: Point |
dot ( p1: Point , p2: Point ): Number
static
Returns the dot product between p1 and p2, as though they were Vectors
Parameters
| p1: Point | |
| p2: Point |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
interpolate ( p1: Point , p2: Point , t: Number ): Point
static
Interpolates 2 points returning a new point at the specified time.
Parameters
| p1: Point | |
| p2: Point | |
| t: Number |
normalize ( thickness: Number = 1 ): Void
Normalizes the Point to a specified length.
Parameters
| thickness: Number = 1 |
offset ( dx: Number , dy: Number ): Void
Offsets the point by the given delta values.
Parameters
| dx: Number | |
| dy: Number |
polar ( len: Number , angle: Number ): Point
static
Gets a polar Point given an angle and length.
Parameters
| len: Number | |
| angle: Number |