Matrix/Vector/Quaternion Math
[libbn (numerical functions)]

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_tmatp_t
typedef fastf_t vect_t [ELEMENTS_PER_VECT]
 3-tuple vector
typedef fastf_tvectp_t
typedef fastf_t point_t [ELEMENTS_PER_PT]
 3-tuple point
typedef fastf_tpointp_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.

Define Documentation

#define VMATH_H   seen
 

Definition at line 92 of file vmath.h.

#define M_E   2.7182818284590452354
 

Definition at line 109 of file vmath.h.

#define M_LOG2E   1.4426950408889634074
 

Definition at line 110 of file vmath.h.

#define M_LOG10E   0.43429448190325182765
 

Definition at line 111 of file vmath.h.

#define M_LN2   0.69314718055994530942
 

Definition at line 112 of file vmath.h.

#define M_LN10   2.30258509299404568402
 

Definition at line 113 of file vmath.h.

#define M_PI   3.14159265358979323846
 

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().

#define M_PI_2   1.57079632679489661923
 

Definition at line 115 of file vmath.h.

#define M_PI_4   0.78539816339744830962
 

Definition at line 116 of file vmath.h.

#define M_1_PI   0.31830988618379067154
 

Definition at line 117 of file vmath.h.

#define M_2_PI   0.63661977236758134308
 

Definition at line 118 of file vmath.h.

#define M_2_SQRTPI   1.12837916709551257390
 

Definition at line 119 of file vmath.h.

#define M_SQRT2   1.41421356237309504880
 

Definition at line 120 of file vmath.h.

#define M_SQRT1_2   0.70710678118654752440
 

Definition at line 121 of file vmath.h.

Referenced by rt_nurb_plot().

#define M_SQRT2_DIV2   0.70710678118654752440
 

Definition at line 122 of file vmath.h.

#define PI   M_PI
 

Definition at line 125 of file vmath.h.

Referenced by quat_slerp().

#define VDIVIDE_TOL   ( 1.0e-20 )
 

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().

#define VUNITIZE_TOL   ( 1.0e-15 )
 

Definition at line 141 of file vmath.h.

Referenced by db_dirbuild().

#define ELEMENTS_PER_VECT   3
 

# 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().

#define ELEMENTS_PER_PT   3
 

Definition at line 147 of file vmath.h.

Referenced by nmg_vface(), and nmg_vlg().

#define HVECT_LEN   4
 

# of fastf_t's per hvect_t

Definition at line 149 of file vmath.h.

#define HPT_LEN   4
 

Definition at line 150 of file vmath.h.

#define ELEMENTS_PER_PLANE   4
 

# 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().

#define ELEMENTS_PER_MAT   (4*4)
 

Definition at line 154 of file vmath.h.

Referenced by rt_comb_export5(), rt_comb_import5(), rt_comb_v5_serialize(), and rt_dsp_export5().

#define quat_t   hvect_t
 

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().

#define NEAR_ZERO val,
epsilon   )     ( ((val) > -epsilon) && ((val) < epsilon) )
 

return truthfully whether a value is within some epsilon from zero

Definition at line 185 of file vmath.h.

Referenced by bend_pipe_shot(), bn_aet_vec(), bn_between(), bn_coplanar(), bn_cx_div(), bn_distsq_line3_line3(), bn_does_ray_isect_tri(), bn_eigen2x2(), bn_isect_line2_line2(), bn_isect_line3_line3(), bn_mat_ck(), bn_mat_is_equal(), bn_mat_scale_about_pt(), bn_mkpoint_3planes(), bn_poly_quadratic_roots(), bn_vec_ortho(), classify_seg(), db_dirbuild(), db_parse_1anim(), inverse_dir(), nmg_break_eg_on_v(), nmg_ck_v_in_2fus(), nmg_class_ray_vs_shell(), nmg_extrude_face(), nmg_extrude_shell(), nmg_find_eu_leftvec(), nmg_is_angle_in_wedge(), nmg_loop_is_ccw(), nmg_radial_join_eu(), nmg_shell_coplanar_face_merge(), nmg_snurb_is_planar(), nmg_to_tgc(), nmg_wedge_class(), pipe_end_shot(), pipe_start_shot(), rt_arb_add_pt(), rt_arc2d_to_cnurb(), rt_ars_shot(), rt_boolweave(), rt_cell_n_on_ray(), rt_cline_shot(), rt_dist_line3_line3(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_dda(), rt_ehy_export(), rt_ehy_export5(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_shot(), rt_ehy_tess(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_export(), rt_epa_export5(), rt_epa_plot(), rt_epa_prep(), rt_epa_shot(), rt_epa_tess(), rt_eto_plot(), rt_eto_prep(), rt_eto_shot(), rt_eto_tess(), rt_extrude_shot(), rt_grp_import(), rt_grp_import5(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_shot(), rt_hlf_xform(), rt_line_on_plane(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nmg_shot(), rt_nurb_add_hit(), rt_nurb_c_bound(), rt_nurb_c_check(), rt_nurb_kvnorm(), rt_nurb_s_bound(), rt_nurb_s_check(), rt_nurb_shot(), rt_nurb_uv_dist(), rt_part_shot(), rt_pg_shot(), rt_pipe_hitsort(), rt_pipe_plot(), rt_pipe_prep(), rt_poly_deflate(), rt_poly_roots(), rt_rec_prep(), rt_rec_shot(), rt_rec_vshot(), rt_rhc_export(), rt_rhc_export5(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_shot(), rt_rhc_tess(), rt_rpc_export(), rt_rpc_export5(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_shot(), rt_rpc_tess(), rt_seg_planeclip(), rt_shootray(), rt_shootray_bundle(), rt_sph_prep(), rt_superell_prep(), rt_superell_shot(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_vshot(), rt_tor_curve(), rt_tor_prep(), rt_tor_shot(), rt_vol_shot(), rt_weave0seg(), shoot_and_plot(), tesselate_pipe_end(), tesselate_pipe_start(), tp_3axis(), vo_size_cmd(), and vo_update().

#define CLAMP _v,
_l,
_h   )     if ((_v) < (_l)) _v = _l; else if ((_v) > (_h)) _v = _h
 

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().

#define DIST_PT_PLANE _pt,
_pl   )     (VDOT(_pt, _pl) - (_pl)[H])
 

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().

#define DIST_PT_PT a,
 ) 
 

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]) )
Compute distance between two points.

Definition at line 221 of file vmath.h.

#define X   0
 

Definition at line 227 of file vmath.h.

#define Y   1
 

Definition at line 228 of file vmath.h.

#define Z   2
 

Definition at line 229 of file vmath.h.

#define H   3
 

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().

#define W   H
 

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().

#define MDX   3
 

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().

#define MDY   7
 

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().

#define MDZ   11
 

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().

#define MAT_DELTAS m,
x,
y,
 ) 
 

Value:

{ \
                        (m)[MDX] = (x); \
                        (m)[MDY] = (y); \
                        (m)[MDZ] = (z); }
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().

#define MAT_DELTAS_VEC _m,
_v   )     MAT_DELTAS(_m, (_v)[X], (_v)[Y], (_v)[Z] )
 

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().

#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

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().

#define MAT_DELTAS_GET _v,
_m   ) 
 

Value:

{ \
                        (_v)[X] = (_m)[MDX]; \
                        (_v)[Y] = (_m)[MDY]; \
                        (_v)[Z] = (_m)[MDZ]; }
get translation values of 4x4 matrix to a vector

Definition at line 253 of file vmath.h.

#define MAT_DELTAS_GET_NEG _v,
_m   ) 
 

Value:

{ \
                        (_v)[X] = -(_m)[MDX]; \
                        (_v)[Y] = -(_m)[MDY]; \
                        (_v)[Z] = -(_m)[MDZ]; }
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().

#define MSX   0
 

Definition at line 265 of file vmath.h.

#define MSY   5
 

Definition at line 266 of file vmath.h.

#define MSZ   10
 

Definition at line 267 of file vmath.h.

#define MSA   15
 

Definition at line 268 of file vmath.h.

#define MAT_SCALE _m,
_x,
_y,
_z   ) 
 

Value:

{ \
        (_m)[MSX] = _x; \
        (_m)[MSY] = _y; \
        (_m)[MSZ] = _z; }
set scale of 4x4 matrix from xyz

Definition at line 271 of file vmath.h.

#define MAT_SCALE_VEC _m,
_v   ) 
 

Value:

{\
        (_m)[MSX] = (_v)[X]; \
        (_m)[MSY] = (_v)[Y]; \
        (_m)[MSZ] = (_v)[Z]; }
set scale of 4x4 matrix from vector

Definition at line 277 of file vmath.h.

Referenced by db_shader_mat().

#define MAT_SCALE_ALL _m,
_s   )     (_m)[MSA] = (_s)
 

set uniform scale of 4x4 matrix from scalar

Definition at line 283 of file vmath.h.

#define MAT_ZERO  ) 
 

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;}
zero a matrix

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().

#define MAT_IDN  ) 
 

Value:

{\
        (m)[1] = (m)[2] = (m)[3] = (m)[4] =\
        (m)[6] = (m)[7] = (m)[8] = (m)[9] = \
        (m)[11] = (m)[12] = (m)[13] = (m)[14] = 0.0;\
        (m)[0] = (m)[5] = (m)[10] = (m)[15] = 1.0;}
set matrix to identity

Definition at line 301 of file vmath.h.

Referenced by bn_decode_mat(), bn_mat_angles(), bn_mat_angles_rad(), bn_mat_arb_rot(), bn_mat_fromto(), bn_mat_lookat(), bn_mat_scale_about_pt(), bn_mat_xform_about_pt(), bn_vlist_3string(), db_apply_state_from_memb(), db_do_anim(), db_follow_path(), db_init_db_tree_state(), db_parse_1anim(), db_shader_mat(), dgo_autoview(), Do_copy_membs(), main(), nmg_vlblock_v(), PL_FORTRAN(), rt_bend_pipe_prep(), rt_dsp_import(), rt_dsp_make(), rt_ebm_import(), rt_ebm_import5(), rt_ebm_make(), rt_ehy_curve(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_curve(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_eto_prep(), rt_hf_to_dsp(), rt_linear_pipe_prep(), rt_part_prep(), rt_part_tess(), rt_process_uplot_value(), rt_rec_prep(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_sph_prep(), rt_superell_prep(), rt_tgc_curve(), rt_tgc_tnurb(), rt_tor_prep(), rt_vol_import(), rt_vol_import5(), tp_3axis(), tp_3marker(), tp_3symbol(), vo_open_cmd(), wdb_copyeval_cmd(), wdb_get_obj_bounds2(), wdb_ocenter_cmd(), wdb_orotate_cmd(), wdb_oscale_cmd(), wdb_otranslate_cmd(), and wdb_showmats_cmd().

#define MAT_COPY d,
 ) 
 

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]; }
copy a matrix

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().

#define VSET a,
b,
c,
d   ) 
 

Value:

{ \
                        (a)[X] = (b);\
                        (a)[Y] = (c);\
                        (a)[Z] = (d); }
Set vector at `a' to have coordinates `b', `c', `d'.

Definition at line 334 of file vmath.h.

Referenced by Add_vert(), Add_vert_and_norm(), anim_dir2mat(), anim_dirn2mat(), anim_steer_mat(), bn_aet_vec(), bn_eigen2x2(), bn_isect_2planes(), bn_mat_fromto(), bn_mat_lookat(), bn_vlist_2string(), bn_vlist_3string(), bn_vlist_rpp(), bu_hsv_to_rgb(), bu_str_to_rgb(), db_parse_1anim(), dgo_nirt_cmd(), dgo_qray_data_to_vlist(), do_grid(), dsp_pos(), nmg_calc_face_plane(), nmg_edge_g(), nmg_fcut_face_2d(), nmg_isect2d_prep(), nmg_loop_plane_area(), nmg_pr_fu_around_eu(), nmg_s_to_vlist(), nmg_snurb_is_planar(), PL_FORTRAN(), rt_arc2d_to_cnurb(), rt_bend_pipe_prep(), rt_bot_tcladjust(), rt_cell_n_on_ray(), rt_conv_uv(), rt_dsp_norm(), rt_dsp_plot(), rt_dsp_uv(), rt_ebm_plate(), rt_ebm_prep(), rt_ebm_shot(), rt_ebm_tess(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_tess(), rt_ell4(), rt_ell_ang(), rt_ell_prep(), rt_epa_norm(), rt_epa_plot(), rt_epa_tess(), rt_eto_curve(), rt_eto_norm(), rt_eto_prep(), rt_eto_uv(), rt_extrude_prep(), rt_hf_import(), rt_metaball_plot_sph(), rt_metaball_prep(), rt_mk_ell(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nurb_shot(), rt_part_plot(), rt_part_tess(), rt_pipe_norm(), rt_pipe_prep(), rt_process_uplot_value(), rt_rec_prep(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_shootray(), rt_shootray_bundle(), rt_superell_prep(), rt_tgc_prep(), rt_tgc_tnurb(), rt_tor_norm(), rt_tor_prep(), rt_tor_uv(), rt_vol_plot(), rt_vol_prep(), rt_vol_tess(), tp_2symbol(), tp_3axis(), tp_3marker(), tp_3symbol(), vo_eye_cmd(), vo_lookat_cmd(), vo_open_cmd(), vo_rot(), vo_update(), vo_viewDir_cmd(), and wdb_make_bb_cmd().

#define VSETALL a,
 )     { (a)[X] = (a)[Y] = (a)[Z] = (s); }
 

Set all elements of vector to same scalar value.

Definition at line 340 of file vmath.h.

Referenced by bn_cmd_noise_slice(), bn_math_cmd(), bn_vec_ortho(), bn_vec_perp(), bu_hsv_to_rgb(), dgo_autoview(), dgo_get_autoview_cmd(), fix_halfs(), nmg_fcut_face_2d(), nmg_get_interior_pt(), nmg_loop_g(), nmg_loop_plane_newell(), nmg_lu_to_vlist(), nmg_region_a(), nmg_s_to_vlist(), nmg_shell_a(), nmg_to_tgc(), rt_arb_centroid(), rt_arb_mk_planes(), rt_arbn_norm(), rt_ars_prep(), rt_ars_tcladjust(), rt_bound_tree(), rt_cline_prep(), rt_dsp_plot(), rt_ebm_dda(), rt_ebm_norm(), rt_ebm_prep(), rt_gettree_leaf(), rt_grp_prep(), rt_hf_import(), rt_hlf_norm(), rt_hlf_prep(), rt_metaball_get_bounding_sphere(), rt_metaball_norm(), rt_nmg_prep(), rt_part_import(), rt_part_import5(), rt_pipe_ck(), rt_pipe_tcladjust(), rt_prep_parallel(), rt_process_uplot_value(), rt_split_mostly_empty_cells(), rt_vol_import(), rt_vol_import5(), rt_vol_norm(), rt_vol_prep(), rt_vol_shot(), tesselate_pipe_bend(), vo_arot_cmd(), vo_open_cmd(), wdb_get_obj_bounds2(), and XGLUE().

#define VSETALLN v,
s,
 ) 
 

Value:

{\
        register int _j;\
        for (_j=0; _j<n; _j++) v[_j]=(s);}
Set all elements of N-vector to same scalar value.

Definition at line 343 of file vmath.h.

Referenced by nmg_snurb_calc_lu_uv_orient(), nmg_snurb_fu_eval(), and rt_arbn_tcladjust().

#define VMOVE a,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X];\
                        (a)[Y] = (b)[Y];\
                        (a)[Z] = (b)[Z]; }
Transfer vector at `b' to vector at `a'.

Definition at line 348 of file vmath.h.

Referenced by Add_vert(), anim_dir2mat(), anim_dirn2mat(), anim_steer_mat(), bn_dist_pt3_lseg3(), bn_isect_line3_plane(), bn_isect_pt_lseg(), bn_mat_ck(), bn_mat_fromto(), bn_vec_perp(), dgo_nirt_cmd(), dgo_qray_data_to_vlist(), draw_pipe_bend(), isect_line_earc(), isect_ray_planar_face(), linear_pipe_shot(), nmg_break_eg_on_v(), nmg_ck_eg_verts(), nmg_class_pt_lu_except(), nmg_class_pt_s(), nmg_classify_s_vs_s(), nmg_close_shell(), nmg_edge_collapse(), nmg_edge_g(), nmg_edge_g_cnurb(), nmg_edge_geom_isect_line(), nmg_edgeuse_on_line_tabulate(), nmg_eval_linear_trim_curve(), nmg_eval_trim_curve(), nmg_face_rs_init(), nmg_faces_can_be_intersected(), nmg_find_e_nearest_pt2(), nmg_find_eu_leftvec(), nmg_get_interior_pt(), nmg_isect_construct_nice_ray(), nmg_isect_eu_fu(), nmg_isect_two_generic_faces(), nmg_jeg(), nmg_loop_g(), nmg_loop_plane_area(), nmg_loop_plane_newell(), nmg_make_faces_at_vert(), nmg_move_edge_thru_pt(), nmg_pick_best_edge_g(), nmg_snurb_calc_lu_uv_orient(), nmg_snurb_fu_eval(), nmg_to_arb(), nmg_to_poly(), nmg_to_tgc(), nmg_use_edge_g(), nmg_uv_in_lu(), nmg_vertex_gv(), nmg_vertexuse_a_cnurb(), nmg_vertexuse_nv(), nmg_vlist_to_eu(), nmg_vlist_to_wire_edges(), quat_print(), rt_arb_add_pt(), rt_arb_edit(), rt_arb_norm(), rt_arbn_import(), rt_arbn_import5(), rt_arbn_norm(), rt_arc2d_to_cnurb(), rt_ars_export(), rt_ars_norm(), rt_ars_tcladjust(), rt_bend_pipe_prep(), rt_bot_plot_poly(), rt_bot_tess(), rt_bot_vertex_fuse(), rt_bound_tree(), rt_cell_n_on_ray(), rt_cline_prep(), rt_cline_shot(), rt_ct_box(), rt_cut_it(), rt_cut_one_axis(), rt_dist_pt3_line3(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_norm(), rt_ehy_export(), rt_ehy_export5(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell4(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_export(), rt_epa_export5(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_eto_curve(), rt_eto_plot(), rt_eto_prep(), rt_eto_tess(), rt_eto_uv(), rt_extrude_curve(), rt_extrude_prep(), rt_extrude_shot(), rt_extrude_xform(), rt_grp_export(), rt_grp_export5(), rt_grp_prep(), rt_hf_import(), rt_hf_norm(), rt_hf_prep(), rt_hf_shot(), rt_hlf_export(), rt_hlf_norm(), rt_hlf_prep(), rt_line_on_plane(), rt_linear_pipe_prep(), rt_metaball_prep(), rt_mk_ell(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nmg_edisk(), rt_nmg_shot(), rt_nurb_crv_flat(), rt_nurb_import5(), rt_nurb_mk_poly(), rt_nurb_norm(), rt_nurb_shot(), rt_part_prep(), rt_pg_export(), rt_pg_prep(), rt_pg_shot(), rt_pg_to_bot(), rt_pgface(), rt_pipe_norm(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_tess(), rt_process_uplot_value(), rt_raybundle_maker(), rt_rec_curve(), rt_rec_norm(), rt_rec_prep(), rt_rec_vshot(), rt_reprep(), rt_rhc_curve(), rt_rhc_export(), rt_rhc_export5(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_curve(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_shootray(), rt_shootray_bundle(), rt_sph_prep(), rt_superell_prep(), rt_tgc_norm(), rt_tgc_prep(), rt_tgc_tess(), rt_tgc_tnurb(), rt_tgc_vshot(), rt_tor_export(), rt_tor_export5(), rt_tor_prep(), rt_tor_tess(), rt_tor_vshot(), rt_vol_norm(), shoot_and_plot(), tesselate_pipe_bend(), tp_3axis(), vo_aet_cmd(), vo_eye_pos_cmd(), vo_pov_cmd(), wdb_get_obj_bounds2(), wdb_make_bb_cmd(), and XGLUE().

#define VMOVEN a,
b,
 ) 
 

Value:

{ register int _vmove; \
        for(_vmove = 0; _vmove < (n); _vmove++) \
                (a)[_vmove] = (b)[_vmove]; \
        }
Transfer vector of length `n' at `b' to vector at `a'.

Definition at line 354 of file vmath.h.

Referenced by dgo_nirt_cmd(), and rt_arc2d_to_cnurb().

#define HMOVE a,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X];\
                        (a)[Y] = (b)[Y];\
                        (a)[Z] = (b)[Z];\
                        (a)[W] = (b)[W]; }
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().

#define V2MOVE a,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X];\
                        (a)[Y] = (b)[Y]; }
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().

#define VREVERSE a,
 ) 
 

Value:

{ \
                        (a)[X] = -(b)[X]; \
                        (a)[Y] = -(b)[Y]; \
                        (a)[Z] = -(b)[Z]; }
Reverse the direction of vector b and store it in a.

Definition at line 375 of file vmath.h.

Referenced by bn_isect_2planes(), draw_pipe_bend(), isect_line_earc(), nmg_bad_face_normals(), nmg_classify_lu_lu(), nmg_face_rs_init(), nmg_fix_normals(), nmg_isect2d_prep(), nmg_isect_construct_nice_ray(), nmg_move_edge_thru_pt(), nmg_snurb_fu_get_norm(), rt_arb_add_pt(), rt_arb_uv(), rt_arc2d_to_cnurb(), rt_cline_norm(), rt_cline_prep(), rt_cline_shot(), rt_dsp_uv(), rt_ebm_norm(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_norm(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_extrude_norm(), rt_hf_norm(), rt_hf_shot(), rt_nurb_norm(), rt_pipe_norm(), rt_rec_norm(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_seg_planeclip(), rt_split_mostly_empty_cells(), rt_tgc_norm(), rt_tgc_prep(), rt_tor_import(), rt_vol_norm(), tesselate_pipe_linear(), wdb_get_obj_bounds2(), and XGLUE().

#define HREVERSE a,
 ) 
 

Value:

{ \
                        (a)[X] = -(b)[X]; \
                        (a)[Y] = -(b)[Y]; \
                        (a)[Z] = -(b)[Z]; \
                        (a)[W] = -(b)[W]; }
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().

#define VADD2 a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] + (c)[X];\
                        (a)[Y] = (b)[Y] + (c)[Y];\
                        (a)[Z] = (b)[Z] + (c)[Z]; }
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().

#define VADD2N a,
b,
c,
 ) 
 

Value:

{ register int _vadd2; \
        for(_vadd2 = 0; _vadd2 < (n); _vadd2++) \
                (a)[_vadd2] = (b)[_vadd2] + (c)[_vadd2]; \
        }
Add vectors of length `n' at `b' and `c', store result at `a'.

Definition at line 398 of file vmath.h.

Referenced by anim_quat2mat().

#define V2ADD2 a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] + (c)[X];\
                        (a)[Y] = (b)[Y] + (c)[Y];}

Definition at line 404 of file vmath.h.

#define VSUB2 a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] - (c)[X];\
                        (a)[Y] = (b)[Y] - (c)[Y];\
                        (a)[Z] = (b)[Z] - (c)[Z]; }
Subtract vector at `c' from vector at `b', store result at `a'.

Definition at line 412 of file vmath.h.

Referenced by bend_pipe_shot(), bn_3pts_collinear(), bn_3pts_distinct(), bn_dist_line3_pt3(), bn_dist_pt3_along_line3(), bn_dist_pt3_lseg3(), bn_dist_pt3_pt3(), bn_distsq_line3_line3(), bn_distsq_line3_pt3(), bn_distsq_pt3_lseg3(), bn_does_ray_isect_tri(), bn_isect_line3_line3(), bn_isect_line_lseg(), bn_isect_lseg_rpp(), bn_isect_pt_lseg(), bn_mk_plane_3pts(), bn_pt3_pt3_equal(), db_shader_mat(), dgo_autoview(), dgo_get_autoview_cmd(), dgo_nirt_cmd(), draw_pipe_arc(), draw_pipe_bend(), linear_pipe_shot(), nmg_assess_eu(), nmg_break_crossed_loops(), nmg_break_long_edges(), nmg_check_radial_angles(), nmg_ck_eg_verts(), nmg_class_pt_euvu(), nmg_class_pt_s(), nmg_cnurb_is_on_crv(), nmg_do_radial_join(), nmg_edge_collapse(), nmg_edge_g(), nmg_eu_2vecs_perp(), nmg_face_lu_plot(), nmg_face_rs_init(), nmg_faces_can_be_intersected(), nmg_find_eu_left_non_unit(), nmg_find_eu_leftvec(), nmg_find_pt_in_lu(), nmg_find_pt_in_shell(), nmg_find_top_face_in_dir(), nmg_fix_overlapping_loops(), nmg_insert_vu_if_on_edge(), nmg_intersect_loops_self(), nmg_isect_edge2p_edge2p(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_loop_plane_area(), nmg_lu_to_vlist(), nmg_move_edge_thru_pt(), nmg_offset_eu_vert(), nmg_pick_best_edge_g(), nmg_pl_e(), nmg_plot_lu_ray(), nmg_simplify_shell_edges(), nmg_snurb_fu_to_vlist(), nmg_split_linear_trim(), nmg_split_trim(), nmg_to_tgc(), nmg_vlblock_around_eu(), nmg_vlblock_e(), nmg_vlist_to_wire_edges(), nmg_vu_angle_measure(), pick_eu(), pipe_end_shot(), pipe_start_shot(), project_pt(), rt_arb_add_pt(), rt_arb_edit(), rt_arb_uv(), rt_arc2d_to_cnurb(), rt_ars_shot(), rt_ars_uv(), rt_bend_pipe_prep(), rt_bot_plot_poly(), rt_cline_prep(), rt_cline_shot(), rt_conv_uv(), rt_dist_line3_line3(), rt_dist_line3_lseg3(), rt_dist_pt3_line3(), rt_ebm_prep(), rt_ehy_shot(), rt_ehy_uv(), rt_ell_16pts(), rt_ell_norm(), rt_ell_shot(), rt_ell_uv(), rt_ell_vshot(), rt_epa_shot(), rt_epa_uv(), rt_eto_curve(), rt_eto_shot(), rt_eto_uv(), rt_extrude_curve(), rt_extrude_norm(), rt_extrude_shot(), rt_grp_plot(), rt_hf_uv(), rt_hlf_plot(), rt_hlf_uv(), rt_linear_pipe_prep(), rt_metaball_norm(), rt_metaball_point_value(), rt_metaball_shot(), rt_nurb_intersect(), rt_nurb_plot(), rt_part_curve(), rt_part_hemisphere(), rt_part_norm(), rt_part_shot(), rt_part_uv(), rt_pg_plot_poly(), rt_pg_shot(), rt_pg_to_bot(), rt_pgface(), rt_pipe_ck(), rt_pipe_norm(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_tess(), rt_prep_parallel(), rt_rec_curve(), rt_rec_prep(), rt_rec_shot(), rt_rec_uv(), rt_rec_vshot(), rt_rhc_shot(), rt_rhc_uv(), rt_rpc_shot(), rt_rpc_uv(), rt_smooth_bot(), rt_sph_norm(), rt_sph_shot(), rt_sph_uv(), rt_sph_vshot(), rt_submodel_prep(), rt_submodel_shot(), rt_superell_16pts(), rt_superell_norm(), rt_superell_shot(), rt_tcl_parse_ray(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_uv(), rt_tgc_vshot(), rt_tor_curve(), rt_tor_shot(), rt_tor_uv(), rt_tor_vshot(), rt_vol_prep(), seg_to_vlist(), tesselate_pipe_bend(), tesselate_pipe_linear(), tesselate_pipe_start(), tp_3axis(), tp_3vector(), vo_lookat_cmd(), vo_tra(), and wdb_ocenter_cmd().

#define VSUB2N a,
b,
c,
 ) 
 

Value:

{ register int _vsub2; \
        for(_vsub2 = 0; _vsub2 < (n); _vsub2++) \
                (a)[_vsub2] = (b)[_vsub2] - (c)[_vsub2]; \
        }
Subtract `n' length vector at `c' from vector at `b', store result at `a'.

Definition at line 419 of file vmath.h.

#define V2SUB2 a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] - (c)[X];\
                        (a)[Y] = (b)[Y] - (c)[Y];}

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().

#define VSUB3 a,
b,
c,
d   ) 
 

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]; }
Vectors: A = B - C - D.

