Packagealternativa.types
Classpublic final class Point3D

Point (radius-vector) in a three-dimentional space.



Public Properties
 PropertyDefined by
  length : Number
Vector length.
Point3D
  lengthSqr : Number
[read-only] The square of vector length.
Point3D
  x : Number
X coordinate
Point3D
  y : Number
Y coordinate
Point3D
  z : Number
Z coordinate
Point3D
Public Methods
 MethodDefined by
  
Point3D(x:Number = 0, y:Number = 0, z:Number = 0)
Create an instance of class.
Point3D
  
add(point:Point3D):void
Coordinates summ.
Point3D
  
angle(p1:Point3D, p2:Point3D):Number
[static]Calculate angle between vectors.
Point3D
  
angleFast(p1:Point3D, p2:Point3D):Number
[static]Calculate angle between unit vectors.
Point3D
  
average(a:Point3D, b:Point3D = null, c:Point3D = null, d:Point3D = null):Point3D
[static]Calculate an average point.
Point3D
  
Clone point.
Point3D
  
copy(point:Point3D):void
Copy point coordinates.
Point3D
  
[static]Calculate vector product.
Point3D
  
cross2(a:Point3D, b:Point3D):void
Calculates cross product of two given vectors and stores the result in the current vector.
Point3D
  
cross2D(a:Point3D, b:Point3D):Number
[static]Get vector XY plane vectors projections product.
Point3D
  
[static]Calculate vector difference.
Point3D
  
dot(a:Point3D, b:Point3D):Number
[static]Calculate scalar vector product.
Point3D
  
dot2D(a:Point3D, b:Point3D):Number
[static]Get scalar XY plane vectors projections product.
Point3D
  
equals(point:Point3D, threshold:Number = 0):Boolean
Compare points coordinates to a given treshold.
Point3D
  
floor():void
Apply Math.
Point3D
  
interpolate(p1:Point3D, p2:Point3D, k:Number = 0.5):Point3D
[static]Linear coordinates interpolation.
Point3D
  
invert():void
Invert vector.
Point3D
  
multiply(n:Number):void
Multiply by scalar.
Point3D
  
normalize():void
Normalize vector to a unit length.
Point3D
  
random(xMin:Number = 0, xMax:Number = 0, yMin:Number = 0, yMax:Number = 0, zMin:Number = 0, zMax:Number = 0):Point3D
[static]Create point with random coordinates.
Point3D
  
reset(x:Number = 0, y:Number = 0, z:Number = 0):void
Set zero coordinates.
Point3D
  
round():void
Round point coordinates.
Point3D
  
subtract(point:Point3D):void
Subtract coordinates.
Point3D
  
[static]Calculate sum of vectors.
Point3D
  
toPoint():Point
Get plane XY projection of the point
Point3D
  
toString():String
String vector representation.
Point3D
  
Point (vector) transformation.
Point3D
  
Point3D
Property detail
lengthproperty
length:Number  [read-write]

Vector length.

Implementation
    public function get length():Number
    public function set length(value:Number):void
lengthSqrproperty 
lengthSqr:Number  [read-only]

The square of vector length.

Implementation
    public function get lengthSqr():Number
xproperty 
public var x:Number

X coordinate

yproperty 
public var y:Number

Y coordinate

zproperty 
public var z:Number

Z coordinate

Constructor detail
Point3D()constructor
public function Point3D(x:Number = 0, y:Number = 0, z:Number = 0)

Create an instance of class.

Parameters
x:Number (default = 0)X coordinate
 
y:Number (default = 0)Y coordinate
 
z:Number (default = 0)Z coordinate
Method detail
add()method
public function add(point:Point3D):void

Coordinates summ.

Parameters
point:Point3Dthe point which coordinates are being added to own
angle()method 
public static function angle(p1:Point3D, p2:Point3D):Number

Calculate angle between vectors.

Parameters
p1:Point3Dfirst vector
 
p2:Point3Dsecond vector

Returns
Numberangle between the vectors in radians
angleFast()method 
public static function angleFast(p1:Point3D, p2:Point3D):Number

Calculate angle between unit vectors.

Parameters
p1:Point3Dfirst vector
 
p2:Point3Dsecond vector

Returns
Numberangle between the vectors in radians
average()method 
public static function average(a:Point3D, b:Point3D = null, c:Point3D = null, d:Point3D = null):Point3D

Calculate an average point.

Parameters
a:Point3Dfirst point
 
b:Point3D (default = null)second point
 
c:Point3D (default = null)third point
 
d:Point3D (default = null)fourth point

Returns
Point3Daverge point
clone()method 
public function clone():Point3D

Clone point.

Returns
Point3Dcloned point
copy()method 
public function copy(point:Point3D):void

Copy point coordinates.

Parameters
point:Point3Dpoint which coordinates are being copied
cross()method 
public static function cross(a:Point3D, b:Point3D):Point3D

Calculate vector product.

Parameters
a:Point3Dfirst multiplier
 
b:Point3Dsecond multiplier

Returns
Point3Dcross-product of the vectors
cross2()method 
public function cross2(a:Point3D, b:Point3D):void

Calculates cross product of two given vectors and stores the result in the current vector.

Parameters
a:Point3Dfirst vector
 
b:Point3Dsecond vector
cross2D()method 
public static function cross2D(a:Point3D, b:Point3D):Number

Get vector XY plane vectors projections product.

Parameters
a:Point3Dfirst multiplier
 
b:Point3Dsecond multiplier

Returns
Numbercross-product of projections of the vectors on XY plane
difference()method 
public static function difference(a:Point3D, b:Point3D):Point3D

Calculate vector difference.

Parameters
a:Point3Dminuend vector
 
b:Point3Dsubtrahend vector

Returns
Point3Dvector ab = a - b
dot()method 
public static function dot(a:Point3D, b:Point3D):Number

Calculate scalar vector product.

Parameters
a:Point3Dfirst multiplier
 
b:Point3Dsecond multiplier

Returns
Numberdot-product of the vectors
dot2D()method 
public static function dot2D(a:Point3D, b:Point3D):Number

Get scalar XY plane vectors projections product.

Parameters
a:Point3Dfirst multiplier
 
b:Point3Dsecond multiplier

Returns
Numberdot-product of projections of the vectors on XY plane
equals()method 
public function equals(point:Point3D, threshold:Number = 0):Boolean

Compare points coordinates to a given treshold.

Parameters
point:Point3DPoint to compare.
 
threshold:Number (default = 0)comparison threshold

Returns
Booleantrue if absolute difference between any corresponding coordinates of the points is not greater than given threshold, otherwise false
floor()method 
public function floor():void

Apply Math.floor() function to point coordinates.

interpolate()method 
public static function interpolate(p1:Point3D, p2:Point3D, k:Number = 0.5):Point3D

Linear coordinates interpolation. Interpolation uses p1 + (p2 - p1)k formula, where points p1 and p2 are limiting the segment, and k is an interpolation parameter.

Parameters
p1:Point3Dbeginning segment point
 
p2:Point3Dfinishing segment point
 
k:Number (default = 0.5)parameter value

Returns
Point3Dinterpolated coordinates
invert()method 
public function invert():void

Invert vector.

multiply()method 
public function multiply(n:Number):void

Multiply by scalar.

Parameters
n:Numbera number by which coordinates are being multiplied
normalize()method 
public function normalize():void

Normalize vector to a unit length.

random()method 
public static function random(xMin:Number = 0, xMax:Number = 0, yMin:Number = 0, yMax:Number = 0, zMin:Number = 0, zMax:Number = 0):Point3D

Create point with random coordinates.

Parameters
xMin:Number (default = 0)minimum X coordinate value
 
xMax:Number (default = 0)maximum X coordinate value
 
yMin:Number (default = 0)minimum Y coordinate value
 
yMax:Number (default = 0)maximum Y coordinate value
 
zMin:Number (default = 0)minimum Z coordinate value
 
zMax:Number (default = 0)maximum Z coordinate value

Returns
Point3Da point with random coordinates
reset()method 
public function reset(x:Number = 0, y:Number = 0, z:Number = 0):void

Set zero coordinates.

Parameters
x:Number (default = 0)
 
y:Number (default = 0)
 
z:Number (default = 0)
round()method 
public function round():void

Round point coordinates.

subtract()method 
public function subtract(point:Point3D):void

Subtract coordinates.

Parameters
point:Point3Dpoint which coordinates are being subtracted from own
sum()method 
public static function sum(a:Point3D, b:Point3D):Point3D

Calculate sum of vectors.

Parameters
a:Point3Dfirst item
 
b:Point3Dsecond item

Returns
Point3Dsum of the vectors
toPoint()method 
public function toPoint():Point

Get plane XY projection of the point

Returns
Pointprojection on XY plane
toString()method 
public function toString():String

String vector representation.

Returns
Stringstring vector representation
transform()method 
public function transform(m:Matrix3D):void

Point (vector) transformation. New coordinates value is a result of matrix multiply on vector M × r.

Parameters
m:Matrix3Dtransformation matrix
transformOrientation()method 
public function transformOrientation(m:Matrix3D):void

Parameters
m:Matrix3Dtransformation matrix