UVPoint

A point in 2D 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 'UVPoint' at (0,0,0)

p1 = pf.UVPoint.New()

    -- Assign values to each component of the point

p1.x = 1
p1.y = 1

    -- Create a 'UVPoint' with number values

p2 = pf.UVPoint(2,2)

    -- Determine the distance between two points

distance = p1:distanceTo(p2)

    -- Some of the valid operators for 'UVPoint'

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

The UVPoint object can be accessed from the following locations:

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 UVPoint)
Returns the distance between this point and another. (Returns a number object.)

Constructor Function List

New (x number, y number)
Creates a new 2D point. (Returns a UVPoint object.)
New ()
Creates a new point. (Returns a UVPoint 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 UVPoint)
Returns the distance between this point and another.
Input Parameters
point(UVPoint)
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)
Creates a new 2D point.
Input Parameters
x(number)
The x component.
y(number)
The y component.
Return
UVPoint
The new point.
New ()
Creates a new point.
Return
UVPoint
The new point.