Definition at line 433 of file vmath.h.

Referenced by rt_part_norm().

#define VSUB3N a,
b,
c,
d,
 ) 
 

Value:

{ register int _vsub3; \
        for(_vsub3 = 0; _vsub3 < (n); _vsub3++) \
                (a)[_vsub3] = (b)[_vsub3] - (c)[_vsub3] - (d)[_vsub3]; \
        }
Vectors: A = B - C - D for vectors of length `n'.

Definition at line 440 of file vmath.h.

#define VADD3 a,
b,
c,
d   ) 
 

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]; }
Add 3 vectors at `b', `c', and `d', store result at `a'.

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().

#define VADD3N a,
b,
c,
d,
 ) 
 

Value:

{ register int _vadd3; \
        for(_vadd3 = 0; _vadd3 < (n); _vadd3++) \
                (a)[_vadd3] = (b)[_vadd3] + (c)[_vadd3] + (d)[_vadd3]; \
        }
Add 3 vectors of length `n' at `b', `c', and `d', store result at `a'.

Definition at line 457 of file vmath.h.

#define VADD4 a,
b,
c,
d,
 ) 
 

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]; }
Add 4 vectors at `b', `c', `d', and `e', store result at `a'.

Definition at line 467 of file vmath.h.

#define VADD4N a,
b,
c,
d,
e,
 ) 
 

Value:

{ register int _vadd4; \
        for(_vadd4 = 0; _vadd4 < (n); _vadd4++) \
                (a)[_vadd4] = (b)[_vadd4] + (c)[_vadd4] + (d)[_vadd4] + (e)[_vadd4];\
        }
Add 4 `n' length vectors at `b', `c', `d', and `e', store result at `a'.

Definition at line 474 of file vmath.h.

#define VSCALE a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] * (c);\
                        (a)[Y] = (b)[Y] * (c);\
                        (a)[Z] = (b)[Z] * (c); }
Scale vector at `b' by scalar `c', store result at `a'.

Definition at line 484 of file vmath.h.

