Point

public struct
loom2d.math.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

Constants

Constants

ZERO: Point static

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

Point ( _x: Number = 0 , _y: Number = 0 )

Constructor for Point with optional components.

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.

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_divideassignment ( s: Number ): Void

Divides This point by the scalar s.

Parameters

s: Number


__op_minus ( p1: Point , p2: Point ): Point

static

Subtracts Point p2 from Point p1 and returns the result.

Parameters

p1: Point
p2: Point


__op_minusassignment ( p: Point ): Void

Subtracts Point p from this Point.

Parameters

p: 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


__op_plusassignment ( p: Point ): Void

Adds Point p to this Point.

Parameters

p: Point


add ( other: Point ): Point

Adds the supplied Point to this Point.

Parameters

other: 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


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

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


equals ( p: Point ): Boolean

Checks whether the Point is numerically equal to another Point.

Parameters

p: 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


scale ( s: Number ): Void

Scales the point by the given Scalar.

Parameters

s: Number


subtract ( other: Point ): Point

Subtracts the supplied Point from this Point.

Parameters

other: Point


toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

: