Matrix2D
This object represents a matrix which can be used to transform 2D points Note: translation, rotation scaling etc.
Constructor
Matrix2D objects are usually constructed by the utility methods listed below.
IdentityMatrix2D()
Returns: a Matrix2D which is an identity matrix.
ReflectionMatrix2D( Point2D p1, Point2D p1)
Returns: a Matrix2D which is performs reflection about a line between the passed points.
- P1 (Point2D) the start point of the line about which reflection will take place
- P2 (Point2D) the end point of the line about which reflection will take place
RotationMatrix2D( Point2D rotation_pt, double angle)
Returns: a Matrix2D which is performs the rotation about the specified point by the specified amount.
- rotation_pt (Point2D) the point about which rotation will take place
- angle(double) the angle to rotate by in degrees, positive values are CCW.
ScalingMatrix2D( Vector2D scale_vec)
Returns: a Matrix2D which performs the scaling around the origin (0,0) by the specified amount. scale_vec (Vector2D) the X and Y values of the vector specify the amount to scale in X and Y
ScalingMatrix2D( Point2D scale_pt, Vector2D scale_vec)
Returns: a Matrix2D which is performs the scaling about the specified point by the specified amount.
- scaling_pt (Point2D) the point about which scaling will take place
- scale_vec (Vector2D) the X and Y values of the vector specify the amount to scale in X and Y
TranslationMatrix2D( Vector2D vec)
Returns: a Matrix2D which is performs the translation specified by the vector.
- vec (Vector2D) the X and Y values of the vector specify the distances to translate in X and Y
Operations
Matrix2D * Matrix2D Multiplying a matrix by a matrix returns a new matrix
- Example Code:
local p1 = Point2D(10 ,10) local xform = RotationMatrix2D(Point2D(0,0) 90) local p3 = xform * p1 DisplayMessageBox("Transformed p1 = " p3.X " , " p3.Y)
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