Referenced by bend_pipe_shot(), bn_distsq_line3_line3(), bn_isect_pt_lseg(), bn_mk_plane_3pts(), bn_rotate_plane(), db_shader_mat(), dgo_get_autoview_cmd(), dgo_nirt_cmd(), dgo_qray_data_to_vlist(), dgo_vnirt_cmd(), find_closest_face(), nmg_classify_lu_lu(), nmg_eu_2vecs_perp(), nmg_eval_linear_trim_curve(), nmg_eval_trim_curve(), nmg_faces_can_be_intersected(), nmg_get_interior_pt(), nmg_isect_eu_fu(), nmg_loop_plane_area(), nmg_lu_to_vlist(), nmg_move_edge_thru_pt(), nmg_plot_ray_face(), nmg_snurb_calc_lu_uv_orient(), nmg_snurb_fu_eval(), nmg_snurb_is_planar(), nmg_to_tgc(), quat_exp(), quat_log(), rt_arb_add_pt(), rt_arb_export(), rt_arb_export5(), rt_arbn_import(), rt_arbn_import5(), rt_arc2d_to_cnurb(), rt_ars_export(), rt_ars_export5(), rt_bend_pipe_prep(), rt_bot_describe(), rt_bot_export(), rt_bot_export5(), rt_cell_n_on_ray(), rt_cline_describe(), rt_cline_export(), rt_cline_export5(), rt_cline_plot(), rt_dist_line3_lseg3(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_prep(), rt_ehy_export(), rt_ehy_export5(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_describe(), rt_ell_export(), rt_ell_export5(), rt_ell_norm(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_export(), rt_epa_export5(), rt_epa_norm(), rt_epa_plot(), rt_epa_tess(), rt_eto_curve(), rt_eto_export(), rt_eto_export5(), rt_eto_prep(), rt_eto_shot(), rt_eto_uv(), rt_extrude_curve(), rt_extrude_describe(), rt_extrude_export(), rt_extrude_export5(), rt_extrude_shot(), rt_extrude_tcladjust(), rt_grp_export5(), rt_grp_import(), rt_grp_import5(), rt_grp_plot(), rt_hf_plot(), rt_hf_to_dsp(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_plot(), rt_hlf_prep(), rt_hlf_xform(), rt_linear_pipe_prep(), rt_metaball_export5(), rt_metaball_shot(), rt_nmg_edisk(), rt_nurb_intersect(), rt_part_export(), rt_part_export5(), rt_part_prep(), rt_pg_export(), rt_pipe_ck(), rt_pipe_export(), rt_pipe_export5(), rt_pipept_print(), rt_rec_prep(), rt_rhc_export(), rt_rhc_export5(), rt_rpc_export(), rt_rpc_export5(), rt_shootray(), rt_shootray_bundle(), rt_sketch_describe(), rt_sketch_export5(), rt_smooth_bot(), rt_sph_norm(), rt_sph_prep(), rt_submodel_prep(), rt_superell_describe(), rt_superell_export(), rt_superell_export5(), rt_superell_norm(), rt_superell_prep(), rt_superell_shot(), rt_tgc_describe(), rt_tgc_export(), rt_tgc_export5(), rt_tgc_shot(), rt_tgc_tess(), rt_tgc_vshot(), rt_tor_export(), rt_tor_export5(), rt_tor_import(), rt_tor_import5(), rt_tor_plot(), rt_tor_prep(), rt_tor_shot(), rt_tor_tess(), rt_tor_vshot(), rt_vls_pipept(), rt_vol_describe(), rt_vol_prep(), rt_xxx_export(), rt_xxx_export5(), seg_to_vlist(), tesselate_pipe_bend(), tesselate_pipe_linear(), tp_3axis(), tp_3vector(), vo_center(), vo_center_cmd(), vo_eye_cmd(), vo_eye_pos_cmd(), vo_keypoint_cmd(), vo_lookat_cmd(), vo_mrot_cmd(), vo_pov_cmd(), vo_rot_cmd(), vo_tra(), vo_vrot_cmd(), wdb_ocenter_cmd(), wdb_orotate_cmd(), wdb_oscale_cmd(), and wdb_otranslate_cmd().

#define HSCALE a,
b,
 ) 
 

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().

#define VSCALEN a,
b,
c,
 ) 
 

Value:

{ register int _vscale; \
        for(_vscale = 0; _vscale < (n); _vscale++) \
                (a)[_vscale] = (b)[_vscale] * (c); \
        }
Scale vector of length `n' at `b' by scalar `c', store result at `a'.

Definition at line 497 of file vmath.h.

Referenced by rt_arc2d_to_cnurb(), and rt_nmg_export_fastf().

#define V2SCALE a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] * (c);\
                        (a)[Y] = (b)[Y] * (c); }

Definition at line 503 of file vmath.h.

Referenced by classify_sketch_loops(), and rt_sketch_export5().

#define VUNITIZE  ) 
 

Value:

{ \
        register double _f = MAGSQ(a); \
        if ( ! NEAR_ZERO( _f-1.0, VUNITIZE_TOL ) ) { \
                _f = sqrt( _f ); \
                if( _f < VDIVIDE_TOL ) { VSETALL( (a), 0.0 ); } else { \
                        _f = 1.0/_f; \
                        (a)[X] *= _f; (a)[Y] *= _f; (a)[Z] *= _f; \
                } \
        } \
}
Normalize vector `a' to be a unit vector.

Definition at line 522 of file vmath.h.

Referenced by bend_pipe_shot(), bn_aet_vec(), bn_does_ray_isect_tri(), bn_eigen2x2(), bn_isect_2planes(), bn_isect_line2_line2(), bn_isect_line3_plane(), bn_mat_fromto(), dgo_nirt_cmd(), nmg_break_eg_on_v(), nmg_check_radial_angles(), nmg_ck_eg_verts(), nmg_class_pt_s(), nmg_class_ray_vs_shell(), nmg_edge_collapse(), nmg_face_rs_init(), nmg_find_eu_leftvec(), nmg_find_first_last_use_of_v_in_fu(), nmg_find_top_face_in_dir(), nmg_isect_construct_nice_ray(), nmg_jeg(), nmg_loop_plane_newell(), nmg_move_edge_thru_pt(), nmg_offset_eu_vert(), nmg_pick_best_edge_g(), nmg_to_tgc(), nmg_use_edge_g(), pick_eu(), pipe_end_shot(), quat_print(), rt_arb_add_pt(), rt_arb_uv(), rt_arbn_import(), rt_arbn_import5(), rt_arbn_tcladjust(), rt_arc2d_to_cnurb(), rt_bend_pipe_prep(), rt_bot_plot_poly(), rt_cline_norm(), rt_cline_plot(), rt_cline_prep(), rt_cline_tess(), rt_dist_pt3_line3(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ehy_curve(), rt_ehy_import(), rt_ehy_import5(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell4(), rt_ell_ang(), rt_ell_curve(), rt_ell_norms(), rt_epa_curve(), rt_epa_import(), rt_epa_import5(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_eto_curve(), rt_eto_norm(), rt_eto_plot(), rt_eto_prep(), rt_eto_shot(), rt_eto_tess(), rt_eto_uv(), rt_extrude_curve(), rt_extrude_norm(), rt_extrude_prep(), rt_extrude_tcladjust(), rt_grp_plot(), rt_hf_import(), rt_hf_norm(), rt_hf_prep(), rt_hf_to_dsp(), rt_hf_uv(), rt_hlf_plot(), rt_hlf_prep(), rt_line_on_plane(), rt_metaball_norm(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nurb_curvature(), rt_part_curve(), rt_part_norm(), rt_pg_plot_poly(), rt_pgface(), rt_pipe_norm(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_tess(), rt_rec_norm(), rt_rec_prep(), rt_rhc_export(), rt_rhc_export5(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_smooth_bot(), rt_superell_shot(), rt_tcl_parse_ray(), rt_tgc_curve(), rt_tgc_describe(), rt_tgc_norm(), rt_tgc_tnurb(), rt_tor_export(), rt_tor_import5(), rt_tor_norm(), rt_tor_shot(), rt_tor_tess(), rt_tor_uv(), rt_tor_vshot(), seg_to_vlist(), tesselate_pipe_bend(), tesselate_pipe_linear(), tesselate_pipe_start(), vo_arot_cmd(), vo_lookat_cmd(), and XGLUE().

#define VUNITIZE_RET a,
ret   ) 
 

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; }
If vector magnitude is too small, return an error code.

Definition at line 535 of file vmath.h.

#define VADD2SCALE o,
a,
b,
 ) 
 

Value:

{ \
                                        (o)[X] = ((a)[X] + (b)[X]) * (s); \
                                        (o)[Y] = ((a)[Y] + (b)[Y]) * (s); \
                                        (o)[Z] = ((a)[Z] + (b)[Z]) * (s); }
Find the sum of two points, and scale the result. Often used to find the midpoint.

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().

#define VADD2SCALEN o,
a,
b,
 ) 
 

Value:

{ register int _vadd2scale; \
        for( _vadd2scale = 0; _vadd2scale < (n); _vadd2scale++ ) \
                (o)[_vadd2scale] = ((a)[_vadd2scale] + (b)[_vadd2scale]) * (s); \
        }

Definition at line 554 of file vmath.h.

#define VSUB2SCALE o,
a,
b,
 ) 
 

Value:

{ \
                                        (o)[X] = ((a)[X] - (b)[X]) * (s); \
                                        (o)[Y] = ((a)[Y] - (b)[Y]) * (s); \
                                        (o)[Z] = ((a)[Z] - (b)[Z]) * (s); }
Find the difference between two points, and scale result. Often used to compute bounding sphere radius given rpp points.

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().

#define VSUB2SCALEN o,
a,
b,
 ) 
 

Value:

{ register int _vsub2scale; \
        for( _vsub2scale = 0; _vsub2scale < (n); _vsub2scale++ ) \
                (o)[_vsub2scale] = ((a)[_vsub2scale] - (b)[_vsub2scale]) * (s); \
        }

Definition at line 573 of file vmath.h.

#define VCOMB3 o,
a,
b,
c,
d,
e,
 ) 
 

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];}
Combine together several vectors, scaled by a scalar.

Definition at line 586 of file vmath.h.

#define VCOMB3N o,
a,
b,
c,
d,
e,
f,
 ) 
 

Value:

{\
        { register int _vcomb3; \
        for(_vcomb3 = 0; _vcomb3 < (n); _vcomb3++) \
                (o)[_vcomb3] = (a) * (b)[_vcomb3] + (c) * (d)[_vcomb3] + (e) * (f)[_vcomb3]; \
        } }

Definition at line 592 of file vmath.h.

#define VCOMB2 o,
a,
b,
c,
d   ) 
 

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().

#define VCOMB2N o,
a,
b,
c,
d,
 ) 
 

Value:

{\
        { register int _vcomb2; \
        for(_vcomb2 = 0; _vcomb2 < (n); _vcomb2++) \
                (o)[_vcomb2] = (a) * (b)[_vcomb2] + (c) * (d)[_vcomb2]; \
        } }

Definition at line 607 of file vmath.h.

#define VJOIN4 a,
b,
c,
d,
e,
f,
g,
h,
i,
 ) 
 

Value:

{ \
        (a)[X] = (b)[X] + (c)*(d)[X] + (e)*(f)[X] + (g)*(h)[X] + (i)*(j)[X];\
        (a)[Y] = (b)[Y] + (c)*(d)[Y] + (e)*(f)[Y] + (g)*(h)[Y] + (i)*(j)[Y];\
        (a)[Z] = (b)[Z] + (c)*(d)[Z] + (e)*(f)[Z] + (g)*(h)[Z] + (i)*(j)[Z]; }

Definition at line 613 of file vmath.h.

#define VJOIN3 a,
b,
c,
d,
e,
f,
g,
 ) 
 

Value:

{ \
        (a)[X] = (b)[X] + (c)*(d)[X] + (e)*(f)[X] + (g)*(h)[X];\
        (a)[Y] = (b)[Y] + (c)*(d)[Y] + (e)*(f)[Y] + (g)*(h)[Y];\
        (a)[Z] = (b)[Z] + (c)*(d)[Z] + (e)*(f)[Z] + (g)*(h)[Z]; }

Definition at line 618 of file vmath.h.

#define VJOIN2 a,
b,
c,
d,
e,
 ) 
 

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]; }
Compose vector at `a' of: Vector at `b' plus scalar `c' times vector at `d' plus scalar `e' times vector at `f'.

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().

#define VJOIN2N a,
b,
c,
d,
e,
f,
 ) 
 

Value:

{ register int _vjoin2; \
        for(_vjoin2 = 0; _vjoin2 < (n); _vjoin2++) \
                (a)[_vjoin2] = (b)[_vjoin2] + (c) * (d)[_vjoin2] + (e) * (f)[_vjoin2]; \
        }

Definition at line 637 of file vmath.h.

#define VJOIN1 a,
b,
c,
d   ) 
 

Value:

{ \
        (a)[X] = (b)[X] + (c) * (d)[X];\
        (a)[Y] = (b)[Y] + (c) * (d)[Y];\
        (a)[Z] = (b)[Z] + (c) * (d)[Z]; }

Definition at line 646 of file vmath.h.

