Conversion and transformation functions for Point3d.
Convert a Point3d to a Vec4. The resulting Vec4 will have a W
component of 1 so that it is affected by translation
when performing matrix transformations.
Point3d.toVec4 (Point3d.fromCoordinates ( 2, 1, 3 ))
--> vec4 2 1 3 1Convert a Vec3 to a Point3d.
Point3d.fromVec3 (vec3 2 1 3)
--> Point3d.fromCoordinates ( 2, 1, 3 )Transform a Point3d by a Mat4;
point
|> Point3d.transformBy matrixis equivalent to
point
|> Point3d.toVec3
|> Matrix4.transform matrix
|> Point3d.fromVec3For example:
point =
Point3d.fromCoordinates ( 2, 1, 3 )
matrix =
Matrix4.makeTranslate3 3 4 5
Point3d.transformBy matrix point
--> Point3d.fromCoordinates ( 5, 5, 8 )
Convert a
Point3dto aVec3.