Q3BoundingBox_Copy |
( TQ3BoundingBox * ) Q3BoundingBox_Copy ( const TQ3BoundingBox *bBox, TQ3BoundingBox *result );
Copy a bounding box.
Available in inline form as Q3BFastoundingBox_Copy.
- bBox
- Address of source bounding box.
- result
- Address of bounding box to set (may be the same as bBox).
Q3BoundingBox_Reset |
( TQ3BoundingBox * ) Q3BoundingBox_Reset ( TQ3BoundingBox *bBox );
Reset (set to empty) a bounding box.
Available in inline form as Q3FastBoundingBox_Reset.
- bBox
- Address of bounding box to reset.
Q3BoundingBox_Set |
( TQ3BoundingBox * ) Q3BoundingBox_Set ( TQ3BoundingBox *bBox, const TQ3Point3D *min, const TQ3Point3D *max, TQ3Boolean isEmpty );
Set a bounding box.
Available in inline form as Q3FastBoundingBox_Set.
- bBox
- Address of bounding box to set.
- min
- Address of point indicating minimum X, Y, and Z.
- max
- Address of point indicating maximum X, Y, and Z.
- isEmpty
- True if the bounding box is empty, false otherwise.
Q3BoundingBox_SetFromPoints3D |
( TQ3BoundingBox * ) Q3BoundingBox_SetFromPoints3D ( TQ3BoundingBox *bBox, const TQ3Point3D *points3D, TQ3Uns32 numPoints, TQ3Uns32 structSize );
Set a bounding box to just enclose a set of 3D points.
- bBox
- Address of bounding box to set.
- points3D
- Array of 3D points.
- numPoints
- How many points are in the array.
- structSize
- Size of each array element, typically sizeof(TQ3Point3D).
Q3BoundingBox_SetFromRationalPoints4D |
( TQ3BoundingBox * ) Q3BoundingBox_SetFromRationalPoints4D ( TQ3BoundingBox *bBox, const TQ3RationalPoint4D *rationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 structSize );
Set a bounding box to just enclose a set of 4D rational points.
- bBox
- Address of bounding box to set.
- rationalPoints4D
- Array of 4D rational points.
- numPoints
- How many points are in the array.
- structSize
- Size of each array element, typically sizeof(TQ3RationalPoint4D).
Q3BoundingBox_Union |
( TQ3BoundingBox * ) Q3BoundingBox_Union ( const TQ3BoundingBox *b1, const TQ3BoundingBox *b2, TQ3BoundingBox *result );
Compute the minimum bounding box that encloses both 'b1' and 'b2'.
- b1
- Address of one bounding box.
- b2
- Address of another bounding box.
- result
- Address of bounding box to set (may be the same as b1 and/or b2).
Q3BoundingBox_UnionPoint3D |
( TQ3BoundingBox * ) Q3BoundingBox_UnionPoint3D ( const TQ3BoundingBox *bBox, const TQ3Point3D *point3D, TQ3BoundingBox *result );
Return the minimum bounding box that encloses both 'bBox' and 'point3D'.
- bBox
- Address of initial bounding box.
- point3D
- Address of a point to enclose.
- result
- Address of bounding box to set (may be the same as bBox).
Q3BoundingBox_UnionRationalPoint4D |
( TQ3BoundingBox * ) Q3BoundingBox_UnionRationalPoint4D ( const TQ3BoundingBox *bBox, const TQ3RationalPoint4D *rationalPoint4D, TQ3BoundingBox *result );
Return the minimum bounding box that encloses both 'bBox' and 'rationalPoint4D'.
- bBox
- Address of initial bounding box.
- rationalPoint4D
- Address of a point to enclose.
- result
- Address of bounding box to set (may be the same as bBox).
Q3BoundingSphere_Copy |
( TQ3BoundingSphere * ) Q3BoundingSphere_Copy ( const TQ3BoundingSphere *bSphere, TQ3BoundingSphere *result );
Copy a bounding sphere.
Available in inline form as Q3FastBoundingSphere_Copy.
- bSphere
- Address of source bounding sphere.
- result
- Address of bounding sphere to set (may be the same as bSphere).
Q3BoundingSphere_Reset |
( TQ3BoundingSphere * ) Q3BoundingSphere_Reset ( TQ3BoundingSphere *bSphere );
Reset (set to empty) a bounding sphere.
Available in inline form as Q3FastBoundingSphere_Reset.
- bSphere
- Address of bounding sphere to reset.
Q3BoundingSphere_Set |
( TQ3BoundingSphere * ) Q3BoundingSphere_Set ( TQ3BoundingSphere *bSphere, const TQ3Point3D *origin, float radius, TQ3Boolean isEmpty );
Set a bounding sphere.
Available in inline form as Q3FastBoundingSphere_Set.
- bSphere
- Address of bounding sphere to set.
- origin
- Address of point indicating sphere origin.
- radius
- Sphere radius.
- isEmpty
- True if the bounding sphere is empty, false otherwise.
Q3BoundingSphere_SetFromPoints3D |
( TQ3BoundingSphere * ) Q3BoundingSphere_SetFromPoints3D ( TQ3BoundingSphere *bSphere, const TQ3Point3D *points3D, TQ3Uns32 numPoints, TQ3Uns32 structSize );
Set a bounding sphere to just enclose a set of 3D points.
- bSphere
- The bounding sphere to update.
- points3D
- Array of 3D points.
- numPoints
- How many points are in the array.
- structSize
- Size of each array element, typically sizeof(TQ3Point3D).
Q3BoundingSphere_SetFromRationalPoints4D |
( TQ3BoundingSphere * ) Q3BoundingSphere_SetFromRationalPoints4D ( TQ3BoundingSphere *bSphere, const TQ3RationalPoint4D *rationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 structSize );
Set a bounding sphere to just enclose a set of 4D rational points.
- bSphere
- Address of bounding sphere to set.
- rationalPoints4D
- Array of 4D rational points.
- numPoints
- How many points are in the array.
- structSize
- Size of each array element, typically sizeof(TQ3RationalPoint4D).
Q3BoundingSphere_Union |
( TQ3BoundingSphere * ) Q3BoundingSphere_Union ( const TQ3BoundingSphere *s1, const TQ3BoundingSphere *s2, TQ3BoundingSphere *result );
Compute the minimum bounding sphere that encloses both 's1' and 's2'.
- s1
- Address of one bounding sphere.
- s2
- Address of another bounding sphere.
- result
- Address of bounding sphere to set (may be the same as s1 and/or s2).
Q3BoundingSphere_UnionPoint3D |
( TQ3BoundingSphere * ) Q3BoundingSphere_UnionPoint3D ( const TQ3BoundingSphere *bSphere, const TQ3Point3D *point3D, TQ3BoundingSphere *result );
Return the minimum bounding sphere that encloses both 'bSphere' and 'point3D'.
- bSphere
- Address of initial bounding sphere.
- point3D
- Address of a point to enclose.
- result
- Address of bounding sphere to set (may be the same as bSphere).
Q3BoundingSphere_UnionRationalPoint4D |
( TQ3BoundingSphere * ) Q3BoundingSphere_UnionRationalPoint4D ( const TQ3BoundingSphere *bSphere, const TQ3RationalPoint4D *rationalPoint4D, TQ3BoundingSphere *result );
Return the minimum bounding sphere that encloses both 'bSphere' and 'rationalPoint4D'.
- bSphere
- Address of initial bounding sphere.
- rationalPoint4D
- Address of a point to enclose.
- result
- Address of bounding sphere to set (may be the same as bSphere).
Q3Math_InvSquareRoot |
( float ) Q3Math_InvSquareRoot ( float x );
Obtain a fast, but possibly inaccurate, inverse square root.
The available precision depends on the current architecture, but will
suffice for most non-accumulating 3D operations. If a reliable degree
of precision is required, 1.0/sqrt() should be used instead.
- x
- The number whose inverse square root should be returned.
Q3Math_SquareRoot |
( float ) Q3Math_SquareRoot ( float x );
Obtain a fast, but possibly inaccurate, square root.
The available precision depends on the current architecture, but will
suffice for most non-accumulating 3D operations. If a reliable degree
of precision is required, sqrt() should be used instead.
- x
- The number whose square root should be returned.
Q3Matrix3x3_Adjoint |
( TQ3Matrix3x3 * ) Q3Matrix3x3_Adjoint ( const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result );
Calculate adjoint of 3x3 matrix.
The adjoint of a matrix is a scalar multiple of the inverse of
the matrix. For some applications, the adjoint can be used in
place of the inverse. In particular:
adjoint(A) = determinant(A) * inverse(A)
- matrix3x3
- Address of a matrix to calculate the adjoint of.
- result
- Address of matrix to set (may be the same as matrix3x3).
Q3Matrix3x3_Copy |
( TQ3Matrix3x3 * ) Q3Matrix3x3_Copy ( const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result );
Copy a 3x3 matrix.
- matrix3x3
- Address of source matrix.
- result
- Address of destination matrix (may be the same as matrix3x3).
Q3Matrix3x3_Determinant |
( float ) Q3Matrix3x3_Determinant ( const TQ3Matrix3x3 *matrix3x3 );
Return the determinant of 3x3 matrix.
- matrix3x3
- Address of a matrix.
Q3Matrix3x3_Invert |
( TQ3Matrix3x3 * ) Q3Matrix3x3_Invert ( const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result );
Calculate the inverse of a 3x3 non-singular matrix.
- matrix3x3
- Address of non-singular matrix to invert.
- result
- Address of matrix to set (may be the same as matrix3x3).
Q3Matrix3x3_Multiply |
( TQ3Matrix3x3 * ) Q3Matrix3x3_Multiply ( const TQ3Matrix3x3 *m1, const TQ3Matrix3x3 *m2, TQ3Matrix3x3 *result );
Multiply two 3x3 matrices.
- m1
- Address of first matrix.
- m2
- Address of second matrix.
- result
- Address of matrix to set with m1*m2 (may be the same as m1 and/or m2).
Q3Matrix3x3_SetIdentity |
( TQ3Matrix3x3 * ) Q3Matrix3x3_SetIdentity ( TQ3Matrix3x3 *matrix3x3 );
Set a 3x3 matrix to the identity matrix.
- matrix3x3
- Address of matrix to set.
Q3Matrix3x3_SetRotate |
( TQ3Matrix3x3 * ) Q3Matrix3x3_SetRotate ( TQ3Matrix3x3 *matrix3x3, float angle );
Set a 3x3 matrix to rotate about the origin.
- matrix3x3
- Address of matrix to set.
- angle
- Angle to rotate (in radians).
Q3Matrix3x3_SetRotateAboutPoint |
( TQ3Matrix3x3 * ) Q3Matrix3x3_SetRotateAboutPoint ( TQ3Matrix3x3 *matrix3x3, const TQ3Point2D *origin, float angle );
Set a 3x3 matrix to rotate about a point.
This is equivalent to translating the point to the origin,
doing a rotation about the origin, and translating back.
- matrix3x3
- Address of matrix to set.
- origin
- Address of a 2D point about which to rotate.
- angle
- Angle to rotate (in radians).
Q3Matrix3x3_SetScale |
( TQ3Matrix3x3 * ) Q3Matrix3x3_SetScale ( TQ3Matrix3x3 *matrix3x3, float xScale, float yScale );
Set 3x3 matrix to scale in x, y.
- matrix3x3
- Address of matrix to set.
- xScale
- Amount to scale in x.
- yScale
- Amount to scale in y.
Q3Matrix3x3_SetTranslate |
( TQ3Matrix3x3 * ) Q3Matrix3x3_SetTranslate ( TQ3Matrix3x3 *matrix3x3, float xTrans, float yTrans );
Set a 3x3 matrix to translate in x, y.
- matrix3x3
- Address of matrix to set.
- xTrans
- Amount to translate in x.
- yTrans
- Amount to translate in y.
Q3Matrix3x3_Transpose |
( TQ3Matrix3x3 * ) Q3Matrix3x3_Transpose ( const TQ3Matrix3x3 *matrix3x3, TQ3Matrix3x3 *result );
Transpose a 3x3 matrix.
- matrix3x3
- Address of a matrix to transpose.
- result
- Address of matrix to set (may be the same as matrix3x3).
Q3Matrix4x4_Copy |
( TQ3Matrix4x4 * ) Q3Matrix4x4_Copy ( const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result );
Copy a 4x4 matrix.
- matrix4x4
- Address of source matrix.
- result
- Address of destination matrix (may be the same as matrix4x4).
Q3Matrix4x4_Determinant |
( float ) Q3Matrix4x4_Determinant ( const TQ3Matrix4x4 *matrix4x4 );
Return the determinant of 4x4 matrix.
- matrix4x4
- Address of a matrix.
Q3Matrix4x4_Invert |
( TQ3Matrix4x4 * ) Q3Matrix4x4_Invert ( const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result );
Calculate the inverse of a 4x4 non-singular matrix.
- matrix4x4
- Address of non-singular matrix to invert.
- result
- Address of matrix to set (may be the same as matrix4x4).
Q3Matrix4x4_Multiply |
( TQ3Matrix4x4 * ) Q3Matrix4x4_Multiply ( const TQ3Matrix4x4 *m1, const TQ3Matrix4x4 *m2, TQ3Matrix4x4 *result );
Multiply two 4x4 matrices.
- m1
- Address of first matrix.
- m2
- Address of second matrix.
- result
- Address of matrix to set with m1*m2 (may be the same as m1 and/or m2).
Q3Matrix4x4_SetIdentity |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetIdentity ( TQ3Matrix4x4 *matrix4x4 );
Set a 4x4 matrix to the identity matrix.
- matrix4x4
- Address of matrix to set.
Q3Matrix4x4_SetQuaternion |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetQuaternion ( TQ3Matrix4x4 *matrix4x4, const TQ3Quaternion *quaternion );
Set a 4x4 matrix from to the rotation represented by a quaternion.
- matrix4x4
- Address of matrix to set.
- quaternion
- Address of the quaternion to imitate.
Q3Matrix4x4_SetRotateAboutAxis |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotateAboutAxis ( TQ3Matrix4x4 *matrix4x4, const TQ3Point3D *origin, const TQ3Vector3D *axis, float angle );
Set 4x4 matrix to rotate about an arbitrary origin and axis.
Note that for correct results, the axis should be normalized
(i.e. have length = 1).
- matrix4x4
- Address of matrix to set.
- origin
- Address of a 2D point about which to rotate.
- axis
- Address of a 3D vector to use as the rotation axis.
- angle
- Angle to rotate (in radians).
Q3Matrix4x4_SetRotateAboutPoint |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotateAboutPoint ( TQ3Matrix4x4 *matrix4x4, const TQ3Point3D *origin, float xAngle, float yAngle, float zAngle );
Set a 4x4 matrix to rotate about axes through a point and
parallel to the X, Y, and Z axes (in that order).
This order of rotations is rarely useful, but it's kept for backwards
compatibility with QD3D.
- matrix4x4
- Address of matrix to set.
- origin
- Address of a 3D point about which to rotate.
- xAngle
- Angle to rotate about the translated X axis (in radians).
- yAngle
- Angle to rotate about the translated Y axis (in radians).
- zAngle
- Angle to rotate about the translated Z axis (in radians).
Q3Matrix4x4_SetRotateVectorToVector |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotateVectorToVector ( TQ3Matrix4x4 *matrix4x4, const TQ3Vector3D *v1, const TQ3Vector3D *v2 );
Set a 4x4 matrix to rotate vector 'v1' to 'v2'.
Note that for correct results, both vectors should be normalized
(i.e. have length = 1).
- matrix4x4
- Address of matrix to set.
- v1
- Address of "starting" vector.
- v2
- Address of "ending" vector.
Q3Matrix4x4_SetRotate_X |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotate_X ( TQ3Matrix4x4 *matrix4x4, float angle );
Set a 4x4 matrix to rotate about the X axis.
- matrix4x4
- Address of matrix to set.
- angle
- Angle to rotate (in radians).
Q3Matrix4x4_SetRotate_XYZ |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotate_XYZ ( TQ3Matrix4x4 *matrix4x4, float xAngle, float yAngle, float zAngle );
Set a 4x4 matrix to rotate about the X, Y, Z axes (in that order).
This order of rotations is rarely useful, but it's kept for backwards
compatibility with QD3D.
- matrix4x4
- Address of matrix to set.
- xAngle
- Angle to rotate about the X axis (in radians).
- yAngle
- Angle to rotate about the Y axis (in radians).
- zAngle
- Angle to rotate about the Z axis (in radians).
Q3Matrix4x4_SetRotate_Y |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotate_Y ( TQ3Matrix4x4 *matrix4x4, float angle );
Set a 4x4 matrix to rotate about the Y axis.
- matrix4x4
- Address of matrix to set.
- angle
- Angle to rotate (in radians).
Q3Matrix4x4_SetRotate_Z |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetRotate_Z ( TQ3Matrix4x4 *matrix4x4, float angle );
Set a 4x4 matrix to rotate about the Z axis.
- matrix4x4
- Address of matrix to set.
- angle
- Angle to rotate (in radians).
Q3Matrix4x4_SetScale |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetScale ( TQ3Matrix4x4 *matrix4x4, float xScale, float yScale, float zScale );
Set a 4x4 matrix to scale in x, y, z.
- matrix4x4
- Address of matrix to set.
- xScale
- Amount to scale in x.
- yScale
- Amount to scale in y.
- zScale
- Amount to scale in z.
Q3Matrix4x4_SetTranslate |
( TQ3Matrix4x4 * ) Q3Matrix4x4_SetTranslate ( TQ3Matrix4x4 *matrix4x4, float xTrans, float yTrans, float zTrans );
Set a 4x4 matrix to translate in x, y, z.
- matrix4x4
- Address of matrix to set.
- xTrans
- Amount to translate in x.
- yTrans
- Amount to translate in y.
- zTrans
- Amount to translate in z.
Q3Matrix4x4_Transpose |
( TQ3Matrix4x4 * ) Q3Matrix4x4_Transpose ( const TQ3Matrix4x4 *matrix4x4, TQ3Matrix4x4 *result );
Transpose a 4x4 matrix.
- matrix4x4
- Address of a matrix to transpose.
- result
- Address of matrix to set (may be the same as matrix4x4).
Q3Param2D_AffineComb |
( TQ3Param2D * ) Q3Param2D_AffineComb ( const TQ3Param2D *params2D, const float *weights, TQ3Uns32 numPoints, TQ3Param2D *result );
Return weighted combination of several 2D parameter points.
Provide an array of points and a parallel array of weights, and
this function will compute the weighted combination.
Although the mathematical definition of an affine combination requires
that the weights sum to 1, this function does not. It divides by the
sum of the weights, so it only requires that the sum is nonzero.
If you have only two points, use Q3Param2D_RRatio instead.
- params2D
- Array of 2D parameter points.
- weights
- Array of weights.
- numPoints
- How many elements there are in each array.
- result
- Address of point to set with the weighted combination.
Q3Param2D_Distance |
( float ) Q3Param2D_Distance ( const TQ3Param2D *p1, const TQ3Param2D *p2 );
Return Euclidean distance between two UV parameter points.
Available in inline form as Q3FastParam2D_Distance.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Param2D_DistanceSquared |
( float ) Q3Param2D_DistanceSquared ( const TQ3Param2D *p1, const TQ3Param2D *p2 );
Return the squared Euclidean distance between two UV parameter points.
Available in inline form as Q3FastParam2D_DistanceSquared.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Param2D_RRatio |
( TQ3Param2D * ) Q3Param2D_RRatio ( const TQ3Param2D *p1, const TQ3Param2D *p2, float r1, float r2, TQ3Param2D *result );
Return the point at ratio r2/(r1+r2) along the line segment is
parameter (UV) space from p1 to p2.
Put another way, this function gives you the weighted average of points
p1 and p2, with the weights given by r1 and r2. (Note that r1+r2 must
be nonzero.)
Available in inline form as Q3FastParam2D_RRatio.
- p1
- Address of one end of a line segment.
- p2
- Address of the other end of a line segment.
- r1
- Weight given to point p1.
- r2
- Weight given to point p2.
- result
- Address of point to set (may be the same as p1 and/or p2).
Q3Param2D_Set |
( TQ3Param2D * ) Q3Param2D_Set ( TQ3Param2D *param2D, float u, float v );
Set a 2D parameterization value (i.e., a UV coordinate).
Available in inline form as Q3FastParam2D_Set.
- param2D
- Address of param2D to set (may be NULL).
- u
- U coordinate to set into param2D.
- v
- V coordinate to set into param2D.
Q3Param2D_Subtract |
( TQ3Vector2D * ) Q3Param2D_Subtract ( const TQ3Param2D *p1, const TQ3Param2D *p2, TQ3Vector2D *result );
Subtract 2D parametric point p2 from p1.
Available in inline form as Q3FastParam2D_Subtract.
- p1
- Address of a point.
- p2
- Address of point to subtract.
- result
- Address of a vector to set with (p1-p2).
Q3Param2D_Transform |
( TQ3Param2D * ) Q3Param2D_Transform ( const TQ3Param2D *param2D, const TQ3Matrix3x3 *matrix3x3, TQ3Param2D *result );
Transform a 2D parametric point by a 3x3 matrix.
- point2D
- Address of a point to transform.
- matrix3x3
- Address of a 3x3 transformation matrix.
- result
- Address of point to set (may be the same as point2D).
Q3Param2D_Vector2D_Add |
( TQ3Param2D * ) Q3Param2D_Vector2D_Add ( const TQ3Param2D *param2D, const TQ3Vector2D *vector2D, TQ3Param2D *result );
Add a 2D vector to a parametric (UV) point.
Available in inline form as Q3FastParam2D_Vector2D_Add.
- param2D
- Address of a 2D parametric point.
- vector2D
- Address of a vector to add.
- result
- Address of point to set (may be the same as param2D).
Q3Param2D_Vector2D_Subtract |
( TQ3Param2D * ) Q3Param2D_Vector2D_Subtract ( const TQ3Param2D *param2D, const TQ3Vector2D *vector2D, TQ3Param2D *result );
Subtract a 2D vector from a parametric (UV) point.
Available in inline form as Q3FastParam2D_Vector2D_Subtract.
- param2D
- Address of a 2D parametric point.
- vector2D
- Address of a vector to subtract.
- result
- Address of point to set (may be the same as param2D).
Q3Point2D_AffineComb |
( TQ3Point2D * ) Q3Point2D_AffineComb ( const TQ3Point2D *points2D, const float *weights, TQ3Uns32 numPoints, TQ3Point2D *result );
Return weighted combination of several 2D points.
Provide an array of points and a parallel array of weights, and
this function will compute the weighted combination.
Although the mathematical definition of an affine combination requires
that the weights sum to 1, this function does not. It divides by the
sum of the weights, so it only requires that the sum is nonzero.
If you have only two points, use Q3Point2D_RRatio instead.
- points2D
- Array of 2D points.
- weights
- Array of weights.
- numPoints
- How many elements there are in each array.
- result
- Address of point to set with the weighted combination.
Q3Point2D_CrossProductTri |
( float ) Q3Point2D_CrossProductTri ( const TQ3Point2D *p1, const TQ3Point2D *p2, const TQ3Point2D *p3 );
Return the length of the cross product of a triangle specified by
three 2D points, that is, of the vectors p2-p1 and p3-p2.
Available in inline form as Q3FastPoint2D_CrossProductTri.
- p1
- Address of one point in the triangle.
- p2
- Address of a second point in the triangle.
- p3
- Address of a third point in the triangle.
Q3Point2D_Distance |
( float ) Q3Point2D_Distance ( const TQ3Point2D *p1, const TQ3Point2D *p2 );
Return Euclidean distance between two 2D points.
Available in inline form as Q3FastPoint2D_Distance.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Point2D_DistanceSquared |
( float ) Q3Point2D_DistanceSquared ( const TQ3Point2D *p1, const TQ3Point2D *p2 );
Return the squared Euclidean distance between two 2D points.
Available in inline form as Q3FastPoint2D_DistanceSquared.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Point2D_RRatio |
( TQ3Point2D * ) Q3Point2D_RRatio ( const TQ3Point2D *p1, const TQ3Point2D *p2, float r1, float r2, TQ3Point2D *result );
Return the point at ratio r2/(r1+r2) along the line segment from p1 to p2.
Put another way, this function gives you the weighted average of points
p1 and p2, with the weights given by r1 and r2. (Note that r1+r2 must
be nonzero.)
NOTE: The QD3D docs claim that the ratio used is r1/(r1+r2), but
it was found by direct experimentation that the QD3D library (1.6)
in fact uses r2/(r1+r2) instead. This is as it should be, if r1 is
the weight of p1, and r2 is the weight of p2.
As usual, we do as QD3D does, not as the docs say.
Available in inline form as Q3FastPoint2D_RRatio.
- p1
- Address of one end of a line segment.
- p2
- Address of the other end of a line segment.
- r1
- Weight given to point p1.
- r2
- Weight given to point p2.
- result
- Address of point to set (may be the same as p1 and/or p2).
Q3Point2D_Set |
( TQ3Point2D * ) Q3Point2D_Set ( TQ3Point2D *point2D, float x, float y );
Set a 2D point.
Available in inline form as Q3FastPoint2D_Set.
- point2D
- Address of point to set (may be NULL).
- x
- X coordinate to set into vector2D.
- y
- Y coordinate to set into vector2D.
Q3Point2D_Subtract |
( TQ3Vector2D * ) Q3Point2D_Subtract ( const TQ3Point2D *p1, const TQ3Point2D *p2, TQ3Vector2D *result );
Subtract the 2D point p2 from p1.
Available in inline form as Q3FastPoint2D_Subtract.
- p1
- Address of a point.
- p2
- Address of point to subtract.
- result
- Address of a vector to set with (p1-p2).
Q3Point2D_To2DTransformArray |
( TQ3Status ) Q3Point2D_To2DTransformArray ( const TQ3Point2D *inPoints2D, const TQ3Matrix3x3 *matrix3x3, TQ3Point2D *outPoints2D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 2D points by a 3x3 matrix.
When you have many points to transform, this is a more efficient
alternative to calling Q3Point2D_Transform repeatedly.
- inPoints2D
- Array of 2D points to transform.
- matrix3x3
- Transformation matrix.
- outPoints2D
- Array of points to receive output (may be the same as inPoints2D).
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Point2D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3Point2D).
Q3Point2D_To3D |
( TQ3RationalPoint3D * ) Q3Point2D_To3D ( const TQ3Point2D *point2D, TQ3RationalPoint3D *result );
Convert 2D point to rational 3D, setting w to 1.
The Apple version incorrectly declares the type of 'result' to
be TQ3Point3D rather than TQ3RationalPoint3D. At a binary level
there is no difference, but at the source code level the Apple
version forces the use of the incorrect type or type casting.
Available in inline form as Q3FastPoint2D_To3D.
- point2D
- Address of 2D point to convert.
- result
- Address of 3D rational point to set.
Q3Point2D_To3DTransformArray |
( TQ3Status ) Q3Point2D_To3DTransformArray ( const TQ3Point2D *inPoints2D, const TQ3Matrix3x3 *matrix3x3, TQ3RationalPoint3D *outRationalPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 2D points by a 3x3 matrix into 3D rational points.
When you have many vectors to transform, this is a more efficient
alternative to calling Q3Point2D_To3D and Q3RationalPoint3D_Transform repeatedly.
- inPoints2D
- Array of 2D points to transform.
- matrix3x3
- Transformation matrix.
- outRationalPoints3D
- Array of points to receive output.
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Point2D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3RationalPoint3D).
Q3Point2D_ToPolar |
( TQ3PolarPoint * ) Q3Point2D_ToPolar ( const TQ3Point2D *point2D, TQ3PolarPoint *result );
Convert 2D cartesian point to polar coordinates.
The angle (theta) here is measured counter-clockwise from the +x axis.
- point2D
- Address of 2D point to convert.
- result
- Address of polar point to set.
Q3Point2D_Transform |
( TQ3Point2D * ) Q3Point2D_Transform ( const TQ3Point2D *point2D, const TQ3Matrix3x3 *matrix3x3, TQ3Point2D *result );
Transform a 2D point by a 3x3 matrix.
- point2D
- Address of a point to transform.
- matrix3x3
- Address of a 3x3 transformation matrix.
- result
- Address of point to set (may be the same as point2D).
Q3Point2D_Vector2D_Add |
( TQ3Point2D * ) Q3Point2D_Vector2D_Add ( const TQ3Point2D *point2D, const TQ3Vector2D *vector2D, TQ3Point2D *result );
Add a 2D vector to a point.
Available in inline form as Q3FastPoint2D_Vector2D_Add.
- point2D
- Address of a point.
- vector2D
- Address of a vector to add.
- result
- Address of point to set (may be the same as point2D).
Q3Point2D_Vector2D_Subtract |
( TQ3Point2D * ) Q3Point2D_Vector2D_Subtract ( const TQ3Point2D *point2D, const TQ3Vector2D *vector2D, TQ3Point2D *result );
Subtract a 2D vector from a point.
Available in inline form as Q3FastPoint2D_Vector2D_Subtract.
- point2D
- Address of a point.
- vector2D
- Address of a vector to subtract.
- result
- Address of point to set (may be the same as point2D).
Q3Point3D_AffineComb |
( TQ3Point3D * ) Q3Point3D_AffineComb ( const TQ3Point3D *points3D, const float *weights, TQ3Uns32 numPoints, TQ3Point3D *result );
Return weighted combination of several 3D points.
Provide an array of points and a parallel array of weights, and
this function will compute the weighted combination.
Although the mathematical definition of an affine combination requires
that the weights sum to 1, this function does not. It divides by the
sum of the weights, so it only requires that the sum is nonzero.
If you have only two points, use Q3Point3D_RRatio instead.
- points3D
- Array of 3D points.
- weights
- Array of weights.
- numPoints
- How many elements there are in each array.
- result
- Address of point to set with the weighted combination.
Q3Point3D_CrossProductTri |
( TQ3Vector3D * ) Q3Point3D_CrossProductTri ( const TQ3Point3D *p1, const TQ3Point3D *p2, const TQ3Point3D *p3, TQ3Vector3D *result );
Return the cross product of triangle triangle defined by three
3D points, that is, of the vectors p2-p1 and p3-p2.
Available in inline form as Q3FastPoint3D_CrossProductTri.
- p1
- Address of one point in the triangle.
- p2
- Address of a second point in the triangle.
- p3
- Address of a third point in the triangle.
- result
- Address of vector to set with cross product (p2-p1) x (p3-p2).
Q3Point3D_Distance |
( float ) Q3Point3D_Distance ( const TQ3Point3D *p1, const TQ3Point3D *p2 );
Return Euclidean distance between two 3D points.
Available in inline form as Q3FastPoint3D_Distance.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Point3D_DistanceSquared |
( float ) Q3Point3D_DistanceSquared ( const TQ3Point3D *p1, const TQ3Point3D *p2 );
Return the squared Euclidean distance between two 3D points.
Available in inline form as Q3FastPoint3D_DistanceSquared.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3Point3D_RRatio |
( TQ3Point3D * ) Q3Point3D_RRatio ( const TQ3Point3D *p1, const TQ3Point3D *p2, float r1, float r2, TQ3Point3D *result );
Return the point at ratio r2/(r1+r2) along the line segment from p1 to p2.
Put another way, this function gives you the weighted average of points
p1 and p2, with the weights given by r1 and r2. (Note that r1+r2 must
be nonzero.)
NOTE: The QD3D docs claim that the ratio used is r1/(r1+r2), but
it was found by direct experimentation that the QD3D library (1.6)
in fact uses r2/(r1+r2) instead. This is as it should be, if r1 is
the weight of p1, and r2 is the weight of p2.
As usual, we do as QD3D does, not as the docs say.
Available in inline form as Q3FastPoint3D_RRatio.
- p1
- Address of one end of a line segment.
- p2
- Address of the other end of a line segment.
- r1
- Weight given to point p1.
- r2
- Weight given to point p2.
- result
- Address of point to set (may be the same as p1 and/or p2).
Q3Point3D_Set |
( TQ3Point3D * ) Q3Point3D_Set ( TQ3Point3D *point3D, float x, float y, float z );
Set a 3D point.
Available in inline form as Q3FastPoint3D_Set.
- point3D
- Address of point to set (may be NULL).
- x
- X coordinate to set into point3D.
- y
- Y coordinate to set into point3D.
- z
- Z coordinate to set into point3D.
Q3Point3D_Subtract |
( TQ3Vector3D * ) Q3Point3D_Subtract ( const TQ3Point3D *p1, const TQ3Point3D *p2, TQ3Vector3D *result );
Subtract 3D point p2 from p1.
Available in inline form as Q3FastPoint3D_Subtract.
- p1
- Address of a point.
- p2
- Address of a point to subtract.
- result
- Address of point to set (may be the same as p1 and/or p2).
Q3Point3D_To3DTransformArray |
( TQ3Status ) Q3Point3D_To3DTransformArray ( const TQ3Point3D *inPoints3D, const TQ3Matrix4x4 *matrix4x4, TQ3Point3D *outPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 3D points by a 4x4 matrix.
When you have many points to transform, this is a more efficient
alternative to calling Q3Point3D_Transform repeatedly.
- inPoints3D
- Array of 3D points to transform.
- matrix4x4
- Transformation matrix.
- outPoints3D
- Array of points to receive output (may be the same as inPoints3D).
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Point3D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3Point3D).
Q3Point3D_To4D |
( TQ3RationalPoint4D * ) Q3Point3D_To4D ( const TQ3Point3D *point3D, TQ3RationalPoint4D *result );
Convert 3D point to rational 4D, setting w to 1.
Available in inline form as Q3FastPoint3D_To4D.
- point3D
- Address of 3D point to convert.
- result
- Address of rational 4D point to set.
Q3Point3D_To4DTransformArray |
( TQ3Status ) Q3Point3D_To4DTransformArray ( const TQ3Point3D *inPoints3D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *outRationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 3D points by a 4x4 matrix into 4D rational points.
When you have many vectors to transform, this is a more efficient
alternative to calling Q3Point3D_To4D and Q3RationalPoint4D_Transform repeatedly.
- inPoints3D
- Array of 3D points to transform.
- matrix4x4
- Transformation matrix.
- outRationalPoints4D
- Array of points to receive output.
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Point3D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3RationalPoint4D).
Q3Point3D_ToSpherical |
( TQ3SphericalPoint * ) Q3Point3D_ToSpherical ( const TQ3Point3D *point3D, TQ3SphericalPoint *result );
Convert 3D cartesian point to spherical coordinates.
- point3D
- Address of 3D cartesian point to convert.
- result
- Address of spherical-coordinates point to set.
Q3Point3D_Transform |
( TQ3Point3D * ) Q3Point3D_Transform ( const TQ3Point3D *point3D, const TQ3Matrix4x4 *matrix4x4, TQ3Point3D *result );
Transform a 3D point by a 4x4 matrix.
- point3D
- Address of a point to transform.
- matrix4x4
- Address of a 4x4 transformation matrix.
- result
- Address of point to set (may be the same as point3D).
Q3Point3D_TransformQuaternion |
( TQ3Point3D * ) Q3Point3D_TransformQuaternion ( const TQ3Point3D *point3D, const TQ3Quaternion *quaternion, TQ3Point3D *result );
Transform a 3D point by a quaternion.
Note that for correct results, the quaternion should be normalized.
- point3D
- Address of a point to transform.
- quaternion
- Address of a quaternion to transform by.
- result
- Address of a point to set (may be the same as point3D).
Q3Point3D_Vector3D_Add |
( TQ3Point3D * ) Q3Point3D_Vector3D_Add ( const TQ3Point3D *point3D, const TQ3Vector3D *vector3D, TQ3Point3D *result );
Add a 3D vector to a point.
Available in inline form as Q3FastPoint3D_Vector3D_Add.
- point3D
- Address of a point.
- vector3D
- Address of a vector to add.
- result
- Address of point to set (may be the same as point3D).
Q3Point3D_Vector3D_Subtract |
( TQ3Point3D * ) Q3Point3D_Vector3D_Subtract ( const TQ3Point3D *point3D, const TQ3Vector3D *vector3D, TQ3Point3D *result );
Subtract 3D vector from point.
Available in inline form as Q3FastPoint3D_Vector3D_Subtract.
- point3D
- Address of a point.
- vector3D
- Address of a vector to subtract.
- result
- Address of point to set (may be the same as point3D).
Q3PolarPoint_Set |
( TQ3PolarPoint * ) Q3PolarPoint_Set ( TQ3PolarPoint *polarPoint, float r, float theta );
Set a 2D polar-coordinates point.
Available in inline form as Q3FastPolarPoint_Set.
- polarPoint
- Address of point to set (may be NULL).
- r
- Radius coordinate to set into polarPoint.
- theta
- Angle coordinate (in radians) to set into polarPoint.
Q3PolarPoint_ToPoint2D |
( TQ3Point2D * ) Q3PolarPoint_ToPoint2D ( const TQ3PolarPoint *polarPoint, TQ3Point2D *result );
Convert 2D polar point to cartesian coordinates.
The angle (theta) here is measured counter-clockwise from the +x axis.
Available in inline form as Q3FastPolarPoint_ToPoint2D.
- polarPoint
- Address of polar point to convert.
- result
- Address of 2D cartesian point to set.
Q3Quaternion_Copy |
( TQ3Quaternion * ) Q3Quaternion_Copy ( const TQ3Quaternion *quaternion, TQ3Quaternion *result );
Copy a quaternion.
Available in inline form as Q3FastQuaternion_Copy.
- quaternion
- Address of source quaternion.
- result
- Address of destination quaternion (may be the same as the first parameter).
Q3Quaternion_Dot |
( float ) Q3Quaternion_Dot ( const TQ3Quaternion *q1, const TQ3Quaternion *q2 );
Return the dot product of q1 and q2.
Available in inline form as Q3FastQuaternion_Dot.
- q1
- Address of one quaternion.
- q2
- Address of another quaternion (may be the same as q1).
Q3Quaternion_GetAxisAndAngle |
( TQ3Vector3D * ) Q3Quaternion_GetAxisAndAngle ( const TQ3Quaternion *quaternion, TQ3Vector3D *outAxis, float *outAngle );
Get the rotation axis and/or angle represented by a quaternion.
Note that for correct results, the quaternion should be normalized.
If the quaternion represents a null rotation, then outAngle will be
set to 0.0 and outAxis will be set to <0, 1, 0> (since in this case
the rotation axis is undefined, but we want to always give you a
valid axis).
The returned angle in radians will be in the range [0, 2*pi].
Either outAxis or outAngle may be null if you are not interested in
that result. (You could even pass null for both, but that would be
rather pointless.)
- quaternion
- Address of a quaternion to inspect.
- outAxis
- Address of a vector to set to the rotation axis (may be null).
- outAngle
- Address of a float to set to the rotation angle (may be null).
Q3Quaternion_InterpolateFast |
( TQ3Quaternion * ) Q3Quaternion_InterpolateFast ( const TQ3Quaternion *q1, const TQ3Quaternion *q2, float t, TQ3Quaternion *result );
Compute a straight linear interpolation between two quaternions.
This does a true linear, not spherical, interpolation between
q1 and q2. It's fast, but not very proper for most uses.
The result is automatically normalized, so there is no need to
do so yourself.
- q1
- Address of first quaternion.
- q2
- Address of second quaternion.
- t
- Fraction (0-1) of the way from q1 to q2.
- result
- Address of quaternion to set (may be the same as q1 and/or q2).
Q3Quaternion_InterpolateLinear |
( TQ3Quaternion * ) Q3Quaternion_InterpolateLinear ( const TQ3Quaternion *q1, const TQ3Quaternion *q2, float t, TQ3Quaternion *result );
Compute a spherical linear interpolation between two quaternions.
Despite the name, this function does a SLERP (spherical linear
interpolation) from q1 to q2.
It falls back on a straight linear interpolation only when the
cosine of the angle between them is less than 0.01.
The cut-off point was chosen arbitrarily, and may not match
that of QD3D.
- q1
- Address of first quaternion.
- q2
- Address of second quaternion.
- t
- Fraction (0-1) of the way from q1 to q2.
- result
- Address of quaternion to set (may be the same as q1 and/or q2).
Q3Quaternion_Invert |
( TQ3Quaternion * ) Q3Quaternion_Invert ( const TQ3Quaternion *quaternion, TQ3Quaternion *result );
Invert a quaternion.
For correct results, the quaternion should be normalized
before inverting.
Available in inline form as Q3FastQuaternion_Invert.
- quaternion
- Address of a quaternion to invert.
- result
- Address of quaternion to set (may be the same as the first parameter).
Q3Quaternion_IsIdentity |
( TQ3Boolean ) Q3Quaternion_IsIdentity ( const TQ3Quaternion *quaternion );
Return whether a quaternion is (roughly) the identity,
i.e., (1,0,0,0).
Values for x, y, and z are considered close enough to 0
if they are within FLT_EPSILON (a small number).
For correct results, the quaternion should first be normalized.
- quaternion
- Address of quaternion to test.
Q3Quaternion_MatchReflection |
( TQ3Quaternion * ) Q3Quaternion_MatchReflection ( const TQ3Quaternion *q1, const TQ3Quaternion *q2, TQ3Quaternion *result );
Set result to either q1 or -q1, whichever produces a positive dot
product with q2 (i.e., whichever is "closer" to q2 in orientation).
- q1
- Address of source quaternion.
- q2
- Address of quaternion to match.
- result
- Address of quaternion to set (may be the same as q1 and/or q2).
Q3Quaternion_Multiply |
( TQ3Quaternion * ) Q3Quaternion_Multiply ( const TQ3Quaternion *q1, const TQ3Quaternion *q2, TQ3Quaternion *result );
Compute the product of two quaternions.
This is a very useful operation, since the rotation represented
by q1*q2 is exactly the same as rotating by q1 and then by q2.
- q1
- Address of first quaternion.
- q2
- Address of second quaternion.
- result
- Address of quaternion to set (may be the same as q1 and/or q2).
Q3Quaternion_Normalize |
( TQ3Quaternion * ) Q3Quaternion_Normalize ( const TQ3Quaternion *quaternion, TQ3Quaternion *result );
Scale a quaternion to length 1.
This is often needed when combining or interpolating between
quaternions, to keep accumulated error from causing your
quaternion values to "blow up".
Available in inline form as Q3FastQuaternion_Normalize.
- quaternion
- Address of a quaternion to normalize.
- result
- Address of quaternion to set (may be the same as the first parameter).
Q3Quaternion_Set |
( TQ3Quaternion * ) Q3Quaternion_Set ( TQ3Quaternion *quaternion, float w, float x, float y, float z );
Set a quaternion with its individual w, x, y, and z components.
Available in inline form as Q3FastQuaternion_Set.
- quaternion
- Address of a quaternion to set.
- w
- Value for w component.
- x
- Value for x component.
- y
- Value for y component.
- z
- Value for z component.
Q3Quaternion_SetIdentity |
( TQ3Quaternion * ) Q3Quaternion_SetIdentity ( TQ3Quaternion *quaternion );
Set a quaternion to the identity value (1,0,0,0).
Available in inline form as Q3FastQuaternion_SetIdentity.
- quaternion
- Address of a quaternion to set.
Q3Quaternion_SetMatrix |
( TQ3Quaternion * ) Q3Quaternion_SetMatrix ( TQ3Quaternion *quaternion, const TQ3Matrix4x4 *matrix4x4 );
Set a quaternion from a 4x4 rotation matrix.
Note: The QD3D implementation of this function appears to be buggy.
This can be demonstrated by starting with an arbitrary
quaternion, converting to a matrix, then converting back (with
this function).
QD3D's result is something ridiculous; in Quesa, this function
returns the original quaternion (or something equivalent).
- quaternion
- Address of a quaternion to set.
- matrix4x4
- Address of a rotation matrix to imitate.
Q3Quaternion_SetRotateAboutAxis |
( TQ3Quaternion * ) Q3Quaternion_SetRotateAboutAxis ( TQ3Quaternion *quaternion, const TQ3Vector3D *axis, float angle );
Set quaternion to rotate about arbitrary axis.
Note that for correct results, the axis should be normalized
(i.e. have length = 1).
- quaternion
- Address of a quaternion to set.
- axis
- Address of a 3D vector to use as the rotation axis.
- angle
- Angle to rotate (in radians).
Q3Quaternion_SetRotateVectorToVector |
( TQ3Quaternion * ) Q3Quaternion_SetRotateVectorToVector ( TQ3Quaternion *quaternion, const TQ3Vector3D *v1, const TQ3Vector3D *v2 );
Set a quaternion to rotate vector 'v1' to 'v2'.
Note that for correct results, both vectors should be normalized
(i.e. have length = 1).
- quaternion
- Address of a quaternion to set.
- v1
- Address of "starting" vector.
- v2
- Address of "ending" vector.
Q3Quaternion_SetRotate_X |
( TQ3Quaternion * ) Q3Quaternion_SetRotate_X ( TQ3Quaternion *quaternion, float angle );
Set a quaternion to rotate about the X axis.
- quaternion
- Address of a quaternion to set.
- angle
- Angle to rotate (in radians).
Q3Quaternion_SetRotate_XYZ |
( TQ3Quaternion * ) Q3Quaternion_SetRotate_XYZ ( TQ3Quaternion *quaternion, float xAngle, float yAngle, float zAngle );
Set a quaternion to rotate about the X, Y, and Z axes (in that order).
This order of rotations is rarely useful, but it's kept for backwards
compatibility with QD3D.
- quaternion
- Address of a quaternion to set.
- xAngle
- Angle to rotate about the X axis (in radians).
- yAngle
- Angle to rotate about the Y axis (in radians).
- zAngle
- Angle to rotate about the Z axis (in radians).
Q3Quaternion_SetRotate_Y |
( TQ3Quaternion * ) Q3Quaternion_SetRotate_Y ( TQ3Quaternion *quaternion, float angle );
Set a quaternion to rotate about the Y axis.
- quaternion
- Address of a quaternion to set.
- angle
- Angle to rotate (in radians).
Q3Quaternion_SetRotate_Z |
( TQ3Quaternion * ) Q3Quaternion_SetRotate_Z ( TQ3Quaternion *quaternion, float angle );
Set a quaternion to rotate about the Z axis.
- quaternion
- Address of a quaternion to set.
- angle
- Angle to rotate (in radians).
Q3RationalPoint3D_AffineComb |
( TQ3RationalPoint3D * ) Q3RationalPoint3D_AffineComb ( const TQ3RationalPoint3D *rationalPoints3D, const float *weights, TQ3Uns32 numPoints, TQ3RationalPoint3D *result );
Compute the weighted combination of several 3D rational points.
Although the mathematical definition of an affine combination requires
that the weights sum to 1, this function does not. It divides by the
sum of the weights, so it only requires that the sum is nonzero.
- rationalPoints3D
- Array of 3D rational points.
- weights
- Array of weights.
- numPoints
- How many elements there are in each array.
- result
- Address of point to set with the weighted combination.
Q3RationalPoint3D_Distance |
( float ) Q3RationalPoint3D_Distance ( const TQ3RationalPoint3D *p1, const TQ3RationalPoint3D *p2 );
Returns the Euclidian distance between two rational 3D points.
This operation makes no sense mathematically, but is included
for backwards compatibility with QD3D.
Available in inline form as Q3FastRationalPoint3D_Distance.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3RationalPoint3D_DistanceSquared |
( float ) Q3RationalPoint3D_DistanceSquared ( const TQ3RationalPoint3D *p1, const TQ3RationalPoint3D *p2 );
Returns the squared Euclidian distance between two rational 3D points.
This operation makes no sense mathematically, but is included
for backwards compatibility with QD3D.
Available in inline form as Q3FastRationalPoint3D_DistanceSquared.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3RationalPoint3D_Set |
( TQ3RationalPoint3D * ) Q3RationalPoint3D_Set ( TQ3RationalPoint3D *rationalPoint3D, float x, float y, float w );
Set a 3D rational point (x,y,w).
Available in inline form as Q3FastRationalPoint3D_Set.
- rationalPoint3D
- Address of rational point to set (may be NULL).
- x
- X coordinate to set into rationalPoint3D.
- y
- Y coordinate to set into rationalPoint3D.
- w
- W coordinate to set into rationalPoint3D.
Q3RationalPoint3D_To2D |
( TQ3Point2D * ) Q3RationalPoint3D_To2D ( const TQ3RationalPoint3D *rationalPoint3D, TQ3Point2D *result );
Convert rational 3D point to 2D, dividing by w.
Available in inline form as Q3FastRationalPoint3D_To2D.
- rationalPoint3D
- Address of rational 3D point to convert.
- result
- Address of 2D point to set.
Q3RationalPoint3D_To3DTransformArray |
( TQ3Status ) Q3RationalPoint3D_To3DTransformArray ( const TQ3RationalPoint3D *inRationalPoints3D, const TQ3Matrix3x3 *matrix3x3, TQ3RationalPoint3D *outRationalPoints3D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 3D rational points by a 3x3 matrix.
When you have many points to transform, this is a more efficient
alternative to calling Q3RationalPoint3D_Transform repeatedly.
- inRationalPoints3D
- Array of 3D rational points to transform.
- matrix3x3
- Transformation matrix.
- outRationalPoints3D
- Array of points to receive output (may be the same as inRationalPoints3D).
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3RationalPoint3D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3RationalPoint3D).
Q3RationalPoint3D_ToVector2D |
( TQ3Vector2D * ) Q3RationalPoint3D_ToVector2D ( const TQ3RationalPoint3D *rationalPoint3D, TQ3Vector2D *result );
Convert 3D rational point to 2D vector, discarding w.
Available in inline form as Q3FastRationalPoint3D_ToVector2D.
- rationalPoint3D
- Address of 3D rational point to convert.
- result
- Address of 2D vector to set.
Q3RationalPoint3D_Transform |
( TQ3RationalPoint3D * ) Q3RationalPoint3D_Transform ( const TQ3RationalPoint3D *rationalPoint3D, const TQ3Matrix3x3 *matri3x3, TQ3RationalPoint3D *result );
Transform a 3D rational point by 3x3 matrix.
- rationalPoint3D
- Address of a point to transform.
- matrix3x3
- Address of a 3x3 transformation matrix.
- result
- Address of point to set (may be the same as rationalPoint3D).
Q3RationalPoint4D_AffineComb |
( TQ3RationalPoint4D * ) Q3RationalPoint4D_AffineComb ( const TQ3RationalPoint4D *rationalPoints4D, const float *weights, TQ3Uns32 numPoints, TQ3RationalPoint4D *result );
Compute the weighted combination of several 4D rational points.
Although the mathematical definition of an affine combination requires
that the weights sum to 1, this function does not. It divides by the
sum of the weights, so it only requires that the sum is nonzero.
- rationalPoints4D
- Array of 4D rational points.
- weights
- Array of weights.
- numPoints
- How many elements there are in each array.
- result
- Address of point to set with the weighted combination.
Q3RationalPoint4D_Distance |
( float ) Q3RationalPoint4D_Distance ( const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2 );
Returns the Euclidian distance between two rational 4D points.
This operation makes no sense mathematically, but is included
for backwards compatibility with QD3D.
Available in inline form as Q3FastRationalPoint4D_Distance.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3RationalPoint4D_DistanceSquared |
( float ) Q3RationalPoint4D_DistanceSquared ( const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2 );
Returns the squared Euclidian distance between two rational 4D points.
This operation makes no sense mathematically, but is included
for backwards compatibility with QD3D.
Available in inline form as Q3FastRationalPoint4D_DistanceSquared.
- p1
- Address of first point of interest.
- p2
- Address of second point of interest.
Q3RationalPoint4D_RRatio |
( TQ3RationalPoint4D * ) Q3RationalPoint4D_RRatio ( const TQ3RationalPoint4D *p1, const TQ3RationalPoint4D *p2, float r1, float r2, TQ3RationalPoint4D *result );
Return the point at ratio r2/(r1+r2) along the line segment from p1 to p2.
Put another way, this function gives you the weighted average of points
p1 and p2, with the weights given by r1 and r2. (Note that r1+r2 must
be nonzero.)
NOTE: The QD3D docs claim that the ratio used is r1/(r1+r2), but
it was found by direct experimentation that the QD3D library (1.6)
in fact uses r2/(r1+r2) instead. This is as it should be, if r1 is
the weight of p1, and r2 is the weight of p2.
As usual, we do as QD3D does, not as the docs say.
Available in inline form as Q3FastRationalPoint4D_RRatio.
- p1
- Address of one end of a line segment.
- p2
- Address of the other end of a line segment.
- r1
- Weight given to point p1.
- r2
- Weight given to point p2.
- result
- Address of point to set (may be the same as p1 and/or p2).
Q3RationalPoint4D_Set |
( TQ3RationalPoint4D * ) Q3RationalPoint4D_Set ( TQ3RationalPoint4D *rationalPoint4D, float x, float y, float z, float w );
Set a 4D rational point (x,y,z,w).
Available in inline form as Q3FastRationalPoint4D_Set.
- rationalPoint4D
- Address of rational point to set.
- x
- X coordinate to set into rationalPoint4D.
- y
- Y coordinate to set into rationalPoint4D.
- z
- Z coordinate to set into rationalPoint4D.
Q3RationalPoint4D_To3D |
( TQ3Point3D * ) Q3RationalPoint4D_To3D ( const TQ3RationalPoint4D *rationalPoint4D, TQ3Point3D *result );
Convert rational 4D point to 3D, dividing by w.
Available in inline form as Q3FastRationalPoint4D_To3D.
- rationalPoint4D
- Address of rational 4D point to convert.
- result
- Address of 3D point to set.
Q3RationalPoint4D_To4DTransformArray |
( TQ3Status ) Q3RationalPoint4D_To4DTransformArray ( const TQ3RationalPoint4D *inRationalPoints4D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *outRationalPoints4D, TQ3Uns32 numPoints, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 4D points by a 4x4 matrix.
When you have many points to transform, this is a more efficient
alternative to calling Q3RationalPoint4D_Transform repeatedly.
- inRationalPoints4D
- Array of 4D points to transform.
- matrix4x4
- Transformation matrix.
- outRationalPoints4D
- Array of points to receive output (may be the same as inRationalPoints4D).
- numPoints
- How many points are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3RationalPoint4D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3RationalPoint4D).
Q3RationalPoint4D_ToVector3D |
( TQ3Vector3D * ) Q3RationalPoint4D_ToVector3D ( const TQ3RationalPoint4D *rationalPoint4D, TQ3Vector3D *result );
Convert 4D rational point to 3D vector, discarding w.
Available in inline form as Q3FastRationalPoint4D_ToVector3D.
- rationalPoint4D
- Address of 4D rational point to convert.
- result
- Address of 3D vector to set.
Q3RationalPoint4D_Transform |
( TQ3RationalPoint4D * ) Q3RationalPoint4D_Transform ( const TQ3RationalPoint4D *rationalPoint4D, const TQ3Matrix4x4 *matrix4x4, TQ3RationalPoint4D *result );
Transform a 4D rational point by a 4x4 matrix.
- rationalPoint4D
- Address of a point to transform.
- matrix4x4
- Address of a 4x4 transformation matrix.
- result
- Address of point to set (may be the same as rationalPoint4D).
Q3Ray3D_IntersectBoundingBox |
( TQ3Boolean ) Q3Ray3D_IntersectBoundingBox ( const TQ3Ray3D *theRay, const TQ3BoundingBox *theBounds, TQ3Point3D *hitPoint );
Test a ray for intersection against a bounding box. If an
intersection occurs, the point of intersection is returned.
The direction vector of the ray must be normalised.
- theRay
- The ray to test.
- theBounds
- The bounding box to test against.
- hitPoint
- Receives the intersection point, if found.
Q3Ray3D_IntersectSphere |
( TQ3Boolean ) Q3Ray3D_IntersectSphere ( const TQ3Ray3D *theRay, const TQ3Sphere *theSphere, TQ3Point3D *hitPoint );
Test a ray for intersection against a sphere, and return the point
of intersection if found.
The direction vector of the ray must be normalised.
- theRay
- The ray to test.
- theSphere
- The sphere to test against.
- hitPoint
- Receives the intersection point, if found.
Q3Ray3D_IntersectTriangle |
( TQ3Boolean ) Q3Ray3D_IntersectTriangle ( const TQ3Ray3D *theRay, const TQ3Point3D *point1, const TQ3Point3D *point2, const TQ3Point3D *point3, TQ3Boolean cullBackfacing, TQ3Param3D *hitPoint );
Test a ray for intersection against a triangle formed by three
points. If an intersection occurs, returns the barycentric
coordinates of the point of intersection and the parameter along
the ray.
Triangles may optionally be subject to backface culling, in
which case a hit on the reverse side of the triangle will fail
to result in an intersection.
The u and v members of hitPoint can be used to express the point of
intersection in terms of the vertices of the triangles, using
barycentric coordinates, as follows:
t = (1.0f - hitPoint.u - hitPoint.v); x = (point1.x * t) + (point2.x * hitPoint.u) + (point3.x * hitPoint.v); y = (point1.y * t) + (point2.y * hitPoint.u) + (point3.y * hitPoint.v); z = (point1.z * t) + (point2.z * hitPoint.u) + (point3.z * hitPoint.v);
- theRay
- The ray to test.
- point1
- The first triangle vertex.
- point2
- The second triangle vertex.
- point3
- The third triangle vertex.
- cullBackfacing
- Controls if back-facing triangles should be skipped.
- hitPoint
- Receives the barycentric coordinates of the intersection, and the multiple of the direction vector that reaches the intersection.
Q3SphericalPoint_Set |
( TQ3SphericalPoint * ) Q3SphericalPoint_Set ( TQ3SphericalPoint *sphericalPoint, float rho, float theta, float phi );
Set a 3D spherical-coordinates point.
Available in inline form as Q3FastSphericalPoint_Set.
- sphericalPoint
- Address of point to set (may be NULL).
- rho
- Rho coordinate to set into sphericalPoint.
- theta
- Theta coordinate to set into sphericalPoint.
- phi
- Phi coordinate to set into sphericalPoint.
Q3SphericalPoint_ToPoint3D |
( TQ3Point3D * ) Q3SphericalPoint_ToPoint3D ( const TQ3SphericalPoint *sphericalPoint, TQ3Point3D *result );
Convert 3D spherical point to cartesian coordinates.
- sphericalPoint
- Address of spherical-coordinates point to convert.
- result
- Address of 3D cartesian point to set.
Q3Triangle_CrossProductArray |
( TQ3Status ) Q3Triangle_CrossProductArray ( TQ3Uns32 numTriangles, const TQ3Uns8 *usageFlags, const TQ3Uns32 *theIndices, const TQ3Point3D *thePoints, TQ3Vector3D *theNormals );
Calculate an array of triangle normals.
Triangles are specified as a contiguous array of triangle indices,
and a contiguous array of points. The result is a contiguous array
of triangle normals.
Triangles may be omitted from processing with the usageFlags parameter,
which should point to an array of TQ3Uns8 flags. If usageFlags is not
NULL, only triangles whose corresponding entry in this array is 0 will
be processed.
The returning vectors are normalized.
- numTriangles
- The number of triangles to process.
- usageFlags
- The optional usage flags, indicating the triangles to process.
- theIndices
- The triangle indices.
- thePoints
- The triangle points.
- theNormals
- Receives the triangle normals.
Q3Vector2D_Add |
( TQ3Vector2D * ) Q3Vector2D_Add ( const TQ3Vector2D *v1, const TQ3Vector2D *v2, TQ3Vector2D *result );
Add two 2D vectors.
Available in inline form as Q3FastVector2D_Add.
- v1
- Address of first vector to add.
- v2
- Address of second vector to add.
- result
- Address of vector to set (may be the same as v1 and/or v2).
Q3Vector2D_Cross |
( float ) Q3Vector2D_Cross ( const TQ3Vector2D *v1, const TQ3Vector2D *v2 );
Return the length of the cross product of two 2D vectors.
Equivalently, we assume that the 2D vectors are really 3D vectors with
z=0, then return the z coordinate of the cross product (0,0,z).
Available in inline form as Q3FastVector2D_Cross.
- v1
- Address of first vector.
- v2
- Address of second vector.
Q3Vector2D_Dot |
( float ) Q3Vector2D_Dot ( const TQ3Vector2D *v1, const TQ3Vector2D *v2 );
Return the dot product of two 2D vectors.
Available in inline form as Q3FastVector2D_Dot.
- v1
- Address of first vector.
- v2
- Address of second vector.
Q3Vector2D_Length |
( float ) Q3Vector2D_Length ( const TQ3Vector2D *vector2D );
Return length of 2D vector.
Available in inline form as Q3FastVector2D_Length.
- vector2D
- Address of vector to get length of.
Q3Vector2D_LengthSquared |
( float ) Q3Vector2D_LengthSquared ( const TQ3Vector2D *vector2D );
Return squared length of 2D vector.
For many operations, knowing the squared length of a vector is just
as good as knowing the actual length (e.g., when sorting a set of
vectors by length, or comparing a vector to a cut-off length). But
finding the squared length is much faster, since it avoids a costly
square root computation.
Available in inline form as Q3FastVector2D_LengthSquared.
- vector2D
- Address of vector to get length of.
Q3Vector2D_Negate |
( TQ3Vector2D * ) Q3Vector2D_Negate ( const TQ3Vector2D *vector2D, TQ3Vector2D *result );
Scale a 2D vector by a factor of -1.
Available in inline form as Q3FastVector2D_Negate.
- vector2D
- Address of vector to negate.
- result
- Address of vector to set (may be the same as vector2D).
Q3Vector2D_Normalize |
( TQ3Vector2D * ) Q3Vector2D_Normalize ( const TQ3Vector2D *vector2D, TQ3Vector2D *result );
Scale a 2D vector to length 1.
To obtain valid results, the length of vector2D must not be 0.
Available in inline form as Q3FastVector2D_Normalize.
- vector2D
- Address of vector to normalize.
- result
- Address of vector to set (may be the same as vector2D).
Q3Vector2D_Scale |
( TQ3Vector2D * ) Q3Vector2D_Scale ( const TQ3Vector2D *vector2D, float scalar, TQ3Vector2D *result );
Scale a 2D vector by the given factor.
Available in inline form as Q3FastVector2D_Scale.
- vector2D
- Address of vector to scale.
- scalar
- Scaling factor.
- result
- Address of vector to set (may be the same as vector2D).
Q3Vector2D_Set |
( TQ3Vector2D * ) Q3Vector2D_Set ( TQ3Vector2D *vector2D, float x, float y );
Set a 2D vector.
Available in inline form as Q3FastVector2D_Set.
- vector2D
- Address of vector to set (may be NULL).
- x
- X coordinate to set into vector2D.
- y
- Y coordinate to set into vector2D.
Q3Vector2D_Subtract |
( TQ3Vector2D * ) Q3Vector2D_Subtract ( const TQ3Vector2D *v1, const TQ3Vector2D *v2, TQ3Vector2D *result );
Subtract 2D vector v2 from v1.
Available in inline form as Q3FastVector2D_Subtract.
- v1
- Address of first vector.
- v2
- Address of vector to subtract from v1.
- result
- Address of vector to set (may be the same as v1 and/or v2).
Q3Vector2D_To2DTransformArray |
( TQ3Status ) Q3Vector2D_To2DTransformArray ( const TQ3Vector2D *inVectors2D, const TQ3Matrix3x3 *matrix3x3, TQ3Vector2D *outVectors2D, TQ3Uns32 numVectors, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 2D vectors by a 3x3 matrix.
When you have many vectors to transform, this is a more efficient
alternative to calling Q3Vector2D_Transform repeatedly.
- inVectors2D
- Array of 2D vectors to transform.
- matrix3x3
- Transformation matrix.
- outVectors2D
- Array of vectors to receive output (may be the same as inVectors2D).
- numVectors
- How many vectors are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Vector2D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3Vector2D).
Q3Vector2D_To3D |
( TQ3Vector3D * ) Q3Vector2D_To3D ( const TQ3Vector2D *vector2D, TQ3Vector3D *result );
Convert 2D vector to 3D, by setting z to 1.
Note: this operation makes no sense mathematically, but is included
for backward-compatibility with QD3D. Perhaps the QD3D
implementation was really intended to convert a 2D vector into a 3D
rational point -- see QDPoint2D_To3D, which does exactly that.
Available in inline form as Q3FastVector2D_To3D.
- vector2D
- Address of 2D vector to convert.
- result
- Address of 3D vector to set.
Q3Vector2D_ToRationalPoint3D |
( TQ3RationalPoint3D * ) Q3Vector2D_ToRationalPoint3D ( const TQ3Vector2D *vector2D, TQ3RationalPoint3D *result );
Convert 2D vector to 3D rational point, setting w to 0.
Available in inline form as Q3FastVector2D_ToRationalPoint3D.
- vector2D
- Address of 2D vector to convert.
- result
- Address of 3D rational point to set.
Q3Vector2D_Transform |
( TQ3Vector2D * ) Q3Vector2D_Transform ( const TQ3Vector2D *vector2D, const TQ3Matrix3x3 *matrix3x3, TQ3Vector2D *result );
Transform a 2D vector by a 3x3 matrix.
Note that the translation and perspective components of the
matrix is ignored (as if it were really a 2x2 matrix).
Contrast with Q3Point2D_Transform, which does the full 3x3
transformation.
- vector2D
- Address of a vector to transform.
- matrix3x3
- Address of a 3x3 transformation matrix.
- result
- Address of vector to set (may be the same as vector2D).
Q3Vector3D_Add |
( TQ3Vector3D * ) Q3Vector3D_Add ( const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result );
Add two 3D vectors.
Available in inline form as Q3FastVector3D_Add.
- v1
- Address of first vector to add.
- v2
- Address of second vector to add.
- result
- Address of vector to set (may be the same as v1 and/or v2).
Q3Vector3D_Cross |
( TQ3Vector3D * ) Q3Vector3D_Cross ( const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result );
Return 3D cross product of two 3D vectors.
Available in inline form as Q3FastVector3D_Cross.
- v1
- Address of first vector.
- v2
- Address of second vector.
- result
- Address of vector to set with the result; may be the same address as v1 and/or v2.
Q3Vector3D_Dot |
( float ) Q3Vector3D_Dot ( const TQ3Vector3D *v1, const TQ3Vector3D *v2 );
Return the dot product of two 3D vectors.
Available in inline form as Q3FastVector3D_Dot.
- v1
- Address of first vector.
- v2
- Address of second vector.
Q3Vector3D_DotArray |
( TQ3Status ) Q3Vector3D_DotArray ( const TQ3Vector3D *inFirstVectors3D, const TQ3Vector3D *inSecondVectors3D, float *outDotProducts, TQ3Boolean *outDotLessThanZeros, TQ3Uns32 numVectors, TQ3Uns32 inStructSize, TQ3Uns32 outDotProductStructSize, TQ3Uns32 outDotLessThanZeroStructSize );
Calculate an array of dot products.
Given two arrays of vectors, an array of dot products is returned along
with an array of TQ3Booleans indicating which dot products are less than
zero.
At least one of dotProducts or dotLessThanZero must be non-NULL, however
one parameter may be set to NULL if that information is not required.
- inFirstVectors3D
- First array of 3D vectors to dot.
- inSecondVectors3D
- Second array of 3D vectors to dot.
- outDotProducts
- Array of scalars to receive the dot products.
- outDotLessThanZeros
- Array of booleans to receive the "< 0.0" status of the dot products.
- numVectors
- How many elements are in each array.
- inStructSize
- Size of one element of input arrays, typically sizeof(TQ3Vector3D).
- outDotProductStructSize
- Size of one element of the outDotProducts array, typically sizeof(float).
- outDotLessThanZeroStructSize
- Size of one element of the outDotLessThanZeros array, typically sizeof(TQ3Boolean).
Q3Vector3D_Length |
( float ) Q3Vector3D_Length ( const TQ3Vector3D *vector3D );
Return length of 2D vector.
Available in inline form as Q3FastVector3D_Length.
- vector3D
- Address of vector to get length of.
Q3Vector3D_LengthSquared |
( float ) Q3Vector3D_LengthSquared ( const TQ3Vector3D *vector3D );
Return squared length of 2D vector.
For many operations, knowing the squared length of a vector is just
as good as knowing the actual length (e.g., when sorting a set of
vectors by length, or comparing a vector to a cut-off length). But
finding the squared length is much faster, since it avoids a costly
square root computation.
Available in inline form as Q3FastVector3D_LengthSquared.
- vector3D
- Address of vector to get length of.
Q3Vector3D_Negate |
( TQ3Vector3D * ) Q3Vector3D_Negate ( const TQ3Vector3D *vector3D, TQ3Vector3D *result );
Scale a 3D vector by a factor of -1.
Available in inline form as Q3FastVector3D_Negate.
- vector3D
- Address of vector to negate.
- result
- Address of vector to set (may be the same as vector3D).
Q3Vector3D_Normalize |
( TQ3Vector3D * ) Q3Vector3D_Normalize ( const TQ3Vector3D *vector3D, TQ3Vector3D *result );
Scale a 3D vector to length 1.
To obtain valid results, the length of vector3D must not be 0.
Available in inline form as Q3FastVector3D_Normalize.
- vector3D
- Address of vector to normalize.
- result
- Address of vector to set (may be the same as vector3D).
Q3Vector3D_Scale |
( TQ3Vector3D * ) Q3Vector3D_Scale ( const TQ3Vector3D *vector3D, float scalar, TQ3Vector3D *result );
Scale a 3D vector by the given factor.
Available in inline form as Q3FastVector3D_Scale.
- vector3D
- Address of vector to scale.
- scalar
- Scaling factor.
- result
- Address of vector to set (may be the same as vector3D).
Q3Vector3D_Set |
( TQ3Vector3D * ) Q3Vector3D_Set ( TQ3Vector3D *vector3D, float x, float y, float z );
Set a 3D vector.
Available in inline form as Q3FastVector3D_Set.
- vector3D
- Address of vector to set (may be NULL).
- x
- X coordinate to set into vector3D.
- y
- Y coordinate to set into vector3D.
- z
- Z coordinate to set into vector3D.
Q3Vector3D_Subtract |
( TQ3Vector3D * ) Q3Vector3D_Subtract ( const TQ3Vector3D *v1, const TQ3Vector3D *v2, TQ3Vector3D *result );
Subtract 3D vector v2 from v1.
Available in inline form as Q3FastVector3D_Subtract.
- v1
- Address of first vector.
- v2
- Address of vector to subtract from v1.
- result
- Address of vector to set (may be the same as v1 and/or v2).
Q3Vector3D_To2D |
( TQ3Vector2D * ) Q3Vector3D_To2D ( const TQ3Vector3D *vector3D, TQ3Vector2D *result );
Convert 3D vector to 2D, dividing by z.
Note: this operation makes no sense mathematically, but is included
for backward-compatibility with QD3D. It's possible that the QD3D
function was really intended to convert a 3D rational point to a
2D vector -- see E3RationalPoint3D_To2D, which does the same thing
for a 2D point.
Available in inline form as Q3FastVector3D_To2D.
- vector3D
- Address of 3D vector to convert.
- result
- Address of 2D vector to set.
Q3Vector3D_To3DTransformArray |
( TQ3Status ) Q3Vector3D_To3DTransformArray ( const TQ3Vector3D *inVectors3D, const TQ3Matrix4x4 *matrix4x4, TQ3Vector3D *outVectors3D, TQ3Uns32 numVectors, TQ3Uns32 inStructSize, TQ3Uns32 outStructSize );
Transform an array of 3D vectors by a 4x4 matrix.
When you have many vectors to transform, this is a more efficient
alternative to calling Q3Vector3D_Transform repeatedly.
- inVectors3D
- Array of 3D vectors to transform.
- matrix4x4
- Transformation matrix.
- outVectors3D
- Array of vectors to receive output (may be the same as inVectors3D).
- numVectors
- How many vectors are in each array.
- inStructSize
- Size of one element of the input array, typically sizeof(TQ3Vector3D).
- outStructSize
- Size of one element of the output array, typically sizeof(TQ3Vector3D).
Q3Vector3D_ToRationalPoint4D |
( TQ3RationalPoint4D * ) Q3Vector3D_ToRationalPoint4D ( const TQ3Vector3D *vector3D, TQ3RationalPoint4D *result );
Convert 3D vector to 4D rational point, setting w to 0.
Available in inline form as Q3FastVector3D_ToRationalPoint4D.
- vector3D
- Address of 3D vector to convert.
- result
- Address of 4D rational point to set.
Q3Vector3D_Transform |
( TQ3Vector3D * ) Q3Vector3D_Transform ( const TQ3Vector3D *vector3D, const TQ3Matrix4x4 *matrix4x4, TQ3Vector3D *result );
Transform a 3D vector by a 4x4 matrix.
Note that the translation and perspective components of the
matrix is ignored (as if it were really a 3x3 matrix).
Contrast with Q3Point3D_Transform, which does the full 4x4
transformation.
- vector3D
- Address of a vector to transform.
- matrix4x4
- Address of a 4x4 transformation matrix.
- result
- Address of vector to set (may be the same as vector3D).
Q3Vector3D_TransformQuaternion |
( TQ3Vector3D * ) Q3Vector3D_TransformQuaternion ( const TQ3Vector3D *vector3D, const TQ3Quaternion *quaternion, TQ3Vector3D *result );
Transform a 3D vector by a quaternion.
Note that for correct results, the quaternion should be normalized.
- vector3D
- Address of a vector to transform.
- quaternion
- Address of a quaternion to transform by.
- result
- Address of a vector to set (may be the same as vector3D).
© 1999-2008 Quesa Developers (Last Updated 5/10/2008)