Referenced by bend_pipe_shot(), bn_2line3_colinear(), bn_dist_pt3_lseg3(), bn_distsq_line3_line3(), bn_does_ray_isect_tri(), bn_isect_line3_line3(), bn_math_cmd(), classify_seg(), dgo_qray_data_to_vlist(), draw_linear_seg(), draw_pipe_bend(), isect_ray_lseg(), linear_pipe_shot(), nmg_break_crossed_loops(), nmg_ck_eg_verts(), nmg_face_lu_plot(), nmg_fix_overlapping_loops(), nmg_intersect_loops_self(), nmg_is_crack_outie(), nmg_isect_construct_nice_ray(), nmg_isect_edge2p_edge2p(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_isect_line2_edge2p(), nmg_lu_to_vlist(), nmg_move_edge_thru_pt(), nmg_pl_hitmiss_list(), nmg_plot_lu_ray(), nmg_snurb_fu_to_vlist(), nmg_vlblock_euleft(), pdv_3ray(), pipe_end_shot(), pipe_start_shot(), rt_3cont_raydist(), rt_3move_raydist(), rt_arb_add_pt(), rt_arb_move_edge(), rt_arb_norm(), rt_arb_uv(), rt_arbn_norm(), rt_ars_norm(), rt_boolweave(), rt_cline_norm(), rt_dist_line3_line3(), rt_dist_pt3_line3(), rt_dsp_norm(), rt_dsp_uv(), rt_ebm_dda(), rt_ebm_norm(), rt_ebm_shot(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_shot(), rt_ehy_tess(), rt_ell_norm(), rt_epa_norm(), rt_epa_plot(), rt_epa_prep(), rt_epa_shot(), rt_epa_tess(), rt_eto_norm(), rt_eto_plot(), rt_eto_tess(), rt_extrude_norm(), rt_extrude_shot(), rt_find_backing_dist(), rt_hf_norm(), rt_hf_plot(), rt_hlf_norm(), rt_metaball_norm(), rt_metaball_shot(), rt_nmg_norm(), rt_nurb_shot(), rt_part_norm(), rt_part_prep(), rt_pg_shot(), rt_pipe_norm(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_shot(), rt_pipe_tess(), rt_rec_norm(), rt_rec_shot(), rt_rec_vshot(), rt_rhc_norm(), rt_rhc_shot(), rt_rpc_norm(), rt_rpc_shot(), rt_shootray_bundle(), rt_sketch_norm(), rt_smooth_bot(), rt_sph_norm(), rt_submodel_a_hit(), rt_superell_norm(), rt_tgc_norm(), rt_tgc_shot(), rt_tor_norm(), rt_vol_norm(), rt_vol_shot(), rt_xxx_norm(), tesselate_pipe_linear(), tp_3axis(), vo_lookat_cmd(), and XGLUE().

#define VJOIN1N a,
b,
c,
d,
 ) 
 

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().

#define HJOIN1 a,
b,
c,
d   ) 
 

Value:

{ \
                        (a)[X] = (b)[X] + (c) * (d)[X]; \
                        (a)[Y] = (b)[Y] + (c) * (d)[Y]; \
                        (a)[Z] = (b)[Z] + (c) * (d)[Z]; \
                        (a)[W] = (b)[W] + (c) * (d)[W]; }

Definition at line 658 of file vmath.h.

#define V2JOIN1 a,
b,
c,
d   ) 
 

Value:

{ \
                        (a)[X] = (b)[X] + (c) * (d)[X];\
                        (a)[Y] = (b)[Y] + (c) * (d)[Y]; }

Definition at line 664 of file vmath.h.

Referenced by bn_dist_pt2_lseg2(), get_seg_midpoint(), isect_line_earc(), and seg_to_vlist().

#define VBLEND2 a,
b,
c,
d,
 ) 
 

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]; }
Blend into vector `a' scalar `b' times vector at `c' plus scalar `d' times vector at `e'.

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().

#define VBLEND2N a,
b,
c,
d,
e,
 ) 
 

Value:

{ register int _vblend2; \
        for(_vblend2 = 0; _vblend2 < (n); _vblend2++) \
                (a)[_vblend2] = (b) * (c)[_vblend2] + (d) * (e)[_vblend2]; \
        }

Definition at line 682 of file vmath.h.

#define MAGSQ  )     ( (a)[X]*(a)[X] + (a)[Y]*(a)[Y] + (a)[Z]*(a)[Z] )
 

Return scalar magnitude squared of vector at `a'.

Definition at line 689 of file vmath.h.

Referenced by bn_3pts_distinct(), bn_dist_line3_pt3(), bn_dist_pt3_lseg3(), bn_distsq_line3_line3(), bn_distsq_pt3_lseg3(), bn_isect_line3_line3(), bn_isect_line_lseg(), bn_isect_pt_lseg(), bn_mat_is_non_unif(), bn_mk_plane_3pts(), bn_pt3_pt3_equal(), nmg_assess_eu(), nmg_break_long_edges(), nmg_ck_eg_verts(), nmg_cnurb_is_on_crv(), nmg_faces_can_be_intersected(), nmg_find_eu_leftvec(), nmg_find_pt_in_lu(), nmg_find_pt_in_shell(), nmg_insert_vu_if_on_edge(), nmg_isect_eu_fu(), nmg_offset_eu_vert(), nmg_split_linear_trim(), nmg_split_trim(), nmg_to_tgc(), pipe_end_shot(), pipe_start_shot(), rt_cell_n_on_ray(), rt_dist_line3_line3(), rt_dist_pt3_line3(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_metaball_point_value(), rt_part_import(), rt_part_import5(), rt_part_prep(), rt_part_shot(), rt_rec_prep(), rt_rhc_prep(), rt_rpc_prep(), rt_shootray(), rt_shootray_bundle(), rt_sph_prep(), rt_sph_shot(), rt_sph_vshot(), rt_superell_prep(), and rt_tgc_prep().

#define MAG2SQ  )     ( (a)[X]*(a)[X] + (a)[Y]*(a)[Y] )
 

Definition at line 690 of file vmath.h.

Referenced by isect_2D_loop_ray(), and rt_extrude_curve().

#define MAGNITUDE  )     sqrt( MAGSQ( a ) )
 

Return scalar magnitude of vector at `a'.

Definition at line 693 of file vmath.h.

