springroll.native.Point Class

The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

Constructor

springroll.native.Point

(
  • x
  • y
)

Parameters:

  • x Number

    position of the point

  • y Number

    position of the point

add

(
  • other
)

Defined in add:99

Adds the x and y values of a point to this point.

Parameters:

  • other Point

    The point to add to this one

clone

() Point

Defined in clone:35

Creates a clone of this point

Returns:

Point:

a copy of the point

dotProd

(
  • other
)

Defined in dotProd:46

Returns the dot product between this point and another one.

Parameters:

  • other Point

    The point to form a dot product with

Returns:

The dot product between the two points.

fromJSON

(
  • inputObj
)

Defined in fromJSON:153

Works with a reviver function to restore from a native Object to an instance of this type.

Parameters:

  • inputObj Object

    serialized object

length

()

Defined in length:57

Returns the length (or magnitude) of this point.

Returns:

The length of this point.

lengthSq

()

Defined in lengthSq:67

Returns the squared length (or magnitude) of this point. This is faster than length().

Returns:

The length squared of this point.

normalize

()

Defined in normalize:77

Reduces the point to a length of 1.

scaleBy

(
  • value
)

Defined in scaleBy:126

Multiplies the x and y values of this point by a value.

Parameters:

  • value Number

    The value to scale by.

subtract

(
  • other
)

Defined in subtract:88

Subtracts the x and y values of a point from this point.

Parameters:

  • other Point

    The point to subtract from this one

toJSON

() Object

Defined in toJSON:137

creates a serializable form of this object so it may be saved or passed via Bellhop. Note that it adds a special property named __classname to tell the Reviver how to restore a pristine Object

Returns:

Object:

serializable object

truncate

(
  • maxLength
)

Defined in truncate:110

Truncate the length of the point to a maximum.

Parameters:

  • maxLength Number

    The maximum length to allow in this point.

x

Number

Defined in x:18

Default: 0

y

Number

Defined in y:25

Default: 0