Collaboration diagram for Matrix/Vector/Quaternion Math:
![]() |
Files | |
file | vmath.h |
vector/matrix math | |
file | mat.c |
4 x 4 Matrix manipulation functions... | |
file | qmath.c |
Quaternion math routines. | |
Defines | |
#define | VMATH_H seen |
#define | M_E 2.7182818284590452354 |
#define | M_LOG2E 1.4426950408889634074 |
#define | M_LOG10E 0.43429448190325182765 |
#define | M_LN2 0.69314718055994530942 |
#define | M_LN10 2.30258509299404568402 |
#define | M_PI 3.14159265358979323846 |
#define | M_PI_2 1.57079632679489661923 |
#define | M_PI_4 0.78539816339744830962 |
#define | M_1_PI 0.31830988618379067154 |
#define | M_2_PI 0.63661977236758134308 |
#define | M_2_SQRTPI 1.12837916709551257390 |
#define | M_SQRT2 1.41421356237309504880 |
#define | M_SQRT1_2 0.70710678118654752440 |
#define | M_SQRT2_DIV2 0.70710678118654752440 |
#define | PI M_PI |
#define | VDIVIDE_TOL ( 1.0e-20 ) |
#define | VUNITIZE_TOL ( 1.0e-15 ) |
#define | ELEMENTS_PER_VECT 3 |
# of fastf_t's per vect_t | |
#define | ELEMENTS_PER_PT 3 |
#define | HVECT_LEN 4 |
# of fastf_t's per hvect_t | |
#define | HPT_LEN 4 |
#define | ELEMENTS_PER_PLANE 4 |
# of fastf_t's per plane_t | |
#define | ELEMENTS_PER_MAT (4*4) |
#define | quat_t hvect_t |
4-element quaternion | |
#define | NEAR_ZERO(val, epsilon) ( ((val) > -epsilon) && ((val) < epsilon) ) |
#define | CLAMP(_v, _l, _h) if ((_v) < (_l)) _v = _l; else if ((_v) > (_h)) _v = _h |
#define | DIST_PT_PLANE(_pt, _pl) (VDOT(_pt, _pl) - (_pl)[H]) |
Compute distance from a point to a plane. | |
#define | DIST_PT_PT(a, b) |
Compute distance between two points. | |
#define | X 0 |
#define | Y 1 |
#define | Z 2 |
#define | H 3 |
#define | W H |
#define | MDX 3 |
#define | MDY 7 |
#define | MDZ 11 |
#define | MAT_DELTAS(m, x, y, z) |
set translation values of 4x4 matrix with x, y, z values | |
#define | MAT_DELTAS_VEC(_m, _v) MAT_DELTAS(_m, (_v)[X], (_v)[Y], (_v)[Z] ) |
set translation values of 4x4 matrix from a vector | |
#define | MAT_DELTAS_VEC_NEG(_m, _v) MAT_DELTAS(_m,-(_v)[X],-(_v)[Y],-(_v)[Z] ) |
set translation values of 4x4 matrix from a reversed vector | |
#define | MAT_DELTAS_GET(_v, _m) |
get translation values of 4x4 matrix to a vector | |
#define | MAT_DELTAS_GET_NEG(_v, _m) |
get translation values of 4x4 matrix to a vector, reversed | |
#define | MSX 0 |
#define | MSY 5 |
#define | MSZ 10 |
#define | MSA 15 |
#define | MAT_SCALE(_m, _x, _y, _z) |
set scale of 4x4 matrix from xyz | |
#define | MAT_SCALE_VEC(_m, _v) |
set scale of 4x4 matrix from vector | |
#define | MAT_SCALE_ALL(_m, _s) (_m)[MSA] = (_s) |
set uniform scale of 4x4 matrix from scalar | |
#define | MAT_ZERO(m) |
zero a matrix | |
#define | MAT_IDN(m) |
set matrix to identity | |
#define | MAT_COPY(d, s) |
copy a matrix | |
#define | VSET(a, b, c, d) |
Set vector at `a' to have coordinates `b', `c', `d'. | |
#define | VSETALL(a, s) { (a)[X] = (a)[Y] = (a)[Z] = (s); } |
Set all elements of vector to same scalar value. | |
#define | VSETALLN(v, s, n) |
Set all elements of N-vector to same scalar value. | |
#define | VMOVE(a, b) |
Transfer vector at `b' to vector at `a'. | |
#define | VMOVEN(a, b, n) |
Transfer vector of length `n' at `b' to vector at `a'. | |
#define | HMOVE(a, b) |
Move a homogeneous 4-tuple. | |
#define | V2MOVE(a, b) |
move a 2D vector. This naming convention seems better than the VMOVE_2D version below | |
#define | VREVERSE(a, b) |
Reverse the direction of vector b and store it in a. | |
#define | HREVERSE(a, b) |
Same as VREVERSE, but for a 4-tuple. Also useful on plane_t objects. | |
#define | VADD2(a, b, c) |
Add vectors at `b' and `c', store result at `a'. | |
#define | VADD2N(a, b, c, n) |
Add vectors of length `n' at `b' and `c', store result at `a'. | |
#define | V2ADD2(a, b, c) |
#define | VSUB2(a, b, c) |
Subtract vector at `c' from vector at `b', store result at `a'. | |
#define | VSUB2N(a, b, c, n) |
Subtract `n' length vector at `c' from vector at `b', store result at `a'. | |
#define | V2SUB2(a, b, c) |
#define | VSUB3(a, b, c, d) |
Vectors: A = B - C - D. | |
#define | VSUB3N(a, b, c, d, n) |
Vectors: A = B - C - D for vectors of length `n'. | |
#define | VADD3(a, b, c, d) |
Add 3 vectors at `b', `c', and `d', store result at `a'. | |
#define | VADD3N(a, b, c, d, n) |
Add 3 vectors of length `n' at `b', `c', and `d', store result at `a'. | |
#define | VADD4(a, b, c, d, e) |
Add 4 vectors at `b', `c', `d', and `e', store result at `a'. | |
#define | VADD4N(a, b, c, d, e, n) |
Add 4 `n' length vectors at `b', `c', `d', and `e', store result at `a'. | |
#define | VSCALE(a, b, c) |
Scale vector at `b' by scalar `c', store result at `a'. | |
#define | HSCALE(a, b, c) |
#define | VSCALEN(a, b, c, n) |
Scale vector of length `n' at `b' by scalar `c', store result at `a'. | |
#define | V2SCALE(a, b, c) |
#define | VUNITIZE(a) |
Normalize vector `a' to be a unit vector. | |
#define | VUNITIZE_RET(a, ret) |
If vector magnitude is too small, return an error code. | |
#define | VADD2SCALE(o, a, b, s) |
Find the sum of two points, and scale the result. Often used to find the midpoint. | |
#define | VADD2SCALEN(o, a, b, n) |
#define | VSUB2SCALE(o, a, b, s) |
Find the difference between two points, and scale result. Often used to compute bounding sphere radius given rpp points. | |
#define | VSUB2SCALEN(o, a, b, n) |
#define | VCOMB3(o, a, b, c, d, e, f) |
Combine together several vectors, scaled by a scalar. | |
#define | VCOMB3N(o, a, b, c, d, e, f, n) |
#define | VCOMB2(o, a, b, c, d) |
#define | VCOMB2N(o, a, b, c, d, n) |
#define | VJOIN4(a, b, c, d, e, f, g, h, i, j) |
#define | VJOIN3(a, b, c, d, e, f, g, h) |
#define | VJOIN2(a, b, c, d, e, f) |
Compose vector at `a' of: Vector at `b' plus scalar `c' times vector at `d' plus scalar `e' times vector at `f'. | |
#define | VJOIN2N(a, b, c, d, e, f, n) |
#define | VJOIN1(a, b, c, d) |
#define | VJOIN1N(a, b, c, d, n) |
#define | HJOIN1(a, b, c, d) |
#define | V2JOIN1(a, b, c, d) |
#define | VBLEND2(a, b, c, d, e) |
Blend into vector `a' scalar `b' times vector at `c' plus scalar `d' times vector at `e'. | |
#define | VBLEND2N(a, b, c, d, e, n) |
#define | MAGSQ(a) ( (a)[X]*(a)[X] + (a)[Y]*(a)[Y] + (a)[Z]*(a)[Z] ) |
Return scalar magnitude squared of vector at `a'. | |
#define | MAG2SQ(a) ( (a)[X]*(a)[X] + (a)[Y]*(a)[Y] ) |
#define | MAGNITUDE(a) sqrt( MAGSQ( a ) ) |
Return scalar magnitude of vector at `a'. | |
#define | VCROSS(a, b, c) |
Store cross product of vectors at `b' and `c' in vector at `a'. Note that the "right hand rule" applies: If closing your right hand goes from `b' to `c', then your thumb points in the direction of the cross product. | |
#define | VDOT(a, b) ( (a)[X]*(b)[X] + (a)[Y]*(b)[Y] + (a)[Z]*(b)[Z] ) |
Compute dot product of vectors at `a' and `b'. | |
#define | V2DOT(a, b) ( (a)[X]*(b)[X] + (a)[Y]*(b)[Y] ) |
#define | VSUB2DOT(_pt2, _pt, _vec) |
Subtract two points to make a vector, dot with another vector. | |
#define | V2ARGS(a) (a)[X], (a)[Y] |
Turn a vector into comma-separated list of elements, for subroutine args. | |
#define | V3ARGS(a) (a)[X], (a)[Y], (a)[Z] |
#define | V4ARGS(a) (a)[X], (a)[Y], (a)[Z], (a)[W] |
#define | V2INTCLAMPARGS(a) INTCLAMP((a)[X]), INTCLAMP((a)[Y]) |
integer clamped versions of the previous arg macros | |
#define | V3INTCLAMPARGS(a) INTCLAMP((a)[X]), INTCLAMP((a)[Y]), INTCLAMP((a)[Z]) |
integer clamped versions of the previous arg macros | |
#define | V4INTCLAMPARGS(a) INTCLAMP((a)[X]), INTCLAMP((a)[Y]), INTCLAMP((a)[Z]), INTCLAMP((a)[W]) |
integer clamped versions of the previous arg macros | |
#define | V2PRINT(a, b) (void)fprintf(stderr,"%s (%g, %g)\n", a, V2ARGS(b) ); |
Print vector name and components on stderr. | |
#define | VPRINT(a, b) (void)fprintf(stderr,"%s (%g, %g, %g)\n", a, V3ARGS(b) ); |
#define | HPRINT(a, b) (void)fprintf(stderr,"%s (%g, %g, %g, %g)\n", a, V4ARGS(b) ); |
#define | V2INTCLAMPPRINT(a, b) (void)fprintf(stderr,"%s (%g, %g)\n", a, V2INTCLAMPARGS(b) ); |
integer clamped versions of the previous print macros | |
#define | VINTCLAMPPRINT(a, b) (void)fprintf(stderr,"%s (%g, %g, %g)\n", a, V3INTCLAMPARGS(b) ); |
#define | HINTCLAMPPRINT(a, b) (void)fprintf(stderr,"%s (%g, %g, %g, %g)\n", a, V4INTCLAMPARGS(b) ); |
#define | INTCLAMP(_a) ( NEAR_ZERO((_a) - rint(_a), VUNITIZE_TOL) ? rint(_a) : (_a) ) |
#define | VELMUL(a, b, c) |
Vector element multiplication. Really: diagonal matrix X vect. | |
#define | VELMUL3(a, b, c, d) |
#define | VELDIV(a, b, c) |
Similar to VELMUL. | |
#define | VINVDIR(_inv, _dir) |
Given a direction vector, compute the inverses of each element. When division by zero would have occured, mark inverse as INFINITY. | |
#define | MAT3X3VEC(o, mat, vec) |
Apply the 3x3 part of a mat_t to a 3-tuple. This rotates a vector without scaling it (changing its length). | |
#define | VEC3X3MAT(o, i, m) |
Multiply a 3-tuple by the 3x3 part of a mat_t. | |
#define | MAT3X2VEC(o, mat, vec) |
Apply the 3x3 part of a mat_t to a 2-tuple (Z part=0). | |
#define | VEC2X3MAT(o, i, m) |
Multiply a 2-tuple (Z=0) by the 3x3 part of a mat_t. | |
#define | MAT4X3PNT(o, m, i) |
Apply a 4x4 matrix to a 3-tuple which is an absolute Point in space. | |
#define | PNT3X4MAT(o, i, m) |
Multiply an Absolute 3-Point by a full 4x4 matrix. | |
#define | MAT4X4PNT(o, m, i) |
Multiply an Absolute hvect_t 4-Point by a full 4x4 matrix. | |
#define | MAT4X3VEC(o, m, i) |
Apply a 4x4 matrix to a 3-tuple which is a relative Vector in space This macro can scale the length of the vector if [15] != 1.0. | |
#define | MAT4XSCALOR(o, m, i) {(o) = (i) / (m)[15];} |
#define | VEC3X4MAT(o, i, m) |
Multiply a Relative 3-Vector by most of a 4x4 matrix. | |
#define | VEC2X4MAT(o, i, m) |
Multiply a Relative 2-Vector by most of a 4x4 matrix. | |
#define | BN_VEC_NON_UNIT_LEN(_vec) (fabs(MAGSQ(_vec)) < 0.0001 || fabs(fabs(MAGSQ(_vec))-1) > 0.0001) |
Test a vector for non-unit length. | |
#define | VEQUAL(a, b) ((a)[X]==(b)[X] && (a)[Y]==(b)[Y] && (a)[Z]==(b)[Z]) |
Compare two vectors for EXACT equality. Use carefully. | |
#define | VAPPROXEQUAL(a, b, tol) |
Compare two vectors for approximate equality, within the specified absolute tolerance. | |
#define | VNEAR_ZERO(v, tol) |
Test for all elements of `v' being smaller than `tol'. | |
#define | V_MIN(r, s) if( (s) < (r) ) r = (s) |
Macros to update min and max X,Y,Z values to contain a point. | |
#define | V_MAX(r, s) if( (s) > (r) ) r = (s) |
#define | VMIN(r, s) { V_MIN((r)[X],(s)[X]); V_MIN((r)[Y],(s)[Y]); V_MIN((r)[Z],(s)[Z]); } |
#define | VMAX(r, s) { V_MAX((r)[X],(s)[X]); V_MAX((r)[Y],(s)[Y]); V_MAX((r)[Z],(s)[Z]); } |
#define | VMINMAX(min, max, pt) { VMIN( (min), (pt) ); VMAX( (max), (pt) ); } |
#define | HDIVIDE(a, b) |
Divide out homogeneous parameter from hvect_t, creating vect_t. | |
#define | VADD2_2D(a, b, c) V2ADD2(a,b,c) |
Some 2-D versions of the 3-D macros given above. | |
#define | VSUB2_2D(a, b, c) V2SUB2(a,b,c) |
#define | MAGSQ_2D(a) MAG2SQ(a) |
#define | VDOT_2D(a, b) V2DOT(a,b) |
#define | VMOVE_2D(a, b) V2MOVE(a,b) |
#define | VSCALE_2D(a, b, c) V2SCALE(a,b,c) |
#define | VJOIN1_2D(a, b, c, d) V2JOIN1(a,b,c,d) |
#define | QUAT_FROM_ROT(q, r, x, y, z) |
Quaternion math definitions.Create Quaternion from Vector and Rotation about vector. | |
#define | QUAT_FROM_VROT(q, r, v) |
#define | QUAT_FROM_VROT_DEG(q, r, v) QUAT_FROM_VROT(q, ((r)*(M_PI/180.0)), v) |
#define | QUAT_FROM_ROT_DEG(q, r, x, y, z) QUAT_FROM_ROT(q, ((r)*(M_PI/180.0)), x, y, z) |
#define | QSET(a, b, c, d, e) |
Set quaternion at `a' to have coordinates `b', `c', `d', `e'. | |
#define | QMOVE(a, b) |
Transfer quaternion at `b' to quaternion at `a'. | |
#define | QADD2(a, b, c) |
Add quaternions at `b' and `c', store result at `a'. | |
#define | QSUB2(a, b, c) |
Subtract quaternion at `c' from quaternion at `b', store result at `a'. | |
#define | QSCALE(a, b, c) |
Scale quaternion at `b' by scalar `c', store result at `a'. | |
#define | QUNITIZE(a) |
Normalize quaternion 'a' to be a unit quaternion. | |
#define | QMAGSQ(a) |
Return scalar magnitude squared of quaternion at `a'. | |
#define | QMAGNITUDE(a) sqrt( QMAGSQ( a ) ) |
Return scalar magnitude of quaternion at `a'. | |
#define | QDOT(a, b) |
Compute dot product of quaternions at `a' and `b'. | |
#define | QMUL(a, b, c) |
Compute quaternion product a = b * c a[W] = b[W]*c[W] - VDOT(b,c); VCROSS( temp, b, c ); VJOIN2( a, temp, b[W], c, c[W], b );. | |
#define | QCONJUGATE(a, b) |
Conjugate quaternion. | |
#define | QINVERSE(a, b) |
Multiplicative inverse quaternion. | |
#define | QBLEND2(a, b, c, d, e) |
Blend into quaternion `a' scalar `b' times quaternion at `c' plus scalar `d' times quaternion at `e'. | |
#define | V3RPP_DISJOINT(_l1, _h1, _l2, _h2) |
Macros for dealing with 3-D "extents" represented as axis-aligned right parallelpipeds (RPPs). This is stored as two points: a min point, and a max point. RPP 1 is defined by lo1, hi1, RPP 2 by lo2, hi2. Compare two extents represented as RPPs. If they are disjoint, return true. | |
#define | V3RPP_OVERLAP(_l1, _h1, _l2, _h2) |
Compare two extents represented as RPPs. If they overlap, return true. | |
#define | V3RPP_OVERLAP_TOL(_l1, _h1, _l2, _h2, _t) |
If two extents overlap within distance tolerance, return true. | |
#define | V3PT_IN_RPP(_pt, _lo, _hi) |
Is the point within or on the boundary of the RPP? | |
#define | V3PT_IN_RPP_TOL(_pt, _lo, _hi, _t) |
Within the distance tolerance, is the point within the RPP? | |
#define | V3RPP1_IN_RPP2(_lo1, _hi1, _lo2, _hi2) |
Determine if one bounding box is within another. Also returns true if the boxes are the same. | |
#define | PI 3.14159265358979323264 |
#define | RTODEG (180.0/PI) |
Typedefs | |
typedef fastf_t | mat_t [ELEMENTS_PER_MAT] |
4x4 matrix | |
typedef fastf_t * | matp_t |
typedef fastf_t | vect_t [ELEMENTS_PER_VECT] |
3-tuple vector | |
typedef fastf_t * | vectp_t |
typedef fastf_t | point_t [ELEMENTS_PER_PT] |
3-tuple point | |
typedef fastf_t * | pointp_t |
typedef fastf_t | point2d_t [2] |
typedef fastf_t | hvect_t [HVECT_LEN] |
4-tuple vector | |
typedef fastf_t | hpoint_t [HPT_LEN] |
4-tuple point | |
typedef fastf_t | plane_t [ELEMENTS_PER_PLANE] |
Definition of a plane equation. | |
Functions | |
void | quat_mat2quat (hvect_t quat, const mat_t mat) |
void | quat_quat2mat (mat_t mat, const hvect_t quat) |
double | quat_distance (const hvect_t q1, const hvect_t q2) |
void | quat_double (hvect_t qout, const hvect_t q1, const hvect_t q2) |
void | quat_bisect (hvect_t qout, const hvect_t q1, const hvect_t q2) |
void | quat_slerp (hvect_t qout, const hvect_t q1, const hvect_t q2, double f) |
void | quat_sberp (hvect_t qout, const hvect_t q1, const hvect_t qa, const hvect_t qb, const hvect_t q2, double f) |
void | quat_make_nearest (hvect_t q1, const hvect_t q2) |
void | quat_print (const char *title, const hvect_t quat) |
void | quat_exp (hvect_t out, const hvect_t in) |
void | quat_log (hvect_t out, const hvect_t in) |
void | quat_mat2quat (register fastf_t *quat, register const fastf_t *mat) |
Convert Matrix to Quaternion. | |
void | quat_quat2mat (register fastf_t *mat, register const fastf_t *quat) |
Convert Quaternion to Matrix. | |
double | quat_distance (const fastf_t *q1, const fastf_t *q2) |
Gives the euclidean distance between two quaternions. | |
void | quat_double (fastf_t *qout, const fastf_t *q1, const fastf_t *q2) |
Gives the quaternion point representing twice the rotation from q1 to q2. Needed for patching Bezier curves together. A rather poor name admittedly. | |
void | quat_bisect (fastf_t *qout, const fastf_t *q1, const fastf_t *q2) |
Gives the bisector of quaternions q1 and q2. (Could be done with quat_slerp and factor 0.5) [I believe they must be unit quaternions this to work]. | |
void | quat_slerp (fastf_t *qout, const fastf_t *q1, const fastf_t *q2, double f) |
Do Spherical Linear Interpolation between two unit quaternions by the given factor. | |
void | quat_sberp (fastf_t *qout, const fastf_t *q1, const fastf_t *qa, const fastf_t *qb, const fastf_t *q2, double f) |
Spherical Bezier Interpolate between four quaternions by amount f. These are intended to be used as start and stop quaternions along with two control quaternions chosen to match spline segments with first order continuity. | |
void | quat_make_nearest (fastf_t *q1, const fastf_t *q2) |
Set the quaternion q1 to the quaternion which yields the smallest rotation from q2 (of the two versions of q1 which produce the same orientation). | |
void | quat_print (const char *title, const fastf_t *quat) |
void | quat_exp (fastf_t *out, const fastf_t *in) |
Exponentiate a quaternion, assuming that the scalar part is 0. Code by Ken Shoemake. | |
void | quat_log (fastf_t *out, const fastf_t *in) |
Take the natural logarithm of a unit quaternion. Code by Ken Shoemake. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 114 of file vmath.h. Referenced by anim_dx_y_z2mat(), anim_dy_p_r2mat(), anim_dy_p_r2vmat(), anim_dz_y_x2mat(), anim_mat2ypr(), anim_mat2zyx(), get_seg_midpoint(), rt_bot_decimate(), rt_smooth_bot(), seg_to_vlist(), and wdb_smooth_bot_cmd(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 121 of file vmath.h. Referenced by rt_nurb_plot(). |
|
|
|
Definition at line 125 of file vmath.h. Referenced by quat_slerp(). |
|
Definition at line 136 of file vmath.h. Referenced by anim_dir2mat(), anim_dirn2mat(), anim_mat2ypr(), anim_mat2zyx(), bn_mat_ck(), nmg_face_rs_init(), nmg_offset_eu_vert(), quat_exp(), quat_log(), rt_pipe_ck(), and rt_tgc_describe(). |
|
Definition at line 141 of file vmath.h. Referenced by db_dirbuild(). |
|
# of fastf_t's per vect_t
Definition at line 146 of file vmath.h. Referenced by rt_ars_describe(), rt_ars_export(), rt_ars_export5(), rt_ars_import5(), rt_ars_prep(), rt_ars_rd_curve(), rt_cline_plot(), rt_ehy_plot(), rt_ell_export5(), rt_ell_import5(), rt_ell_plot(), rt_ell_tnurb(), rt_epa_plot(), rt_extrude_export(), rt_extrude_export5(), rt_extrude_import(), rt_extrude_import5(), rt_fastf_float(), rt_hlf_import(), rt_hlf_xform(), rt_metaball_plot_sph(), rt_pg_describe(), rt_rhc_plot(), rt_superell_export5(), rt_superell_import5(), rt_superell_plot(), rt_tgc_plot(), rt_xxx_export5(), and rt_xxx_import5(). |
|
Definition at line 147 of file vmath.h. Referenced by nmg_vface(), and nmg_vlg(). |
|
# of fastf_t's per hvect_t
|
|
|
|
# of fastf_t's per plane_t
Definition at line 153 of file vmath.h. Referenced by nmg_face_g(), rt_arbn_export5(), and rt_arbn_import5(). |
|
Definition at line 154 of file vmath.h. Referenced by rt_comb_export5(), rt_comb_import5(), rt_comb_v5_serialize(), and rt_dsp_export5(). |
|
4-element quaternion
Definition at line 180 of file vmath.h. Referenced by anim_quat2mat(), bn_math_cmd(), dgo_get_eyemodel_cmd(), quat_distance(), quat_double(), quat_make_nearest(), quat_quat2mat(), quat_sberp(), vo_orientation_cmd(), and vo_pov_cmd(). |
|
|
clamp a value to a low/high number Definition at line 190 of file vmath.h. Referenced by dsp_pos(), project_pt(), and rt_dsp_uv(). |
|
Compute distance from a point to a plane.
Definition at line 218 of file vmath.h. Referenced by isect_ray_planar_face(), nmg_ck_fu_verts(), nmg_ck_v_in_2fus(), nmg_ck_vert_on_fus(), nmg_class_lu_fu(), nmg_class_pt_fu_except(), nmg_class_pt_lu_except(), nmg_class_pt_s(), nmg_classify_pt_loop(), nmg_cut_lu_into_coplanar_and_non(), nmg_edge_collapse(), nmg_faces_can_be_intersected(), nmg_is_crack_outie(), nmg_is_vertex_on_inter(), nmg_isect_eu_fu(), nmg_isect_two_generic_faces(), rt_arbn_tess(), rt_extrude_norm(), rt_extrude_shot(), and rt_line_on_plane(). |
|
Value: sqrt( \ ((a)[X]-(b)[X])*((a)[X]-(b)[X]) + \ ((a)[Y]-(b)[Y])*((a)[Y]-(b)[Y]) + \ ((a)[Z]-(b)[Z])*((a)[Z]-(b)[Z]) )
|
|
|
|
|
|
|
|
Definition at line 230 of file vmath.h. Referenced by nmg_ck_fg(), nmg_loop_plane_newell(), nmg_snurb_is_planar(), nmg_vfg(), rt_dsp_shot(), rt_nurb_c_bound(), and rt_nurb_s_bound(). |
|
Definition at line 231 of file vmath.h. Referenced by anim_mat2quat(), anim_quat2mat(), bn_htov_move(), quat_exp(), quat_log(), quat_mat2quat(), quat_print(), quat_quat2mat(), and quat_slerp(). |
|
Definition at line 234 of file vmath.h. Referenced by bn_mat_arb_rot(), db_tree_describe(), db_tree_flatten_describe(), dgo_nirt_cmd(), and rt_extrude_prep(). |
|
Definition at line 235 of file vmath.h. Referenced by bn_mat_arb_rot(), db_tree_describe(), db_tree_flatten_describe(), dgo_nirt_cmd(), and rt_extrude_prep(). |
|
Definition at line 236 of file vmath.h. Referenced by bn_mat_arb_rot(), db_tree_describe(), db_tree_flatten_describe(), dgo_nirt_cmd(), and rt_extrude_prep(). |
|
Value: set translation values of 4x4 matrix with x, y, z values
Definition at line 239 of file vmath.h. Referenced by bn_vlist_3string(), db_parse_1anim(), dgo_autoview(), tp_3axis(), and tp_3symbol(). |
|
set translation values of 4x4 matrix from a vector
Definition at line 245 of file vmath.h. Referenced by bn_mat_scale_about_pt(), bn_mat_xform_about_pt(), db_shader_mat(), rt_ell_tnurb(), rt_hf_to_dsp(), wdb_ocenter_cmd(), and wdb_otranslate_cmd(). |
|
set translation values of 4x4 matrix from a reversed vector
Definition at line 249 of file vmath.h. Referenced by bn_mat_scale_about_pt(), bn_mat_xform_about_pt(), nmg_isect2d_prep(), vo_center(), vo_eye_cmd(), vo_lookat_cmd(), vo_pov_cmd(), vo_rot(), vo_slew(), and vo_tra(). |
|
Value: get translation values of 4x4 matrix to a vector
|
|
Value: get translation values of 4x4 matrix to a vector, reversed
Definition at line 259 of file vmath.h. Referenced by vo_center_cmd(), and vo_tra(). |
|
|
|
|
|
|
|
|
|
Value: set scale of 4x4 matrix from xyz
|
|
Value: set scale of 4x4 matrix from vector
Definition at line 277 of file vmath.h. Referenced by db_shader_mat(). |
|
set uniform scale of 4x4 matrix from scalar
|
|
Value: { \ (m)[0] = (m)[1] = (m)[2] = (m)[3] = \ (m)[4] = (m)[5] = (m)[6] = (m)[7] = \ (m)[8] = (m)[9] = (m)[10] = (m)[11] = \ (m)[12] = (m)[13] = (m)[14] = (m)[15] = 0.0;}
Definition at line 289 of file vmath.h. Referenced by bn_mat_scale_about_pt(), nmg_calc_face_plane(), nmg_snurb_is_planar(), and nmg_vlblock_around_eu(). |
|
|
Value: { \ (d)[0] = (s)[0];\ (d)[1] = (s)[1];\ (d)[2] = (s)[2];\ (d)[3] = (s)[3];\ (d)[4] = (s)[4];\ (d)[5] = (s)[5];\ (d)[6] = (s)[6];\ (d)[7] = (s)[7];\ (d)[8] = (s)[8];\ (d)[9] = (s)[9];\ (d)[10] = (s)[10];\ (d)[11] = (s)[11];\ (d)[12] = (s)[12];\ (d)[13] = (s)[13];\ (d)[14] = (s)[14];\ (d)[15] = (s)[15]; }
Definition at line 313 of file vmath.h. Referenced by bn_mat_inverse(), bn_mat_lookat(), bn_mat_mul2(), db_apply_state_from_memb(), db_do_anim(), db_follow_path(), db_path_to_mat(), db_tree_mul_dbleaf(), Do_copy_membs(), nmg_find_e_nearest_pt2(), rt_bend_pipe_prep(), rt_ebm_import(), rt_ebm_import5(), rt_ebm_tcladjust(), rt_find_identical_solid(), rt_submodel_import(), rt_submodel_import5(), rt_submodel_plot(), rt_submodel_prep(), rt_tor_prep(), rt_vol_import(), rt_vol_import5(), and vo_rmat_cmd(). |
|
|
|
Value: {\ register int _j;\ for (_j=0; _j<n; _j++) v[_j]=(s);}
Definition at line 343 of file vmath.h. Referenced by nmg_snurb_calc_lu_uv_orient(), nmg_snurb_fu_eval(), and rt_arbn_tcladjust(). |
|
|
Value: { register int _vmove; \ for(_vmove = 0; _vmove < (n); _vmove++) \ (a)[_vmove] = (b)[_vmove]; \ }
Definition at line 354 of file vmath.h. Referenced by dgo_nirt_cmd(), and rt_arc2d_to_cnurb(). |
|
Value: Move a homogeneous 4-tuple.
Definition at line 361 of file vmath.h. Referenced by nmg_calc_face_plane(), nmg_face_g(), nmg_face_new_g(), nmg_isect2d_prep(), nmg_loop_plane_area(), and rt_nurb_crv_flat(). |
|
Value: move a 2D vector. This naming convention seems better than the VMOVE_2D version below
Definition at line 370 of file vmath.h. Referenced by Bezier(), bn_dist_pt2_lseg2(), FindRoots(), get_seg_midpoint(), nmg_edge_g_cnurb(), rt_copy_sketch(), and seg_to_vlist(). |
|
|
Value: Same as VREVERSE, but for a 4-tuple. Also useful on plane_t objects.
Definition at line 381 of file vmath.h. Referenced by nmg_loop_plane_newell(), and nmg_lu_reorient(). |
|
Value: Add vectors at `b' and `c', store result at `a'.
Definition at line 391 of file vmath.h. Referenced by nmg_classify_lu_lu(), nmg_get_interior_pt(), nmg_loop_plane_area(), nmg_lu_to_vlist(), nmg_move_edge_thru_pt(), nmg_offset_eu_vert(), nmg_pl_e(), nmg_plot_ray_face(), nmg_to_tgc(), nmg_translate_face(), nmg_vlblock_e(), rt_arb_centroid(), rt_arb_import(), rt_arb_mk_planes(), rt_cline_plot(), rt_cline_prep(), rt_cline_shot(), rt_cline_tess(), rt_dsp_norm(), rt_ebm_prep(), rt_ell_16pts(), rt_extrude_plot(), rt_extrude_prep(), rt_grp_plot(), rt_hlf_plot(), rt_metaball_shot(), rt_nurb_shot(), rt_part_hemisphere(), rt_part_prep(), rt_part_shot(), rt_part_tess(), rt_rhc_plot(), rt_rhc_tess(), rt_rpc_plot(), rt_rpc_tess(), rt_superell_16pts(), rt_tgc_plot(), rt_tgc_prep(), rt_vol_prep(), tesselate_pipe_bend(), vo_aet_cmd(), wdb_ocenter_cmd(), wdb_orotate_cmd(), and wdb_oscale_cmd(). |
|
Value: { register int _vadd2; \ for(_vadd2 = 0; _vadd2 < (n); _vadd2++) \ (a)[_vadd2] = (b)[_vadd2] + (c)[_vadd2]; \ }
Definition at line 398 of file vmath.h. Referenced by anim_quat2mat(). |
|
Value: |
|
|
Value: { register int _vsub2; \ for(_vsub2 = 0; _vsub2 < (n); _vsub2++) \ (a)[_vsub2] = (b)[_vsub2] - (c)[_vsub2]; \ }
|
|
Value: Definition at line 425 of file vmath.h. Referenced by classify_sketch_loops(), CrossingCount(), get_seg_midpoint(), isect_2D_loop_ray(), isect_line2_ellipse(), isect_line_earc(), and seg_to_vlist(). |
|
Value: { \ (a)[X] = (b)[X] - (c)[X] - (d)[X];\ (a)[Y] = (b)[Y] - (c)[Y] - (d)[Y];\ (a)[Z] = (b)[Z] - (c)[Z] - (d)[Z]; }
Definition at line 433 of file vmath.h. Referenced by rt_part_norm(). |
|
Value: { register int _vsub3; \ for(_vsub3 = 0; _vsub3 < (n); _vsub3++) \ (a)[_vsub3] = (b)[_vsub3] - (c)[_vsub3] - (d)[_vsub3]; \ }
|
|
Value: { \ (a)[X] = (b)[X] + (c)[X] + (d)[X];\ (a)[Y] = (b)[Y] + (c)[Y] + (d)[Y];\ (a)[Z] = (b)[Z] + (c)[Z] + (d)[Z]; }
Definition at line 450 of file vmath.h. Referenced by find_closest_face(), rt_smooth_bot(), rt_tgc_prep(), rt_tor_plot(), rt_tor_tess(), and tp_3vector(). |
|
Value: { register int _vadd3; \ for(_vadd3 = 0; _vadd3 < (n); _vadd3++) \ (a)[_vadd3] = (b)[_vadd3] + (c)[_vadd3] + (d)[_vadd3]; \ }
|
|
Value: { \ (a)[X] = (b)[X] + (c)[X] + (d)[X] + (e)[X];\ (a)[Y] = (b)[Y] + (c)[Y] + (d)[Y] + (e)[Y];\ (a)[Z] = (b)[Z] + (c)[Z] + (d)[Z] + (e)[Z]; }
|
|
Value: { register int _vadd4; \ for(_vadd4 = 0; _vadd4 < (n); _vadd4++) \ (a)[_vadd4] = (b)[_vadd4] + (c)[_vadd4] + (d)[_vadd4] + (e)[_vadd4];\ }
|
|
|
Value: { \ (a)[X] = (b)[X] * (c);\ (a)[Y] = (b)[Y] * (c);\ (a)[Z] = (b)[Z] * (c);\ (a)[W] = (b)[W] * (c); } Definition at line 490 of file vmath.h. Referenced by nmg_snurb_is_planar(). |
|
Value: { register int _vscale; \ for(_vscale = 0; _vscale < (n); _vscale++) \ (a)[_vscale] = (b)[_vscale] * (c); \ }
Definition at line 497 of file vmath.h. Referenced by rt_arc2d_to_cnurb(), and rt_nmg_export_fastf(). |
|
Value: Definition at line 503 of file vmath.h. Referenced by classify_sketch_loops(), and rt_sketch_export5(). |
|
|
Value: { \ register double _f; _f = MAGNITUDE(a); \ if( _f < VDIVIDE_TOL ) return(ret); \ _f = 1.0/_f; \ (a)[X] *= _f; (a)[Y] *= _f; (a)[Z] *= _f; }
|
|
Value: { \ (o)[X] = ((a)[X] + (b)[X]) * (s); \ (o)[Y] = ((a)[Y] + (b)[Y]) * (s); \ (o)[Z] = ((a)[Z] + (b)[Z]) * (s); }
Definition at line 548 of file vmath.h. Referenced by dgo_autoview(), dgo_get_autoview_cmd(), nmg_is_crack_outie(), nmg_isect2d_prep(), nmg_vlblock_around_eu(), rt_arb_setup(), rt_dsp_prep(), rt_ebm_prep(), rt_nmg_prep(), rt_submodel_prep(), and rt_vol_prep(). |
|
Value: { register int _vadd2scale; \ for( _vadd2scale = 0; _vadd2scale < (n); _vadd2scale++ ) \ (o)[_vadd2scale] = ((a)[_vadd2scale] + (b)[_vadd2scale]) * (s); \ } |
|
Value: { \ (o)[X] = ((a)[X] - (b)[X]) * (s); \ (o)[Y] = ((a)[Y] - (b)[Y]) * (s); \ (o)[Z] = ((a)[Z] - (b)[Z]) * (s); }
Definition at line 567 of file vmath.h. Referenced by nmg_pl_e(), nmg_vlblock_e(), rt_arb_export(), rt_arb_setup(), rt_ars_export(), rt_dsp_prep(), rt_nmg_prep(), and rt_part_prep(). |
|
Value: { register int _vsub2scale; \ for( _vsub2scale = 0; _vsub2scale < (n); _vsub2scale++ ) \ (o)[_vsub2scale] = ((a)[_vsub2scale] - (b)[_vsub2scale]) * (s); \ } |
|
Value: {\ (o)[X] = (a) * (b)[X] + (c) * (d)[X] + (e) * (f)[X];\ (o)[Y] = (a) * (b)[Y] + (c) * (d)[Y] + (e) * (f)[Y];\ (o)[Z] = (a) * (b)[Z] + (c) * (d)[Z] + (e) * (f)[Z];}
|
|
Value: {\ { register int _vcomb3; \ for(_vcomb3 = 0; _vcomb3 < (n); _vcomb3++) \ (o)[_vcomb3] = (a) * (b)[_vcomb3] + (c) * (d)[_vcomb3] + (e) * (f)[_vcomb3]; \ } } |
|
Value: {\ (o)[X] = (a) * (b)[X] + (c) * (d)[X];\ (o)[Y] = (a) * (b)[Y] + (c) * (d)[Y];\ (o)[Z] = (a) * (b)[Z] + (c) * (d)[Z];} Definition at line 601 of file vmath.h. Referenced by nmg_make_faces_at_vert(), rt_ehy_curve(), rt_ell_curve(), rt_epa_curve(), rt_eto_curve(), rt_eto_plot(), rt_eto_tess(), rt_tgc_curve(), rt_tor_plot(), rt_tor_tess(), and tesselate_pipe_linear(). |
|
Value: {\ { register int _vcomb2; \ for(_vcomb2 = 0; _vcomb2 < (n); _vcomb2++) \ (o)[_vcomb2] = (a) * (b)[_vcomb2] + (c) * (d)[_vcomb2]; \ } } |
|
Value: |
|
Value: |
|
Value: { \ (a)[X] = (b)[X] + (c) * (d)[X] + (e) * (f)[X];\ (a)[Y] = (b)[Y] + (c) * (d)[Y] + (e) * (f)[Y];\ (a)[Z] = (b)[Z] + (c) * (d)[Z] + (e) * (f)[Z]; }
Definition at line 631 of file vmath.h. Referenced by draw_pipe_arc(), draw_pipe_bend(), nmg_offset_eu_vert(), project_pt(), rt_arc2d_to_cnurb(), rt_cline_shot(), rt_cline_tess(), rt_ell(), rt_ell_16pts(), rt_ell_norms(), rt_eto_plot(), rt_eto_tess(), rt_hf_plot(), rt_hf_prep(), rt_linear_pipe_prep(), rt_part_hemisphere(), rt_raybundle_maker(), rt_rhc_prep(), rt_rpc_prep(), rt_superell_16pts(), rt_tgc_tess(), seg_to_vlist(), tesselate_pipe_linear(), and tesselate_pipe_start(). |
|
Value: { register int _vjoin2; \ for(_vjoin2 = 0; _vjoin2 < (n); _vjoin2++) \ (a)[_vjoin2] = (b)[_vjoin2] + (c) * (d)[_vjoin2] + (e) * (f)[_vjoin2]; \ } |
|
|
Value: { register int _vjoin1; \ for(_vjoin1 = 0; _vjoin1 < (n); _vjoin1++) \ (a)[_vjoin1] = (b)[_vjoin1] + (c) * (d)[_vjoin1]; \ } Definition at line 652 of file vmath.h. Referenced by rt_arc2d_to_cnurb(). |
|
Value: |
|
Value: Definition at line 664 of file vmath.h. Referenced by bn_dist_pt2_lseg2(), get_seg_midpoint(), isect_line_earc(), and seg_to_vlist(). |
|
Value: { \ (a)[X] = (b) * (c)[X] + (d) * (e)[X];\ (a)[Y] = (b) * (c)[Y] + (d) * (e)[Y];\ (a)[Z] = (b) * (c)[Z] + (d) * (e)[Z]; }
Definition at line 676 of file vmath.h. Referenced by bn_distsq_line3_line3(), bn_math_cmd(), nmg_cnurb_is_on_crv(), nmg_cnurb_lseg_coincident(), nmg_eval_linear_trim_to_tol(), nmg_find_eu_leftvec(), nmg_fix_overlapping_loops(), nmg_isect_eu_eu(), nmg_lu_is_convex(), nmg_split_linear_trim(), quat_slerp(), rt_ell_norms(), and rt_eto_tess(). |
|
Value: { register int _vblend2; \ for(_vblend2 = 0; _vblend2 < (n); _vblend2++) \ (a)[_vblend2] = (b) * (c)[_vblend2] + (d) * (e)[_vblend2]; \ } |
|
|
Definition at line 690 of file vmath.h. Referenced by isect_2D_loop_ray(), and rt_extrude_curve(). |
|
|
|
|
Definition at line 717 of file vmath.h. Referenced by CrossingCount(), get_quadrant(), and isect_line2_ellipse(). |
|
Value: ( \ ((_pt2)[X] - (_pt)[X]) * (_vec)[X] + \ ((_pt2)[Y] - (_pt)[Y]) * (_vec)[Y] + \ ((_pt2)[Z] - (_pt)[Z]) * (_vec)[Z] )
|
|
Turn a vector into comma-separated list of elements, for subroutine args.
Definition at line 726 of file vmath.h. Referenced by bn_dist_pt2_along_line2(), bn_isect_line2_line2(), bn_isect_line2_lseg2(), bn_isect_lseg2_lseg2(), bn_isect_lseg3_lseg3(), and rt_sketch_tclget(). |
|
|
|
integer clamped versions of the previous arg macros
Definition at line 731 of file vmath.h. Referenced by rt_sketch_describe(). |
|
integer clamped versions of the previous arg macros
Definition at line 733 of file vmath.h. Referenced by rt_bot_describe(), rt_cline_describe(), rt_extrude_describe(), rt_grp_describe(), rt_hlf_describe(), rt_sketch_describe(), and rt_vol_describe(). |
|
integer clamped versions of the previous arg macros
|
|
Print vector name and components on stderr.
|
|
|
|
|
|
integer clamped versions of the previous print macros
|
|
|
|
|
|
if a value is within computation tolerance of an integer, clamp the value to that integer. XXX - should use VDIVIDE_TOL here, but cannot yet until floats are replaced universally with fastf_t's since their epsilon is considerably less than that of a double. Definition at line 768 of file vmath.h. Referenced by rt_arb_describe(), rt_arbn_describe(), rt_ars_describe(), rt_cline_describe(), rt_ebm_describe(), rt_ehy_describe(), rt_ell_describe(), rt_epa_describe(), rt_eto_describe(), rt_grp_describe(), rt_hlf_describe(), rt_nurb_describe(), rt_part_describe(), rt_pg_describe(), rt_pipe_describe(), rt_pr_fallback_angle(), rt_pr_region(), rt_pr_soltab(), rt_pr_uvcoord(), rt_rhc_describe(), rt_rpc_describe(), rt_superell_describe(), rt_tgc_describe(), rt_tor_describe(), rt_vol_describe(), and rt_xxx_describe(). |
|
Value: Vector element multiplication. Really: diagonal matrix X vect.
Definition at line 778 of file vmath.h. Referenced by rt_ell_prep(), rt_superell_prep(), rt_vol_plate(), and rt_vol_tess(). |
|
Value: |
|
Value: { \ (a)[0] = (b)[0] / (c)[0];\ (a)[1] = (b)[1] / (c)[1];\ (a)[2] = (b)[2] / (c)[2]; }
|
|
Value: { \ if( (_dir)[X] < -SQRT_SMALL_FASTF || (_dir)[X] > SQRT_SMALL_FASTF ) { \ (_inv)[X]=1.0/(_dir)[X]; \ } else { \ (_dir)[X] = 0.0; \ (_inv)[X] = INFINITY; \ } \ if( (_dir)[Y] < -SQRT_SMALL_FASTF || (_dir)[Y] > SQRT_SMALL_FASTF ) { \ (_inv)[Y]=1.0/(_dir)[Y]; \ } else { \ (_dir)[Y] = 0.0; \ (_inv)[Y] = INFINITY; \ } \ if( (_dir)[Z] < -SQRT_SMALL_FASTF || (_dir)[Z] > SQRT_SMALL_FASTF ) { \ (_inv)[Z]=1.0/(_dir)[Z]; \ } else { \ (_dir)[Z] = 0.0; \ (_inv)[Z] = INFINITY; \ } \ }
Definition at line 805 of file vmath.h. Referenced by db_shader_mat(), nmg_isect_construct_nice_ray(), and rt_dsp_shot(). |
|
Value: { \ (o)[X] = (mat)[X]*(vec)[X]+(mat)[Y]*(vec)[Y] + (mat)[ 2]*(vec)[Z]; \ (o)[Y] = (mat)[4]*(vec)[X]+(mat)[5]*(vec)[Y] + (mat)[ 6]*(vec)[Z]; \ (o)[Z] = (mat)[8]*(vec)[X]+(mat)[9]*(vec)[Y] + (mat)[10]*(vec)[Z]; }
Definition at line 838 of file vmath.h. Referenced by rt_ebm_prep(), rt_ell_prep(), rt_eto_norm(), rt_pipe_norm(), rt_rec_prep(), rt_submodel_a_hit(), rt_submodel_shot(), rt_superell_prep(), rt_tor_norm(), and rt_vol_prep(). |
|
Value: { \ (o)[X] = (i)[X]*(m)[X] + (i)[Y]*(m)[4] + (i)[Z]*(m)[8]; \ (o)[Y] = (i)[X]*(m)[1] + (i)[Y]*(m)[5] + (i)[Z]*(m)[9]; \ (o)[Z] = (i)[X]*(m)[2] + (i)[Y]*(m)[6] + (i)[Z]*(m)[10]; }
|
|
Value: { \ (o)[X] = (mat)[0]*(vec)[X] + (mat)[Y]*(vec)[Y]; \ (o)[Y] = (mat)[4]*(vec)[X] + (mat)[5]*(vec)[Y]; \ (o)[Z] = (mat)[8]*(vec)[X] + (mat)[9]*(vec)[Y]; }
|
|
Value: { \ (o)[X] = (i)[X]*(m)[0] + (i)[Y]*(m)[4]; \ (o)[Y] = (i)[X]*(m)[1] + (i)[Y]*(m)[5]; \ (o)[Z] = (i)[X]*(m)[2] + (i)[Y]*(m)[6]; }
|
|
|
Value: { register double _f; \ _f = 1.0/((i)[X]*(m)[3] + (i)[Y]*(m)[7] + (i)[Z]*(m)[11] + (m)[15]);\ (o)[X]=((i)[X]*(m)[0] + (i)[Y]*(m)[4] + (i)[Z]*(m)[8] + (m)[12]) * _f;\ (o)[Y]=((i)[X]*(m)[1] + (i)[Y]*(m)[5] + (i)[Z]*(m)[9] + (m)[13]) * _f;\ (o)[Z]=((i)[X]*(m)[2] + (i)[Y]*(m)[6] + (i)[Z]*(m)[10] + (m)[14])* _f;}
|
|
Value: { \ (o)[X]=(m)[ 0]*(i)[X] + (m)[ 1]*(i)[Y] + (m)[ 2]*(i)[Z] + (m)[ 3]*(i)[H];\ (o)[Y]=(m)[ 4]*(i)[X] + (m)[ 5]*(i)[Y] + (m)[ 6]*(i)[Z] + (m)[ 7]*(i)[H];\ (o)[Z]=(m)[ 8]*(i)[X] + (m)[ 9]*(i)[Y] + (m)[10]*(i)[Z] + (m)[11]*(i)[H];\ (o)[H]=(m)[12]*(i)[X] + (m)[13]*(i)[Y] + (m)[14]*(i)[Z] + (m)[15]*(i)[H]; }
Definition at line 935 of file vmath.h. Referenced by rt_nmg_import_fastf(). |
|
|
Definition at line 967 of file vmath.h. Referenced by rt_submodel_a_hit(). |
|
Value: { register double _f; _f = 1.0/((m)[15]); \ (o)[X] = ((i)[X]*(m)[0] + (i)[Y]*(m)[4] + (i)[Z]*(m)[8]) * _f; \ (o)[Y] = ((i)[X]*(m)[1] + (i)[Y]*(m)[5] + (i)[Z]*(m)[9]) * _f; \ (o)[Z] = ((i)[X]*(m)[2] + (i)[Y]*(m)[6] + (i)[Z]*(m)[10]) * _f; }
|
|
Value: { register double _f; _f = 1.0/((m)[15]); \ (o)[X] = ((i)[X]*(m)[0] + (i)[Y]*(m)[4]) * _f; \ (o)[Y] = ((i)[X]*(m)[1] + (i)[Y]*(m)[5]) * _f; \ (o)[Z] = ((i)[X]*(m)[2] + (i)[Y]*(m)[6]) * _f; }
|
|
Test a vector for non-unit length.
|
|
Compare two vectors for EXACT equality. Use carefully.
Definition at line 989 of file vmath.h. Referenced by db_shader_mat(), nmg_cnurb_is_linear(), and rt_bot_vertex_fuse(). |
|
Value: ( \ NEAR_ZERO( (a)[X]-(b)[X], tol ) && \ NEAR_ZERO( (a)[Y]-(b)[Y], tol ) && \ NEAR_ZERO( (a)[Z]-(b)[Z], tol ) )
Definition at line 995 of file vmath.h. Referenced by dgo_qray_data_to_vlist(), and rt_ars_tess(). |
|
Value: Test for all elements of `v' being smaller than `tol'.
Definition at line 1001 of file vmath.h. Referenced by dgo_autoview(), dgo_get_autoview_cmd(), nmg_edge_g(), nmg_vlist_to_wire_edges(), rt_pipe_ck(), rt_pipe_plot(), rt_pipe_prep(), and rt_pipe_tess(). |
|
Macros to update min and max X,Y,Z values to contain a point.
Definition at line 1005 of file vmath.h. Referenced by make_bot_object(), rt_nurb_pbound(), and rt_part_uv(). |
|
Definition at line 1006 of file vmath.h. Referenced by dgo_autoview(), make_bot_object(), and rt_nurb_pbound(). |
|
Definition at line 1007 of file vmath.h. Referenced by dgo_autoview(), dgo_get_autoview_cmd(), nmg_face_bb(), nmg_faces_can_be_intersected(), nmg_isect_two_generic_faces(), nmg_region_a(), nmg_shell_a(), rt_bound_tree(), and rt_split_mostly_empty_cells(). |
|
Definition at line 1008 of file vmath.h. Referenced by dgo_autoview(), dgo_get_autoview_cmd(), nmg_face_bb(), nmg_region_a(), nmg_shell_a(), rt_bound_tree(), and rt_split_mostly_empty_cells(). |
|
Definition at line 1009 of file vmath.h. Referenced by fix_halfs(), nmg_loop_g(), nmg_shell_a(), rt_arb_setup(), rt_ars_prep(), rt_cline_prep(), rt_gettrees_muves(), rt_nmg_prep(), rt_nurb_c_bound(), rt_nurb_prep(), rt_nurb_s_bound(), rt_part_prep(), rt_pg_prep(), rt_pipe_tess(), and XGLUE(). |
|
Value: Divide out homogeneous parameter from hvect_t, creating vect_t.
Definition at line 1019 of file vmath.h. Referenced by rt_nurb_c_bound(), rt_nurb_crv_flat(), and rt_nurb_s_bound(). |
|
Some 2-D versions of the 3-D macros given above. A better naming convention is V2MOVE() rather than VMOVE_2D(). XXX These xxx_2D names are slated to go away, use the others. Definition at line 1031 of file vmath.h. Referenced by bn_isect_line2_lseg2(), and get_seg_midpoint(). |
|
Definition at line 1032 of file vmath.h. Referenced by bn_dist_line2_point2(), bn_dist_pt2_along_line2(), bn_dist_pt2_lseg2(), bn_distsq_line2_point2(), bn_isect_line2_line2(), bn_isect_pt2_lseg2(), bn_pt2_pt2_equal(), nmg_isect_edge2p_edge2p(), and nmg_isect_line2_edge2p(). |
|
Definition at line 1033 of file vmath.h. Referenced by bn_dist_line2_point2(), bn_dist_pt2_lseg2(), bn_distsq_line2_point2(), bn_isect_line2_line2(), bn_isect_line2_lseg2(), bn_isect_lseg2_lseg2(), bn_isect_pt2_lseg2(), bn_pt2_pt2_equal(), and classify_sketch_loops(). |
|
Definition at line 1034 of file vmath.h. Referenced by bn_dist_line2_point2(), bn_dist_pt2_along_line2(), bn_dist_pt2_lseg2(), bn_distsq_line2_point2(), and bn_isect_pt2_lseg2(). |
|
Definition at line 1035 of file vmath.h. Referenced by bn_isect_pt2_lseg2(), and get_seg_midpoint(). |
|
Definition at line 1036 of file vmath.h. Referenced by bn_isect_pt2_lseg2(), and get_seg_midpoint(). |
|
Definition at line 1037 of file vmath.h. Referenced by bn_isect_line2_line2(), and bn_isect_line2_lseg2(). |
|
Value: { \ register fastf_t _rot = (r) * 0.5; \ QSET(q, x, y, z, cos(_rot)); \ VUNITIZE(q); \ _rot = sin(_rot); /* _rot is really just a temp variable now */ \ VSCALE(q, q, _rot ); } To produce a quaternion representing a rotation by PI radians about X-axis: VSET(axis, 1, 0, 0); QUAT_FROM_VROT( quat, M_PI, axis); or QUAT_FROM_ROT( quat, M_PI, 1.0, 0.0, 0.0, 0.0 ); Alternatively, in degrees: QUAT_FROM_ROT_DEG( quat, 180.0, 1.0, 0.0, 0.0, 0.0 ); |
|
Value: |
|
|
|
|
|
Value: Set quaternion at `a' to have coordinates `b', `c', `d', `e'.
|
|
Value: Transfer quaternion at `b' to quaternion at `a'.
Definition at line 1095 of file vmath.h. Referenced by anim_quat2mat(), quat_make_nearest(), and quat_quat2mat(). |
|
Value: { \ (a)[X] = (b)[X] + (c)[X];\ (a)[Y] = (b)[Y] + (c)[Y];\ (a)[Z] = (b)[Z] + (c)[Z];\ (a)[W] = (b)[W] + (c)[W]; }
Definition at line 1102 of file vmath.h. Referenced by quat_bisect(). |
|
Value: { \ (a)[X] = (b)[X] - (c)[X];\ (a)[Y] = (b)[Y] - (c)[Y];\ (a)[Z] = (b)[Z] - (c)[Z];\ (a)[W] = (b)[W] - (c)[W]; }
Definition at line 1109 of file vmath.h. Referenced by quat_distance(), and quat_double(). |
|
Value: { \ (a)[X] = (b)[X] * (c);\ (a)[Y] = (b)[Y] * (c);\ (a)[Z] = (b)[Z] * (c);\ (a)[W] = (b)[W] * (c); }
Definition at line 1116 of file vmath.h. Referenced by quat_double(), and quat_make_nearest(). |
|
Value: {register double _f; _f = QMAGNITUDE(a); \ if( _f < VDIVIDE_TOL ) _f = 0.0; else _f = 1.0/_f; \ (a)[X] *= _f; (a)[Y] *= _f; (a)[Z] *= _f; (a)[W] *= _f; }
Definition at line 1123 of file vmath.h. Referenced by anim_quat2mat(), quat_bisect(), quat_double(), and quat_quat2mat(). |
|
Value: Return scalar magnitude squared of quaternion at `a'.
Definition at line 1128 of file vmath.h. Referenced by anim_mat2quat(). |
|
Return scalar magnitude of quaternion at `a'.
Definition at line 1132 of file vmath.h. Referenced by quat_distance(). |
|
Value: Compute dot product of quaternions at `a' and `b'.
Definition at line 1135 of file vmath.h. Referenced by quat_double(), and quat_slerp(). |
|
Value: { \ (a)[W] = (b)[W]*(c)[W] - (b)[X]*(c)[X] - (b)[Y]*(c)[Y] - (b)[Z]*(c)[Z]; \ (a)[X] = (b)[W]*(c)[X] + (b)[X]*(c)[W] + (b)[Y]*(c)[Z] - (b)[Z]*(c)[Y]; \ (a)[Y] = (b)[W]*(c)[Y] + (b)[Y]*(c)[W] + (b)[Z]*(c)[X] - (b)[X]*(c)[Z]; \ (a)[Z] = (b)[W]*(c)[Z] + (b)[Z]*(c)[W] + (b)[X]*(c)[Y] - (b)[Y]*(c)[X]; }
|
|
Value: Conjugate quaternion.
|
|
Value: { register double _f = QMAGSQ(b); \ if( _f < VDIVIDE_TOL ) _f = 0.0; else _f = 1.0/_f; \ (a)[X] = -(b)[X] * _f; \ (a)[Y] = -(b)[Y] * _f; \ (a)[Z] = -(b)[Z] * _f; \ (a)[W] = (b)[W] * _f; }
|
|
Value: { \ (a)[X] = (b) * (c)[X] + (d) * (e)[X];\ (a)[Y] = (b) * (c)[Y] + (d) * (e)[Y];\ (a)[Z] = (b) * (c)[Z] + (d) * (e)[Z];\ (a)[W] = (b) * (c)[W] + (d) * (e)[W]; }
Definition at line 1173 of file vmath.h. Referenced by quat_slerp(). |
|
Value: ( (_l1)[X] > (_h2)[X] || (_l1)[Y] > (_h2)[Y] || (_l1)[Z] > (_h2)[Z] || \ (_l2)[X] > (_h1)[X] || (_l2)[Y] > (_h1)[Y] || (_l2)[Z] > (_h1)[Z] )
Definition at line 1188 of file vmath.h. Referenced by rt_ck_overlap(). |
|
Value: (! ((_l1)[X] > (_h2)[X] || (_l1)[Y] > (_h2)[Y] || (_l1)[Z] > (_h2)[Z] || \ (_l2)[X] > (_h1)[X] || (_l2)[Y] > (_h1)[Y] || (_l2)[Z] > (_h1)[Z]) )
Definition at line 1193 of file vmath.h. Referenced by insert_in_bsp(), and nmg_isect_shell_self(). |
|
Value: (! ((_l1)[X] > (_h2)[X] + (_t)->dist || \ (_l1)[Y] > (_h2)[Y] + (_t)->dist || \ (_l1)[Z] > (_h2)[Z] + (_t)->dist || \ (_l2)[X] > (_h1)[X] + (_t)->dist || \ (_l2)[Y] > (_h1)[Y] + (_t)->dist || \ (_l2)[Z] > (_h1)[Z] + (_t)->dist ) )
Definition at line 1198 of file vmath.h. Referenced by nmg_crackshells(), nmg_isect_two_generic_faces(), and rt_ct_populate_box(). |
|
Value: ( \ (_pt)[X] >= (_lo)[X] && (_pt)[X] <= (_hi)[X] && \ (_pt)[Y] >= (_lo)[Y] && (_pt)[Y] <= (_hi)[Y] && \ (_pt)[Z] >= (_lo)[Z] && (_pt)[Z] <= (_hi)[Z] )
Definition at line 1207 of file vmath.h. Referenced by nmg_class_pt_fu_except(), and nmg_class_pt_lu_except(). |
|
Value: ( \ (_pt)[X] >= (_lo)[X]-(_t)->dist && (_pt)[X] <= (_hi)[X]+(_t)->dist && \ (_pt)[Y] >= (_lo)[Y]-(_t)->dist && (_pt)[Y] <= (_hi)[Y]+(_t)->dist && \ (_pt)[Z] >= (_lo)[Z]-(_t)->dist && (_pt)[Z] <= (_hi)[Z]+(_t)->dist )
Definition at line 1213 of file vmath.h. Referenced by nmg_class_pt_s(). |
|
Value: ( \ (_lo1)[X] >= (_lo2)[X] && (_hi1)[X] <= (_hi2)[X] && \ (_lo1)[Y] >= (_lo2)[Y] && (_hi1)[Y] <= (_hi2)[Y] && \ (_lo1)[Z] >= (_lo2)[Z] && (_hi1)[Z] <= (_hi2)[Z] )
Definition at line 1222 of file vmath.h. Referenced by nmg_classify_s_vs_s(). |
|
|
|
Definition at line 87 of file qmath.c. Referenced by quat_print(). |
|
4x4 matrix
|
|
|
|
3-tuple vector
|
|
|
|
3-tuple point
|
|
|
|
|
|
4-tuple vector
|
|
4-tuple point
|
|
Definition of a plane equation. A plane is defined by a unit-length outward pointing normal vector (N), and the perpendicular (shortest) distance from the origin to the plane (in element N[3]).
The plane consists of all points P=(x,y,z) such that
The inside of the halfspace bounded by the plane consists of all points P such that A ray with direction D is classified w.r.t. the plane by
|
|
Referenced by bn_math_cmd(), and dgo_get_eyemodel_cmd(). |
|
Referenced by bn_math_cmd(), vo_orientation_cmd(), and vo_pov_cmd(). |
|
Referenced by bn_quat_distance_wrapper(), and quat_make_nearest(). |
|
Referenced by bn_math_cmd(). |
|
Referenced by bn_math_cmd(). |
|
Referenced by bn_math_cmd(), and quat_sberp(). |
|
Referenced by bn_math_cmd(). |
|
Referenced by bn_math_cmd(). |
|
|
|
Referenced by bn_math_cmd(). |
|
Referenced by bn_math_cmd(). |
|
Convert Matrix to Quaternion. Q U A T _ M A T 2 Q U A T |
|
Convert Quaternion to Matrix. Q U A T _ Q U A T 2 M A T NB: This only works for UNIT quaternions. We may get imaginary results otherwise. We should normalize first (still yields same rotation). |
|
Gives the euclidean distance between two quaternions. Q U A T _ D I S T A N C E Definition at line 193 of file qmath.c. References QMAGNITUDE, QSUB2, and quat_t. |
|
Gives the quaternion point representing twice the rotation from q1 to q2. Needed for patching Bezier curves together. A rather poor name admittedly. Q U A T _ D O U B L E |
|
Gives the bisector of quaternions q1 and q2. (Could be done with quat_slerp and factor 0.5) [I believe they must be unit quaternions this to work]. Q U A T _ B I S E C T |
|
Do Spherical Linear Interpolation between two unit quaternions by the given factor. Q U A T _ S L E R P As f goes from 0 to 1, qout goes from q1 to q2. Code based on code by Ken Shoemake Definition at line 245 of file qmath.c. References PI, QBLEND2, QDOT, s1, s2, VBLEND2, W, X, Y, and Z. |
|
Spherical Bezier Interpolate between four quaternions by amount f. These are intended to be used as start and stop quaternions along with two control quaternions chosen to match spline segments with first order continuity. Q U A T _ S B E R P Uses the method of successive bisection. Definition at line 299 of file qmath.c. References quat_slerp(), and quat_t. Here is the call graph for this function: ![]() |
|
Set the quaternion q1 to the quaternion which yields the smallest rotation from q2 (of the two versions of q1 which produce the same orientation). Q U A T _ M A K E _ N E A R E S T Note that smallest euclidian distance implies smallest great circle distance as well (since surface is convex). Definition at line 327 of file qmath.c. References QMOVE, QSCALE, quat_distance(), and quat_t. Here is the call graph for this function: ![]() |
|
Q U A T _ P R I N T |
|
Exponentiate a quaternion, assuming that the scalar part is 0. Code by Ken Shoemake. Q U A T _ E X P Definition at line 371 of file qmath.c. References FAST, MAGNITUDE, VDIVIDE_TOL, VSCALE, and W. |
|
Take the natural logarithm of a unit quaternion. Code by Ken Shoemake. Q U A T _ L O G Definition at line 392 of file qmath.c. References FAST, MAGNITUDE, VDIVIDE_TOL, VSCALE, and W. |