Point2D

From SDK
Jump to navigation Jump to search
Back.jpg

This object represents a 2D point (X and Y values only). It is used by many other objects and can also be used with other geometry objects such as Vector2D to perform calculations.

Constructor

Point2D()

This construct an uninitialised point with invalid x and y values which can be tested for using the .IsInvalid property


Point2D(double x, double y)

A new point with the specified X and Y values

x (double) the value for the x coordinate of the point
y (double) the value for the y coordinate of the point

Point2D(Point2D pt)

A new point with the same X and Y values as the passed point

pt (Point2D) an existing point to copy X and Y values from

Properties

.IsInvalid

Returns: (bool) true if the point is invalid

Note: not initialised or:SetInvalid called

.X or .x

Interaction: Read and Write

Returns: (double) x coordinate for point


.Y or .y

Interaction: Read and Write

Returns: (double) y coordinate for point


Methods

:IsCoincident( Point2D point, double tol)

Returns: (bool) true if passed point is coincident with this point within passed tolerance

point (Point2D)point to check for coincidence
tol(double) maximum distance apart point can be and still be considered coincident

:Set( double x, double y)

Set both the x and y values for the point

x(double) new x value for point
y(double) new y value for point

:SetInvalid()

Set the point to invalid state X and Y will be lost


Operations

Matrix2D * Point2D

Multiplying a matrix by a point returns a transformed point


Point2D - Point2D

Subtracting a point from another point will returns a Vector2D with the difference between the 2 points.


Point2D + Vector2D

Adding a vector to a point will returns a point displaced from original point by adding the vector


Point2D - Vector2D

Subtracting a vector from a point will returns a point displaced from original point by subtracting the vector


Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information