Referenced by anim_dirn2mat(), bn_2line3_colinear(), bn_3pts_collinear(), bn_dist_line3_pt3(), bn_dist_line_origin(), bn_dist_pt3_pt3(), bn_distsq_line3_line3(), bn_distsq_line3_pt3(), bn_isect_lseg3_lseg3(), bn_mk_plane_3pts(), draw_pipe_bend(), nmg_2edgeuse_g_coincident(), nmg_class_pt_s(), nmg_eu_2vecs_perp(), nmg_face_rs_init(), nmg_is_crack_outie(), nmg_is_eu_on_line3(), nmg_isect_eu_fu(), nmg_loop_plane_area(), nmg_lu_to_vlist(), nmg_move_edge_thru_pt(), nmg_plot_lu_ray(), nmg_snurb_fu_to_vlist(), nmg_snurb_is_planar(), nmg_vlblock_around_eu(), quat_exp(), quat_log(), rt_arb_add_pt(), rt_arb_edit(), rt_arb_setup(), rt_arc2d_to_cnurb(), rt_ars_uv(), rt_bend_pipe_prep(), rt_cline_norm(), rt_cline_prep(), rt_dist_line3_line3(), rt_dist_line3_lseg3(), rt_dsp_norm(), rt_dsp_prep(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_prep(), rt_ehy_describe(), rt_ehy_export(), rt_ehy_export5(), rt_ehy_norm(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_ang(), rt_ell_describe(), rt_ell_norm(), rt_epa_describe(), rt_epa_export(), rt_epa_export5(), rt_epa_norm(), rt_epa_plot(), rt_epa_tess(), rt_eto_curve(), rt_eto_describe(), rt_eto_export(), rt_eto_export5(), rt_eto_plot(), rt_eto_prep(), rt_eto_tess(), rt_extrude_prep(), rt_extrude_tcladjust(), rt_grp_import(), rt_grp_import5(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_xform(), rt_linear_pipe_prep(), rt_metaball_norm(), rt_nmg_prep(), rt_nurb_intersect(), rt_nurb_par_edge(), rt_nurb_plot(), rt_part_prep(), rt_part_uv(), rt_pg_to_bot(), rt_pgface(), rt_pipe_ck(), rt_pipe_tess(), rt_prep_parallel(), rt_rhc_describe(), rt_rhc_export(), rt_rhc_export5(), rt_rhc_plot(), rt_rhc_tess(), rt_rpc_describe(), rt_rpc_export(), rt_rpc_export5(), rt_rpc_plot(), rt_rpc_tess(), rt_submodel_prep(), rt_superell_describe(), rt_superell_norm(), rt_tgc_curve(), rt_tgc_describe(), rt_tgc_shot(), rt_tgc_tess(), rt_tgc_tnurb(), rt_tgc_vshot(), rt_tor_export(), rt_tor_import(), rt_tor_prep(), rt_vol_prep(), seg_to_vlist(), tesselate_pipe_bend(), tesselate_pipe_linear(), and tp_3vector().

#define VCROSS a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[Y] * (c)[Z] - (b)[Z] * (c)[Y];\
                        (a)[Y] = (b)[Z] * (c)[X] - (b)[X] * (c)[Z];\
                        (a)[Z] = (b)[X] * (c)[Y] - (b)[Y] * (c)[X]; }
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.

If the angle from `b' to `c' goes clockwise, then the result vector points "into" the plane (inward normal). Example: b=(0,1,0), c=(1,0,0), then bXc=(0,0,-1).

If the angle from `b' to `c' goes counter-clockwise, then the result vector points "out" of the plane. This outward pointing normal is the BRL convention.

Definition at line 709 of file vmath.h.

Referenced by bn_aet_vec(), bn_does_ray_isect_tri(), bn_isect_2planes(), bn_isect_line3_line3(), bn_mat_fromto(), bn_mk_plane_3pts(), bn_mkpoint_3planes(), bn_vec_perp(), isect_line_earc(), isect_ray_snurb_face(), nmg_check_radial_angles(), nmg_edge_collapse(), nmg_eu_2vecs_perp(), nmg_face_rs_init(), nmg_faces_can_be_intersected(), nmg_find_eu_left_non_unit(), nmg_find_eu_leftvec(), nmg_find_top_face_in_dir(), nmg_loop_plane_area(), nmg_move_edge_thru_pt(), nmg_offset_eu_vert(), nmg_to_tgc(), pipe_end_shot(), rt_arb_add_pt(), rt_arc2d_to_cnurb(), rt_ars_shot(), rt_bend_pipe_prep(), rt_bot_plot_poly(), rt_cline_norm(), rt_cline_plot(), rt_cline_tess(), rt_dsp_norm(), rt_ehy_curve(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell_curve(), rt_ell_norms(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_curve(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_eto_curve(), rt_eto_plot(), rt_eto_prep(), rt_eto_tess(), rt_extrude_curve(), rt_extrude_norm(), rt_extrude_prep(), rt_grp_plot(), rt_hf_plot(), rt_hf_prep(), rt_hf_to_dsp(), rt_hlf_plot(), rt_hlf_prep(), rt_linear_pipe_prep(), rt_nurb_curvature(), rt_nurb_shot(), rt_part_curve(), rt_part_prep(), rt_pg_plot_poly(), rt_pg_shot(), rt_pg_to_bot(), rt_pgface(), rt_pipe_ck(), rt_pipe_norm(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_tess(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_smooth_bot(), rt_tgc_curve(), rt_tgc_describe(), rt_tgc_prep(), rt_tgc_tess(), rt_tgc_tnurb(), rt_tor_export(), rt_tor_import(), rt_tor_import5(), rt_tor_prep(), seg_to_vlist(), tesselate_pipe_bend(), tesselate_pipe_start(), tp_3vector(), and XGLUE().

#define VDOT a,
 )     ( (a)[X]*(b)[X] + (a)[Y]*(b)[Y] + (a)[Z]*(b)[Z] )
 

Compute dot product of vectors at `a' and `b'.

Definition at line 715 of file vmath.h.

Referenced by Add_vert_and_norm(), bend_pipe_shot(), bn_2line3_colinear(), bn_3pts_collinear(), bn_aet_vec(), bn_angle_measure(), bn_coplanar(), bn_dist_line3_pt3(), bn_dist_line_origin(), bn_dist_pt3_along_line3(), bn_dist_pt3_lseg3(), bn_distsq_line3_line3(), bn_distsq_line3_pt3(), bn_distsq_pt3_lseg3(), bn_does_ray_isect_tri(), bn_isect_line2_line2(), bn_isect_line3_line3(), bn_isect_line3_plane(), bn_isect_pt_lseg(), bn_mat_ck(), bn_mat_fromto(), bn_mk_plane_3pts(), bn_mkpoint_3planes(), bn_rotate_plane(), draw_pipe_arc(), draw_pipe_bend(), isect_ray_snurb_face(), nmg_2edgeuse_g_coincident(), nmg_2lu_identical(), nmg_assess_eu(), nmg_bad_face_normals(), nmg_break_long_edges(), nmg_ck_eg_verts(), nmg_ck_lu_orientation(), nmg_class_pt_euvu(), nmg_classify_lu_lu(), nmg_complex_vertex_solve(), nmg_do_radial_join(), nmg_edge_collapse(), nmg_extrude_face(), nmg_faces_can_be_intersected(), nmg_find_eu_leftvec(), nmg_fix_normals(), nmg_insert_vu_if_on_edge(), nmg_is_eu_on_line3(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_isect_two_generic_faces(), nmg_jeg(), nmg_loop_is_ccw(), nmg_loop_plane_area(), nmg_loop_plane_newell(), nmg_lu_reorient(), nmg_move_edge_thru_pt(), nmg_pick_best_edge_g(), nmg_shell_coplanar_face_merge(), nmg_snurb_is_planar(), nmg_to_tgc(), nmg_two_face_fuse(), nmg_use_edge_g(), pick_eu(), pipe_end_shot(), pipe_start_shot(), rt_arb_add_pt(), rt_arb_shot(), rt_arb_uv(), rt_arbn_import(), rt_arbn_import5(), rt_arbn_plot(), rt_arbn_shot(), rt_arc2d_to_cnurb(), rt_ars_shot(), rt_ars_uv(), rt_cline_norm(), rt_cline_shot(), rt_conv_uv(), rt_dist_line3_line3(), rt_dist_line3_lseg3(), rt_dist_pt3_line3(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ehy_curve(), rt_ehy_export(), rt_ehy_export5(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell4(), rt_ell_ang(), rt_ell_curve(), rt_ell_prep(), rt_ell_shot(), rt_ell_tess(), rt_ell_tnurb(), rt_ell_vshot(), rt_epa_curve(), rt_epa_export(), rt_epa_export5(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_eto_curve(), rt_eto_plot(), rt_eto_prep(), rt_eto_shot(), rt_eto_tess(), rt_eto_uv(), rt_extrude_curve(), rt_extrude_norm(), rt_extrude_prep(), rt_extrude_shot(), rt_hf_prep(), rt_hf_shot(), rt_hf_uv(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_shot(), rt_hlf_uv(), rt_hlf_vshot(), rt_hlf_xform(), rt_line_on_plane(), rt_mk_hyperbola(), rt_mk_parabola(), rt_nurb_curvature(), rt_part_shot(), rt_pg_shot(), rt_pipe_ck(), rt_pipe_hitsort(), rt_pipe_plot(), rt_pipe_prep(), rt_pipe_tess(), rt_rec_curve(), rt_rec_prep(), rt_rhc_export(), rt_rhc_export5(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_export(), rt_rpc_export5(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_seg_planeclip(), rt_sph_prep(), rt_sph_shot(), rt_sph_vshot(), rt_submodel_a_hit(), rt_submodel_norm(), rt_submodel_shot(), rt_superell_prep(), rt_superell_shot(), rt_tgc_curve(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_tess(), rt_tgc_vshot(), rt_tor_import(), rt_tor_prep(), rt_tor_shot(), rt_tor_uv(), rt_tor_vshot(), tesselate_pipe_bend(), tp_3axis(), wdb_move_arb_face_cmd(), and XGLUE().

#define V2DOT a,
 )     ( (a)[X]*(b)[X] + (a)[Y]*(b)[Y] )
 

Definition at line 717 of file vmath.h.

Referenced by CrossingCount(), get_quadrant(), and isect_line2_ellipse().

#define VSUB2DOT _pt2,
_pt,
_vec   ) 
 

Value:

( \
        ((_pt2)[X] - (_pt)[X]) * (_vec)[X] + \
        ((_pt2)[Y] - (_pt)[Y]) * (_vec)[Y] + \
        ((_pt2)[Z] - (_pt)[Z]) * (_vec)[Z] )
Subtract two points to make a vector, dot with another vector.

Definition at line 720 of file vmath.h.

#define V2ARGS  )     (a)[X], (a)[Y]
 

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().

#define V3ARGS  )     (a)[X], (a)[Y], (a)[Z]
 

Definition at line 727 of file vmath.h.

Referenced by bn_dist_pt2_lseg2(), bn_dist_pt3_lseg3(), bn_distsq_pt3_lseg3(), bn_encode_vect(), bn_hlf_class(), bn_mat_fromto(), bn_math_cmd(), bu_hsv_to_rgb(), bu_tcl_hsv_to_rgb(), bu_tcl_rgb_to_hsv(), classify_seg(), db_parse_1anim(), db_shader_mat(), dgo_get_autoview_cmd(), dsp_pos(), isect_line2_ellipse(), isect_ray_planar_face(), main(), make_near_list(), nmg_break_long_edges(), nmg_ck_eg_verts(), nmg_ck_v_in_2fus(), nmg_ck_vert_on_fus(), nmg_class_lu_fu(), nmg_class_pt_euvu(), nmg_class_pt_fu_except(), nmg_class_pt_lu_except(), nmg_class_pt_s(), nmg_class_ray_vs_shell(), nmg_classify_pt_loop(), nmg_close_shell(), nmg_cnurb_lseg_coincident(), nmg_do_radial_join(), nmg_edge_collapse(), nmg_eu_radial_check(), nmg_eval_linear_trim_to_tol(), nmg_eval_trim_curve(), nmg_extrude_shell(), nmg_face_rs_init(), nmg_find_eu_leftvec(), nmg_find_first_last_use_of_v_in_fu(), nmg_find_top_face_in_dir(), nmg_fix_decomposed_shell_normals(), nmg_flatten_face(), nmg_follow_free_edges_to_vertex(), nmg_fu_planeeqn(), nmg_in_vert(), nmg_insert_vu_if_on_edge(), nmg_is_crack_outie(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_je(), nmg_loop_is_ccw(), nmg_make_dualvu(), nmg_make_faces_at_vert(), nmg_mesh_two_faces(), nmg_mk_model_from_region(), nmg_move_edge_thru_pt(), nmg_open_shells_connect(), nmg_pr_eg(), nmg_pr_eu_endpoints(), nmg_pr_vg(), nmg_pr_vu(), nmg_pr_vu_briefly(), nmg_pr_vua(), nmg_radial_join_eu(), nmg_radial_join_eu_NEW(), nmg_radial_mark_flips(), nmg_split_linear_trim(), nmg_triangulate_fu(), nmg_vertex_gv(), nmg_vertexuse_a_cnurb(), nmg_vertexuse_nv(), nmg_veu(), nmg_vface(), nmg_vu_angle_measure(), pdv_3cont(), pdv_3line(), pdv_3move(), pdv_3point(), pdv_3space(), pick_eu(), project_pt(), rt_arb_shot(), rt_ars_tclget(), rt_ars_tess(), rt_bot_tclget(), rt_cell_n_on_ray(), rt_ck_vlist(), rt_cline_norm(), rt_cline_tclget(), rt_comb_export5(), rt_comb_tclget(), rt_dist_line3_line3(), rt_dist_pt3_line3(), rt_dsp_norm(), rt_dsp_prep(), rt_dsp_shot(), rt_extrude_tclget(), rt_metaball_describe(), rt_nmg_tclget(), rt_nurb_intersect(), rt_pipe_ck(), rt_pipe_hitsort(), rt_pipe_shot(), rt_pipe_tclget(), rt_pipept_print(), rt_shootray(), rt_shootray_bundle(), rt_sketch_tclget(), rt_tcl_pr_cutter(), rt_tgc_shot(), rt_vls_pipept(), show_seg(), and tesselate_pipe_linear().

#define V4ARGS  )     (a)[X], (a)[Y], (a)[Z], (a)[W]
 

Definition at line 728 of file vmath.h.

Referenced by bn_encode_hvect(), bn_encode_quat(), bn_isect_planes(), dgo_get_eyemodel_cmd(), isect_ray_planar_face(), nmg_class_pt_fu_except(), nmg_class_pt_lu_except(), nmg_complex_vertex_solve(), nmg_cut_lu_into_coplanar_and_non(), nmg_face_g(), nmg_face_new_g(), nmg_loop_is_ccw(), nmg_pr_fg(), nmg_pr_fu_briefly(), nmg_simple_vertex_solve(), rt_arbn_tclget(), and rt_nurb_project_srf().

#define V2INTCLAMPARGS  )     INTCLAMP((a)[X]), INTCLAMP((a)[Y])
 

integer clamped versions of the previous arg macros

Definition at line 731 of file vmath.h.

Referenced by rt_sketch_describe().

#define V3INTCLAMPARGS  )     INTCLAMP((a)[X]), INTCLAMP((a)[Y]), INTCLAMP((a)[Z])
 

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().

#define V4INTCLAMPARGS  )     INTCLAMP((a)[X]), INTCLAMP((a)[Y]), INTCLAMP((a)[Z]), INTCLAMP((a)[W])
 

integer clamped versions of the previous arg macros

Definition at line 735 of file vmath.h.

#define V2PRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g)\n", a, V2ARGS(b) );
 

Print vector name and components on stderr.

Definition at line 738 of file vmath.h.

#define VPRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g, %g)\n", a, V3ARGS(b) );
 

Definition at line 740 of file vmath.h.

#define HPRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g, %g, %g)\n", a, V4ARGS(b) );
 

Definition at line 742 of file vmath.h.

#define V2INTCLAMPPRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g)\n", a, V2INTCLAMPARGS(b) );
 

integer clamped versions of the previous print macros

Definition at line 746 of file vmath.h.

#define VINTCLAMPPRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g, %g)\n", a, V3INTCLAMPARGS(b) );
 

Definition at line 748 of file vmath.h.

#define HINTCLAMPPRINT a,
 )     (void)fprintf(stderr,"%s (%g, %g, %g, %g)\n", a, V4INTCLAMPARGS(b) );
 

Definition at line 750 of file vmath.h.

#define INTCLAMP _a   )     ( NEAR_ZERO((_a) - rint(_a), VUNITIZE_TOL) ? rint(_a) : (_a) )
 

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().

#define VELMUL a,
b,
 ) 
 

Value:

{ \
        (a)[X] = (b)[X] * (c)[X];\
        (a)[Y] = (b)[Y] * (c)[Y];\
        (a)[Z] = (b)[Z] * (c)[Z]; }
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().

#define VELMUL3 a,
b,
c,
d   ) 
 

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 791 of file vmath.h.

#define VELDIV a,
b,
 ) 
 

Value:

{ \
        (a)[0] = (b)[0] / (c)[0];\
        (a)[1] = (b)[1] / (c)[1];\
        (a)[2] = (b)[2] / (c)[2]; }
Similar to VELMUL.

Definition at line 798 of file vmath.h.

#define VINVDIR _inv,
_dir   ) 
 

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; \
        } \
    }
Given a direction vector, compute the inverses of each element. When division by zero would have occured, mark inverse as INFINITY.

Definition at line 805 of file vmath.h.

Referenced by db_shader_mat(), nmg_isect_construct_nice_ray(), and rt_dsp_shot().

#define MAT3X3VEC o,
mat,
vec   ) 
 

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]; }
Apply the 3x3 part of a mat_t to a 3-tuple. This rotates a vector without scaling it (changing its length).

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().

#define VEC3X3MAT o,
i,
 ) 
 

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]; }
Multiply a 3-tuple by the 3x3 part of a mat_t.

