Point

A point in 3D space. This object lives in the Lua session only. Points are defined by numbers and cannot be defined with expressions. Mathematical operations can be done on points.

Example

    -- Create a default 'Point' at (0,0,0)
    
p1 = pf.Point.New() 

    -- Assign values to each component of the point

p1.x = 1
p1.y = 1
p1.z = 1

    -- Create a 'Point' with number values
    
p2 = pf.Point(2,2,2) 
 
    -- Determine the distance between two points
    
distance = p1:distanceTo(p2)

    -- Some of the valid operators for 'Point'
 
p3 = 2 * p1
p4 = p2 * 2
p5 = p2 / 2
p6 = -p2
p7 = p1 + p2
p8 = p1 - p2
if (p1 ~= p2) then
    print(p1.." is not equal to "..p2)
end

Usage locations (object properties)

The following objects have properties using the Point object:

Property List

Type
The object type string. (Read only string)
X
The x component of the point. (Read/Write number)
Y
The y component of the point. (Read/Write number)
Z
The z component of the point. (Read/Write number)

Method List

DistanceTo (point Point)
Returns the distance between this point and another. (Returns a number object.)

Constructor Function List

New (x number, y number, z number)
Creates a new point. (Returns a Point object.)
New ()
Creates a new point. (Returns a Point object.)

Index List

[number]
Index a component of the point. (Read number)
[number]
Index a component of the point. (Write number)

Property Details

Type
The object type string.
Type
string
Access
Read only
X
The x component of the point.
Type
number
Access
Read/Write
Y
The y component of the point.
Type
number
Access
Read/Write
Z
The z component of the point.
Type
number
Access
Read/Write

Method Details

DistanceTo (point Point)
Returns the distance between this point and another.
Input Parameters
point(Point)
The point to measure the distance To from this point.
Return
number
The distance between the points.

Static Function Details

New (x number, y number, z number)
Creates a new point.
Input Parameters
x(number)
The x component.
y(number)
The y component.
z(number)
The z component.
Return
Point
The new point.
New ()
Creates a new point.
Return
Point
The new point.