Point2
- class Communicator.Point2()
Constructors
Methods
Constructors
Methods
add
- Communicator.Point2.add(pt1, pt2)
Adds two points
- Arguments
pt1 (
Communicator.Point2()
) – initial pointpt2 (
Communicator.Point2()
) – the point to add
- Return type
Communicator.Point2
- Returns
new point set to pt1 + pt2
assign
- Communicator.Point2.assign(pt)
Sets this point equal to another point
- Arguments
pt (
Communicator.Point2()
) – the point whose values will be used to set this object
- Return type
Communicator.Point2
- Returns
the point object
copy
- Communicator.Point2.copy()
Creates a copy of this point
- Return type
Communicator.Point2
- Returns
Copy of this point
equals
- Communicator.Point2.equals(pt)
Compares this point with another point
- Arguments
pt (
Communicator.Point2()
) – the point to compare with
- Return type
boolean
- Returns
True if the values of this point equal the other. False otherwise.
forJson
- Communicator.Point2.forJson()
Note
forJson is deprecated: Use
toJson
instead.- Return type
Object
length
- Communicator.Point2.length()
Returns the length of this point
- Return type
number
- Returns
the point length
scale
- Communicator.Point2.scale(pt, k)
Scale a point by a constant factor
- Arguments
pt (
Communicator.Point2()
) – Point to be scaledk (
number()
) – Amount to scale by
- Return type
Communicator.Point2
- Returns
The scaled point
set
- Communicator.Point2.set(x, y)
Sets the values of this point
- Arguments
x (
number()
) – value to set for xy (
number()
) – value to set for y
- Return type
Communicator.Point2
- Returns
the point object
squaredLength
- Communicator.Point2.squaredLength()
Returns the squared length of this vector.
- Return type
number
- Returns
Vector squared length.
subtract
- Communicator.Point2.subtract(pt1, pt2)
Subtracts a point from another
- Arguments
pt1 (
Communicator.Point2()
) – initial pointpt2 (
Communicator.Point2()
) – the point to subtract
- Return type
Communicator.Point2
- Returns
new point set to pt1 - pt2
toJson
- Communicator.Point2.toJson()
Creates an object ready for JSON serialization.
- Return type
Object
- Returns
The prepared object.
distance
- Communicator.Point2.distance(p1, p2)
Calculate distance between two points
- Arguments
p1 (
Communicator.Point2()
) – first pointp2 (
Communicator.Point2()
) – second point
- Return type
number
- Returns
the distance between p1 and p2
fromJson
- Communicator.Point2.fromJson(objData)
Creates a new [[Point2]] from an object given by
toJson
- Arguments
objData (
any()
) – An object given bytoJson
- Return type
Communicator.Point2
- Returns
The prepared object.
fromPoint3
- Communicator.Point2.fromPoint3(p)
- Arguments
p (
Communicator.Point3()
) –
- Return type
Communicator.Point2