Definition at line 854 of file vmath.h.

#define MAT3X2VEC o,
mat,
vec   ) 
 

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]; }
Apply the 3x3 part of a mat_t to a 2-tuple (Z part=0).

Definition at line 869 of file vmath.h.

#define VEC2X3MAT o,
i,
 ) 
 

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]; }
Multiply a 2-tuple (Z=0) by the 3x3 part of a mat_t.

Definition at line 883 of file vmath.h.

#define MAT4X3PNT o,
m,
 ) 
 

Value:

{ register double _f; \
        _f = 1.0/((m)[12]*(i)[X] + (m)[13]*(i)[Y] + (m)[14]*(i)[Z] + (m)[15]);\
        (o)[X]=((m)[0]*(i)[X] + (m)[1]*(i)[Y] + (m)[ 2]*(i)[Z] + (m)[3]) * _f;\
        (o)[Y]=((m)[4]*(i)[X] + (m)[5]*(i)[Y] + (m)[ 6]*(i)[Z] + (m)[7]) * _f;\
        (o)[Z]=((m)[8]*(i)[X] + (m)[9]*(i)[Y] + (m)[10]*(i)[Z] + (m)[11])* _f;}
Apply a 4x4 matrix to a 3-tuple which is an absolute Point in space.

Definition at line 908 of file vmath.h.

Referenced by bn_rotate_plane(), bn_vlist_3string(), dgo_nirt_cmd(), dgo_vnirt_cmd(), dsp_pos(), nmg_isect2d_prep(), nmg_isect_line2_face2pNEW(), nmg_snurb_is_planar(), rt_arb_import(), rt_arb_import5(), rt_arbn_import(), rt_arbn_import5(), rt_ars_import5(), rt_bot_find_v_nearest_pt2(), rt_bot_import(), rt_bot_import5(), rt_cline_import(), rt_cline_import5(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_plate(), rt_ebm_shot(), rt_ebm_tess(), rt_ehy_import(), rt_ehy_import5(), rt_ell_import(), rt_ell_import5(), rt_epa_import(), rt_epa_import5(), rt_eto_import(), rt_eto_import5(), rt_extrude_import(), rt_extrude_import5(), rt_extrude_shot(), rt_extrude_xform(), rt_grp_import(), rt_grp_import5(), rt_hf_import(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_xform(), rt_metaball_import5(), rt_nmg_idisk(), rt_nmg_import_fastf(), rt_nurb_import5(), rt_part_import(), rt_part_import5(), rt_pipe_import(), rt_pipe_import5(), rt_rhc_import(), rt_rhc_import5(), rt_rpc_import(), rt_rpc_import5(), rt_sketch_import(), rt_sketch_import5(), rt_submodel_shot(), rt_superell_import(), rt_superell_import5(), rt_tgc_import(), rt_tgc_import5(), rt_tor_import(), rt_tor_import5(), rt_vol_plate(), rt_vol_shot(), rt_vol_tess(), rt_xxx_import(), rt_xxx_import5(), tesselate_pipe_bend(), tp_3axis(), tp_3symbol(), vo_eye_cmd(), vo_lookat_cmd(), vo_m2vPoint_cmd(), vo_mrotPoint_cmd(), vo_rot(), vo_slew(), vo_tra(), vo_v2mPoint_cmd(), and vo_viewDir_cmd().

#define PNT3X4MAT o,
i,
 ) 
 

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;}
Multiply an Absolute 3-Point by a full 4x4 matrix.

Definition at line 917 of file vmath.h.

#define MAT4X4PNT o,
m,
 ) 
 

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]; }
Multiply an Absolute hvect_t 4-Point by a full 4x4 matrix.

Definition at line 935 of file vmath.h.

Referenced by rt_nmg_import_fastf().

#define MAT4X3VEC o,
m,
 ) 
 

Value:

{ register double _f;   _f = 1.0/((m)[15]);\
        (o)[X] = ((m)[0]*(i)[X] + (m)[1]*(i)[Y] + (m)[ 2]*(i)[Z]) * _f; \
        (o)[Y] = ((m)[4]*(i)[X] + (m)[5]*(i)[Y] + (m)[ 6]*(i)[Z]) * _f; \
        (o)[Z] = ((m)[8]*(i)[X] + (m)[9]*(i)[Y] + (m)[10]*(i)[Z]) * _f; }
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.

Definition at line 960 of file vmath.h.

Referenced by bend_pipe_shot(), bn_mat_ck(), bn_mat_fromto(), bn_mat_lookat(), bn_rotate_plane(), draw_pipe_bend(), linear_pipe_shot(), nmg_isect_line2_face2pNEW(), rt_arbn_import(), rt_arbn_import5(), rt_cline_import(), rt_cline_import5(), rt_dsp_norm(), rt_dsp_shot(), rt_dsp_uv(), rt_ebm_shot(), rt_ehy_curve(), rt_ehy_import(), rt_ehy_import5(), rt_ehy_norm(), rt_ehy_shot(), rt_ehy_uv(), rt_ell_curve(), rt_ell_import(), rt_ell_import5(), rt_ell_norm(), rt_ell_shot(), rt_ell_uv(), rt_ell_vshot(), rt_epa_curve(), rt_epa_import(), rt_epa_import5(), rt_epa_norm(), rt_epa_shot(), rt_epa_uv(), rt_eto_import(), rt_eto_import5(), rt_eto_shot(), rt_extrude_import(), rt_extrude_import5(), rt_extrude_norm(), rt_extrude_shot(), rt_extrude_xform(), rt_grp_import(), rt_grp_import5(), rt_hf_import(), rt_hlf_import(), rt_hlf_import5(), rt_hlf_xform(), rt_nmg_idisk(), rt_part_curve(), rt_part_import(), rt_part_import5(), rt_part_norm(), rt_part_shot(), rt_part_uv(), rt_pipe_norm(), rt_rec_norm(), rt_rec_shot(), rt_rec_uv(), rt_rec_vshot(), rt_rhc_import(), rt_rhc_import5(), rt_rhc_norm(), rt_rhc_plot(), rt_rhc_shot(), rt_rhc_tess(), rt_rhc_uv(), rt_rpc_import(), rt_rpc_import5(), rt_rpc_norm(), rt_rpc_plot(), rt_rpc_shot(), rt_rpc_tess(), rt_rpc_uv(), rt_sketch_import(), rt_sketch_import5(), rt_sph_uv(), rt_superell_import(), rt_superell_import5(), rt_superell_norm(), rt_superell_shot(), rt_tgc_curve(), rt_tgc_import(), rt_tgc_import5(), rt_tgc_norm(), rt_tgc_prep(), rt_tgc_shot(), rt_tgc_uv(), rt_tgc_vshot(), rt_tor_import(), rt_tor_import5(), rt_tor_shot(), rt_tor_uv(), rt_tor_vshot(), rt_vol_shot(), tesselate_pipe_bend(), tp_3axis(), and vo_update().

#define MAT4XSCALOR o,
m,
 )     {(o) = (i) / (m)[15];}
 

Definition at line 967 of file vmath.h.

Referenced by rt_submodel_a_hit().

#define VEC3X4MAT o,
i,
 ) 
 

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; }
Multiply a Relative 3-Vector by most of a 4x4 matrix.

Definition at line 971 of file vmath.h.

#define VEC2X4MAT o,
i,
 ) 
 

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; }
Multiply a Relative 2-Vector by most of a 4x4 matrix.

Definition at line 978 of file vmath.h.

#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.

Definition at line 985 of file vmath.h.

#define VEQUAL a,
 )     ((a)[X]==(b)[X] && (a)[Y]==(b)[Y] && (a)[Z]==(b)[Z])
 

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().

#define VAPPROXEQUAL a,
b,
tol   ) 
 

Value:

( \
        NEAR_ZERO( (a)[X]-(b)[X], tol ) && \
        NEAR_ZERO( (a)[Y]-(b)[Y], tol ) && \
        NEAR_ZERO( (a)[Z]-(b)[Z], tol ) )
Compare two vectors for approximate equality, within the specified absolute tolerance.

Definition at line 995 of file vmath.h.

Referenced by dgo_qray_data_to_vlist(), and rt_ars_tess().

#define VNEAR_ZERO v,
tol   ) 
 

Value:

( \
        NEAR_ZERO(v[X],tol) && NEAR_ZERO(v[Y],tol) && NEAR_ZERO(v[Z],tol)  )
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().

#define V_MIN r,
 )     if( (s) < (r) ) r = (s)
 

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().

#define V_MAX r,
 )     if( (s) > (r) ) r = (s)
 

Definition at line 1006 of file vmath.h.

Referenced by dgo_autoview(), make_bot_object(), and rt_nurb_pbound().

#define VMIN r,
 )     { V_MIN((r)[X],(s)[X]); V_MIN((r)[Y],(s)[Y]); V_MIN((r)[Z],(s)[Z]); }
 

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().

#define VMAX r,
 )     { V_MAX((r)[X],(s)[X]); V_MAX((r)[Y],(s)[Y]); V_MAX((r)[Z],(s)[Z]); }
 

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().

#define VMINMAX min,
max,
pt   )     { VMIN( (min), (pt) ); VMAX( (max), (pt) ); }
 

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().

#define HDIVIDE a,
 ) 
 

Value:

{ \
        (a)[X] = (b)[X] / (b)[H];\
        (a)[Y] = (b)[Y] / (b)[H];\
        (a)[Z] = (b)[Z] / (b)[H]; }
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().

#define VADD2_2D a,
b,
 )     V2ADD2(a,b,c)
 

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().

#define VSUB2_2D a,
b,
 )     V2SUB2(a,b,c)
 

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().

#define MAGSQ_2D  )     MAG2SQ(a)
 

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().

#define VDOT_2D a,
 )     V2DOT(a,b)
 

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().

#define VMOVE_2D a,
 )     V2MOVE(a,b)
 

Definition at line 1035 of file vmath.h.

Referenced by bn_isect_pt2_lseg2(), and get_seg_midpoint().

