Value > Basic Data Values > Point2 Values |
The point2 class defines the characteristics of points in 2D space.
This class is a 2D version of Point3 and is used in utility rollout positioning parameters and for accessing Bitmap values, etc.
See also 2D and 3D Point Literals.
Literals
[<expr>, <expr>]
EXAMPLES |
[x, y] [10, 20] [sin x, cos x] |
Constructors
point2 <x> <y>-- x and y are numbers <point3> as point2-- created from the x and y components of the point3
Properties
<point2>.x: Float <point2>.y: Float
Operators
<point2> == <point2> <point2> != <point2> <point2> + <point2_or_number> <point2> - <point2_or_number> <point2> * <point2_or_number> <point2> / <point2_or_number>
Standard vector arithmetic. If the second operand is a number it does scalar arithmetic on vector.
-<point2>
unary minus
<point2>[<integer>]
Returns a component of the Point2 as a float. Valid range on the index is 1 to 2.
<point2>[<integer>]=<float>
Sets a component of the Point2 to the float. Valid range on the index is 1 to 2.
Methods
copy <point2>
Creates a new copy of the point2 value.
EXAMPLES |
newPoint = copy oldPoint |
The new value contains a copy of the input point2 value, and is independent of the input point2 value.
random <point2> <point2>
Generates a pseudo-random point between the given points.
length<point2>
Returns the length of the vector.
distance <point2> <point2>
Returns the distance between the points - length of (point 2 - point 1).
normalize <point2>
Returns the point2 value normalized such that the vector length equals 1.