The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.
The following code creates a point at (0,0):
Methods and properties of the following classes use Point objects:
- BitmapData
- DisplayObject
- DisplayObjectContainer
- DisplacementMapFilter
- NativeWindow
- Matrix
- Rectangle
You can use the new Point()
constructor to create a Point
object.
See also:
Static methods
staticdistance(pt1:Point, pt2:Point):Float
Returns the distance between pt1
and pt2
.
Parameters:
pt1 | The first point. |
---|---|
pt2 | The second point. |
Returns:
The distance between the first and second points.
staticinterpolate(pt1:Point, pt2:Point, f:Float):Point
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 pt1
). The closer the value of the parameter
f
is to 0, the closer the interpolated point is to the second
point (parameter pt2
).
Parameters:
pt1 | The first point. |
---|---|
pt2 | The second point. |
f | The level of interpolation between the two points. Indicates
where the new point will be, along the line between
|
Returns:
The new, interpolated point.
staticinterpolateToOutput(pt1:Point, pt2:Point, f:Float, output:Point):Point
Determines a point between two specified points, and sets them on the
specified output point (or a new point, if null). 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 pt1
). The closer the value of the parameter
f
is to 0, the closer the interpolated point is to the second
point (parameter pt2
).
Parameters:
pt1 | The first point. |
---|---|
pt2 | The second point. |
f | The level of interpolation between the two points. Indicates
where the new point will be, along the line between
|
output | An optional point to be used for the result of the operation. |
Returns:
The new, interpolated point (or the object passed in as the output parameter, if not null).
staticpolar(len:Float, angle:Float):Point
Converts a pair of polar coordinates to a Cartesian point coordinate.
Parameters:
len | The length coordinate of the polar pair. |
---|---|
angle | The angle, in radians, of the polar pair. |
Returns:
The Cartesian point.
staticpolarToOutput(len:Float, angle:Float, output:Point):Point
Converts a pair of polar coordinates to a Cartesian point coordinate, and sets them on the specified output point (or a new point, if null).
Parameters:
len | The length coordinate of the polar pair. |
---|---|
angle | The angle, in radians, of the polar pair. |
output | An optional point to be used for the result of the operation. |
Returns:
The Cartesian point (or the object passed in as the output parameter, if not null).
Constructor
Variables
Methods
add(v:Point):Point
Adds the coordinates of another point to the coordinates of this point to create a new point.
Parameters:
v | The point to be added. |
---|
Returns:
The new point.
addToOutput(v:Point, output:Point):Point
Adds the coordinates of another point to the coordinates of this point and sets them on the specified output point (or a new point, if null).
Parameters:
v | The point to be added. |
---|---|
output | An optional point to be used for the result of the operation. |
Returns:
The new point (or the object passed in as the output parameter, if not null).
copyFrom(sourcePoint:Point):Void
Copies all of the point data from the source Point object into the calling Point object.
Parameters:
sourcePoint | The Point object from which to copy the data. |
---|
normalize(thickness:Float):Void
Scales the line segment between (0,0) and the current point to a set length.
Parameters:
thickness | The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1). |
---|
Returns:
The normalized point.
offset(dx:Float, dy:Float):Void
Offsets the Point 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 | The amount by which to offset the horizontal coordinate, x. |
---|---|
dy | The amount by which to offset the vertical coordinate, y. |
setTo(xa:Float, ya:Float):Void
Sets the members of Point to the specified values
Parameters:
xa | the values to set the point to. |
---|---|
null | ya |
subtract(v:Point):Point
Subtracts the coordinates of another point from the coordinates of this point to create a new point.
Parameters:
v | The point to be subtracted. |
---|
Returns:
The new point.
subtractToOutput(v:Point, output:Point):Point
Subtracts the coordinates of another point from the coordinates of this point, and sets them on the specified output point (or a new point, if null).
Parameters:
v | The point to be subtracted. |
---|---|
output | An optional point to be used for the result of the operation. |
Returns:
The new point (or the object passed in as the output parameter, if not null).