LPoint Class
Creates a new point. The LPoint object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.
Constructor
LPoint
-
x
-
y
Parameters:
-
x
FloatThe horizontal coordinate.
-
y
FloatThe vertical coordinate.
Example:
var myPoint = new LPoint(100,100);
Item Index
Methods
Methods
add
-
v
Adds the coordinates of another point to the coordinates of this point to create a new point.
Parameters:
-
v
LPointThe point to be added.
Returns:
The new point.
clone
()
LPoint
public
Creates a copy of this LPoint object.
Returns:
The new LPoint object.
copyFrom
-
sourcePoint
Copies all of the point data from the source LPoint object into the calling LPoint object.
Parameters:
-
sourcePoint
LPointThe LPoint object from which to copy the data.
distance
-
p1
-
p2
[static]Returns the distance between p1 and p2.
Returns:
The distance between the first and second points.
distance2
-
x1
-
y1
-
x2
-
y2
[static]Returns the distance between p1 and p2.
Parameters:
Returns:
The distance between the first and second points.
equals
-
The
Determines whether two points are equal. Two points are equal if they have the same x and y values.
Parameters:
-
The
LPointpoint to be compared.
Returns:
A value of true if the object is equal to this Point object; false if it is not equal.
interpolate
-
p1
-
p2
-
f
[static]Determines a point between two specified points. The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer the value of the parameter f is to 1.0, the closer the interpolated point is to the first point (parameter p1). The closer the value of the parameter f is to 0, the closer the interpolated point is to the second point (parameter p2).
Parameters:
Returns:
The new, interpolated point.
length
()
Float
public
Returns the length of the line segment from (0,0) to this point.
Returns:
The length of the line segment from (0,0) to this point.
normalize
-
thickness
Scales the line segment between (0,0) and the current point to a set length.
Parameters:
-
thickness
FloatThe scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1).
offset
-
dx
-
dy
Offsets the LPoint object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.
Parameters:
-
dx
FloatThe amount by which to offset the horizontal coordinate, x
-
dy
FloatThe amount by which to offset the vertical coordinate, y.
polar
-
len
-
angle
[static]Converts a pair of polar coordinates to a Cartesian point coordinate.
Parameters:
-
len
FloatThe length coordinate of the polar pair.
-
angle
FloatThe angle, in radians, of the polar pair.
Returns:
The Cartesian point.
setTo
-
x
-
y
Sets the members of LPoint to the specified values
Parameters:
-
x
Floatthe x values to set the point to.
-
y
Floatthe y values to set the point to.
Properties
x
Float
public
The horizontal coordinate of the point.
Default: 0
y
Float
public
The vertical coordinate of the point.
Default: 0