#define VSCALE_2D a,
b,
 )     V2SCALE(a,b,c)
 

Definition at line 1036 of file vmath.h.

Referenced by bn_isect_pt2_lseg2(), and get_seg_midpoint().

#define VJOIN1_2D a,
b,
c,
d   )     V2JOIN1(a,b,c,d)
 

Definition at line 1037 of file vmath.h.

Referenced by bn_isect_line2_line2(), and bn_isect_line2_lseg2().

#define QUAT_FROM_ROT q,
r,
x,
y,
 ) 
 

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 ); }
Quaternion math definitions.Create Quaternion from Vector and Rotation about vector.

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 );

Definition at line 1064 of file vmath.h.

#define QUAT_FROM_VROT q,
r,
 ) 
 

Value:

{ \
        register fastf_t _rot = (r) * 0.5; \
        VMOVE(q, v); \
        VUNITIZE(q); \
        (q)[W] = cos(_rot); \
        _rot = sin(_rot); /* _rot is really just a temp variable now */ \
        VSCALE(q, q, _rot ); }

Definition at line 1071 of file vmath.h.

#define QUAT_FROM_VROT_DEG q,
r,
 )     QUAT_FROM_VROT(q, ((r)*(M_PI/180.0)), v)
 

Definition at line 1079 of file vmath.h.

#define QUAT_FROM_ROT_DEG q,
r,
x,
y,
 )     QUAT_FROM_ROT(q, ((r)*(M_PI/180.0)), x, y, z)
 

Definition at line 1082 of file vmath.h.

#define QSET a,
b,
c,
d,
 ) 
 

Value:

{ \
                        (a)[X] = (b);\
                        (a)[Y] = (c);\
                        (a)[Z] = (d);\
                        (a)[W] = (e); }
Set quaternion at `a' to have coordinates `b', `c', `d', `e'.

Definition at line 1088 of file vmath.h.

#define QMOVE a,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X];\
                        (a)[Y] = (b)[Y];\
                        (a)[Z] = (b)[Z];\
                        (a)[W] = (b)[W]; }
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().

#define QADD2 a,
b,
 ) 
 

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]; }
Add quaternions at `b' and `c', store result at `a'.

Definition at line 1102 of file vmath.h.

Referenced by quat_bisect().

#define QSUB2 a,
b,
 ) 
 

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]; }
Subtract quaternion at `c' from quaternion at `b', store result at `a'.

Definition at line 1109 of file vmath.h.

Referenced by quat_distance(), and quat_double().

#define QSCALE a,
b,
 ) 
 

Value:

{ \
                        (a)[X] = (b)[X] * (c);\
                        (a)[Y] = (b)[Y] * (c);\
                        (a)[Z] = (b)[Z] * (c);\
                        (a)[W] = (b)[W] * (c); }
Scale quaternion at `b' by scalar `c', store result at `a'.

Definition at line 1116 of file vmath.h.

Referenced by quat_double(), and quat_make_nearest().

#define QUNITIZE  ) 
 

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; }
Normalize quaternion 'a' to be a unit quaternion.

Definition at line 1123 of file vmath.h.

Referenced by anim_quat2mat(), quat_bisect(), quat_double(), and quat_quat2mat().

#define QMAGSQ  ) 
 

Value:

( (a)[X]*(a)[X] + (a)[Y]*(a)[Y] \
                        + (a)[Z]*(a)[Z] + (a)[W]*(a)[W] )
Return scalar magnitude squared of quaternion at `a'.

Definition at line 1128 of file vmath.h.

Referenced by anim_mat2quat().

#define QMAGNITUDE  )     sqrt( QMAGSQ( a ) )
 

Return scalar magnitude of quaternion at `a'.

Definition at line 1132 of file vmath.h.

Referenced by quat_distance().

#define QDOT a,
 ) 
 

Value:

( (a)[X]*(b)[X] + (a)[Y]*(b)[Y] \
                        + (a)[Z]*(b)[Z] + (a)[W]*(b)[W] )
Compute dot product of quaternions at `a' and `b'.

Definition at line 1135 of file vmath.h.

Referenced by quat_double(), and quat_slerp().

#define QMUL a,
b,
 ) 
 

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]; }
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 );.

Definition at line 1144 of file vmath.h.

#define QCONJUGATE a,
 ) 
 

Value:

{ \
        (a)[X] = -(b)[X]; \
        (a)[Y] = -(b)[Y]; \
        (a)[Z] = -(b)[Z]; \
        (a)[W] =  (b)[W]; }
Conjugate quaternion.

Definition at line 1151 of file vmath.h.

#define QINVERSE a,
 ) 
 

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; }
Multiplicative inverse quaternion.

Definition at line 1158 of file vmath.h.

#define QBLEND2 a,
b,
c,
d,
 ) 
 

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]; }
Blend into quaternion `a' scalar `b' times quaternion at `c' plus scalar `d' times quaternion at `e'.

Definition at line 1173 of file vmath.h.

Referenced by quat_slerp().

#define V3RPP_DISJOINT _l1,
_h1,
_l2,
_h2   ) 
 

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] )
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.

Definition at line 1188 of file vmath.h.

Referenced by rt_ck_overlap().

#define V3RPP_OVERLAP _l1,
_h1,
_l2,
_h2   ) 
 

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]) )
Compare two extents represented as RPPs. If they overlap, return true.

Definition at line 1193 of file vmath.h.

Referenced by insert_in_bsp(), and nmg_isect_shell_self().

#define V3RPP_OVERLAP_TOL _l1,
_h1,
_l2,
_h2,
_t   ) 
 

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 ) )
If two extents overlap within distance tolerance, return true.

Definition at line 1198 of file vmath.h.

Referenced by nmg_crackshells(), nmg_isect_two_generic_faces(), and rt_ct_populate_box().

#define V3PT_IN_RPP _pt,
_lo,
_hi   ) 
 

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]  )
Is the point within or on the boundary of the RPP?

Definition at line 1207 of file vmath.h.

Referenced by nmg_class_pt_fu_except(), and nmg_class_pt_lu_except().

#define V3PT_IN_RPP_TOL _pt,
_lo,
_hi,
_t   ) 
 

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  )
Within the distance tolerance, is the point within the RPP?

Definition at line 1213 of file vmath.h.

Referenced by nmg_class_pt_s().

#define V3RPP1_IN_RPP2 _lo1,
_hi1,
_lo2,
_hi2   ) 
 

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] )
Determine if one bounding box is within another. Also returns true if the boxes are the same.

Definition at line 1222 of file vmath.h.

Referenced by nmg_classify_s_vs_s().

#define PI   3.14159265358979323264
 

Definition at line 85 of file qmath.c.

#define RTODEG   (180.0/PI)
 

Definition at line 87 of file qmath.c.

Referenced by quat_print().


Typedef Documentation

typedef fastf_t mat_t[ELEMENTS_PER_MAT]
 

4x4 matrix

Definition at line 160 of file vmath.h.

typedef fastf_t* matp_t
 

Definition at line 161 of file vmath.h.

typedef fastf_t vect_t[ELEMENTS_PER_VECT]
 

3-tuple vector

Definition at line 164 of file vmath.h.

typedef fastf_t* vectp_t
 

Definition at line 165 of file vmath.h.

typedef fastf_t point_t[ELEMENTS_PER_PT]
 

3-tuple point

Definition at line 168 of file vmath.h.

typedef fastf_t* pointp_t
 

Definition at line 169 of file vmath.h.

typedef fastf_t point2d_t[2]
 

Definition at line 171 of file vmath.h.

typedef fastf_t hvect_t[HVECT_LEN]
 

4-tuple vector

Definition at line 174 of file vmath.h.

typedef fastf_t hpoint_t[HPT_LEN]
 

4-tuple point

Definition at line 177 of file vmath.h.

typedef fastf_t plane_t[ELEMENTS_PER_PLANE]
 

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
VDOT(P,N) - N[3] == 0
that is,
N[X]*x + N[Y]*y + N[Z]*z - N[3] == 0

The inside of the halfspace bounded by the plane consists of all points P such that
VDOT(P,N) - N[3] <= 0

A ray with direction D is classified w.r.t. the plane by


VDOT(D,N) < 0 ray enters halfspace defined by plane
VDOT(D,N) == 0 ray is parallel to plane
VDOT(D,N) > 0 ray exits halfspace defined by plane

Definition at line 215 of file vmath.h.


Function Documentation

void quat_mat2quat hvect_t  quat,
const mat_t  mat
 

Referenced by bn_math_cmd(), and dgo_get_eyemodel_cmd().

void quat_quat2mat mat_t  mat,
const hvect_t  quat
 

Referenced by bn_math_cmd(), vo_orientation_cmd(), and vo_pov_cmd().

double quat_distance const hvect_t  q1,
const hvect_t  q2
 

Referenced by bn_quat_distance_wrapper(), and quat_make_nearest().

void quat_double hvect_t  qout,
const hvect_t  q1,
const hvect_t  q2
 

Referenced by bn_math_cmd().

void quat_bisect hvect_t  qout,
const hvect_t  q1,
const hvect_t  q2
 

Referenced by bn_math_cmd().

void quat_slerp hvect_t  qout,
const hvect_t  q1,
const hvect_t  q2,
double  f
 

Referenced by bn_math_cmd(), and quat_sberp().

void quat_sberp hvect_t  qout,
const hvect_t  q1,
const hvect_t  qa,
const hvect_t  qb,
const hvect_t  q2,
double  f
 

Referenced by bn_math_cmd().

void quat_make_nearest hvect_t  q1,
const hvect_t  q2
 

Referenced by bn_math_cmd().

void quat_print const char *  title,
const hvect_t  quat
 

void quat_exp hvect_t  out,
const hvect_t  in
 

Referenced by bn_math_cmd().

void quat_log hvect_t  out,
const hvect_t  in
 

Referenced by bn_math_cmd().

void quat_mat2quat register fastf_t quat,
register const fastf_t mat
 

Convert Matrix to Quaternion.

Q U A T _ M A T 2 Q U A T

Definition at line 95 of file qmath.c.

References FAST, MMM, W, X, XX, Y, YY, Z, and ZZ.

void quat_quat2mat register fastf_t mat,
register const fastf_t quat
 

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).

Definition at line 162 of file qmath.c.

References QMOVE, quat_t, QUNITIZE, W, X, Y, and Z.

double quat_distance const fastf_t q1,
const fastf_t q2
 

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.

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.

Q U A T _ D O U B L E

Definition at line 210 of file qmath.c.

References QDOT, QSCALE, QSUB2, quat_t, and QUNITIZE.

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].

Q U A T _ B I S E C T

Definition at line 229 of file qmath.c.

References QADD2, and QUNITIZE.

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.

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.

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.

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:

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).

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:

void quat_print const char *  title,
const fastf_t quat
 

Q U A T _ P R I N T

Definition at line 347 of file qmath.c.

References RTODEG, VMOVE, VUNITIZE, W, X, Y, and Z.

void quat_exp fastf_t out,
const fastf_t in
 

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.

void quat_log fastf_t out,
const fastf_t in
 

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.


Generated on Mon Sep 18 01:25:23 2006 for BRL-CAD by  doxygen 1.4.6