|
libt3d 2.6
|
Typedefs | |
| typedef enum T3DType | T3DType |
| Internal representation of a T3D. | |
| typedef enum T3DBryanIndex | T3DBryanIndex |
| Tait-Bryan angle names. | |
| typedef enum V3DVectorIndex | V3DVectorIndex |
| Vector index values. | |
Enumerations | |
| enum | T3DType { T3D_MATRIX , T3D_U_MATRIX , T3D_BRYAN , T3D_U_BRYAN , T3D_VECTOR , T3D_U_VECTOR } |
| Internal representation of a T3D. More... | |
| enum | T3DBryanIndex { T3D_BRYAN_YAW , T3D_BRYAN_PITCH , T3D_BRYAN_ROLL , T3D_BRYAN_X , T3D_BRYAN_Y , T3D_BRYAN_Z } |
| Tait-Bryan angle names. More... | |
| enum | V3DVectorIndex { V3D_VECTOR_X , V3D_VECTOR_Y , V3D_VECTOR_Z } |
| Vector index values. More... | |
Functions | |
| R3D * | r3dNew (T3DType type, int flags) |
| Malloc a new initialized structure for a R3D. | |
| R3D * | r3dDup (R3D *r3d) |
| Initialize a R3D with the type "type". | |
| void | r3dDelete (R3D *r3d) |
| Free an malloc'ed R3D. | |
| T3D * | r3dConvertToT3D (R3D *r3d) |
| Convert R3d to a generic T3D. | |
| R3D * | r3dConvertTo (T3DType typeTo, R3D *r3d) |
| Convert R3D to the "typeTo" representation. | |
| R3D * | r3dCopyIn (R3D *cpy, const R3D *src) |
| Copy R3D. | |
| R3D * | r3dInvert (R3D *r3d) |
| Invert T3D. | |
| R3D * | r3dComp (R3D *a, R3D *b) |
| Compose two R3D. | |
| R3D * | r3dCompIn (R3D *c, R3D *a, R3D *b) |
| Compose two R3D. | |
| int | r3dFPrint (FILE *stream, const R3D *r3d) |
| Output a ASCII R3D description on a stream. | |
| T3D * | t3dNew (T3DType type, int flags) |
| Malloc a new initialized structure for a tr3d. | |
| T3D * | t3dDup (T3D *t3d) |
| Initialize a T3D with the type "type". | |
| T3D * | t3dCopyIn (T3D *cpy, const T3D *src) |
| Copy T3D. | |
| T3D * | t3dInvert (T3D *t3d) |
| Invert a T3D. | |
| T3D * | t3dConvertTo (T3DType typeTo, T3D *t3d) |
| Convert t3d to the "typeTo" representation. | |
| T3D * | t3dComp (T3D *a, T3D *b) |
| Compose two T3D. | |
| T3D * | t3dCompIn (T3D *c, T3D *a, T3D *b) |
| Compose two T3D. | |
| int | t3dFPrint (FILE *stream, const T3D *t3d) |
| Output a ASCII T3D description on a stream. | |
| V3D * | v3dNew (void) |
| Malloc a new initialized structure for a V3D. | |
| void | v3dDelete (V3D *v3d) |
| Initialize a V3D. | |
| double | v3dNorm (const V3D *v3d) |
| Compute euclidian norm of a V3D. | |
| void | v3dNormalize (V3D *v3d) |
| Normalize a V3D. | |
| double * | v3dDotIn (double *c, const V3D *a, const V3D *b) |
| Apply T3D to a V3D. | |
| V3D * | v3dProdIn (V3D *c, const V3D *a, const V3D *b) |
| Vector product. | |
| int | v3dFPrint (FILE *stream, const V3D *v3d) |
| Output a ASCII V3D description on a stream. | |
Variables | |
| const R3D | r3dBryanIdentity |
| static initializer. | |
| const R3D | r3dUBryanIdentity |
| static initializer. | |
| const R3D | r3dVectorIdentity |
| static initializer. | |
| const R3D | r3dUVectorIdentity |
| static initializer. | |
| const R3D | r3dMatrixIdentity |
| static initializer. | |
| const R3D | r3dUMatrixIdentity |
| static initializer. | |
| const T3D | t3dBryanIdentity |
| static initializer. | |
| const T3D | t3dUBryanIdentity |
| static initializer. | |
| const T3D | t3dVectorIdentity |
| static initializer. | |
| const T3D | t3dUVectorIdentity |
| static initializer. | |
| const T3D | t3dMatrixIdentity |
| static initializer. | |
| const T3D | t3dUMatrixIdentity |
| static initializer. | |
| typedef enum T3DBryanIndex T3DBryanIndex |
Tait-Bryan angle names.
Use this enumerator with Tait-Bryan angle accessors.
| typedef enum V3DVectorIndex V3DVectorIndex |
Vector index values.
Use this enumerator with V3D coordinates accessors.
| enum T3DBryanIndex |
Tait-Bryan angle names.
Use this enumerator with Tait-Bryan angle accessors.
| enum T3DType |
Internal representation of a T3D.
This value can be supplied to t3dNew() or T3D() contstructor.
| enum V3DVectorIndex |
Vector index values.
Use this enumerator with V3D coordinates accessors.
| Enumerator | |
|---|---|
| V3D_VECTOR_X | X coordinate. |
| V3D_VECTOR_Y | Y coordinate. |
| V3D_VECTOR_Z | Z coordinate. |
Initialize a R3D with the type "type".
The size of the new structure is compatible with any type of representation except if the T3D_MINIMAL_SIZE flag is present (in this case the allocated size is minimal).
| [in] | r3d | Pointer to an allocated R3D. |
| [in] | type | Type of internal representation. |
| [in] | flags | Flags for special behaviors. |
R3D * r3dInit(R3D *r3d, T3DType type, int flags) { return (R3D *)t3dInit((T3D *)r3d, type, flags); }
/* — r3dDup -----------------------------------------------------—
Malloc a new structure for a R3D and initialize it with r3d
| [in] | r3d | R3D object to duplicate. |
| int r3dFPrint | ( | FILE * | stream, |
| const R3D * | r3d ) |
Invert T3D.
Invert T3D `a', store the result in c and return c. See t3Invert().
| [in] | t3d | T3D object. |
| [in] | inv | Where to store the inverse. |
T3D * t3dInvertIn(T3D *inv, T3D *t3d) { return t3dInvert(t3dCopyIn(inv, t3d)); }
/* — r3dInvert --------------------------------------------------—
Invert a R3D.
The R3D might be converted to another representation for doing this, and since not all conversion are possible, you might want to check errno. Note that the R3D is overwritten.
| [in] | r3d | R3D object. |
Malloc a new initialized structure for a R3D.
Calls r3dInit() with an malloc'ed structure. Storage must be released with r3dDelete().
| [in] | type | Type of internal representation. |
| [in] | flags | Flags for special behaviors. |
Compose two T3D.
Compose T3D a with T3D b, that is compute a T3D that is the combination of first applying a and then b. The result is stored in a and a is returned.
If a represents the transformation from a frame A to a frame X and b represents the transformation from a frame X to a frame B, the result of this fonction is a transformation from the frame A to the frame B. Or for short : t3Comp("A_2_X", "X_2_B") = "A_2_B".
Note that if T3D has an internal type of T3D_MATRIX, the result of this function is the product of matrix b by matrix a.
| [out] | a | First transformation. |
| [in] | b | Second transformation, applied after a. |
Convert t3d to the "typeTo" representation.
| [in] | typeTo | Type to convert to. |
| [in] | t3d | T3D object to convert. |
Initialize a T3D with the type "type".
The size of the new structure is compatible with any type of representation except if the T3D_MINIMAL_SIZE flag is present (in this case the allocated size is minimal).
| [in] | t3d | Pointer to an allocated T3D. |
| [in] | type | Type of internal representation. |
| [in] | flags | Flags for special behaviors. |
T3D * t3dInit(T3D *t3d, T3DType type, int flags) { if ((flags & T3D_MINIMAL_SIZE) && (flags & T3D_ALLOW_CONVERSION)) return t3dSetError(t3d, T3D_EBADFLAGS);
t3d->err = T3D_EBADTYPE; switch(type) { case T3D_MATRIX: t3dCopyIn(t3d, &t3dMatrixIdentity); break; case T3D_U_MATRIX: t3dCopyIn(t3d, &t3dUMatrixIdentity); break; case T3D_BRYAN: t3dCopyIn(t3d, &t3dBryanIdentity); break; case T3D_U_BRYAN: t3dCopyIn(t3d, &t3dUBryanIdentity); break; case T3D_VECTOR: t3dCopyIn(t3d, &t3dVectorIdentity); break; case T3D_U_VECTOR: t3dCopyIn(t3d, &t3dUVectorIdentity); break; } if (!t3dOk(t3d)) return NULL;
t3d->flags = flags; return t3d; }
/* t3dDup ------------------------------------------------------------—
Malloc a new structure for a tr3d and initialize it with t3d
| int t3dFPrint | ( | FILE * | stream, |
| const T3D * | t3d ) |
Malloc a new initialized structure for a tr3d.
Calls t3dInit() with an malloc'ed structure. Storage must be released with t3dDelete().
| [in] | type | Type of internal representation. |
| [in] | flags | Flags for special behaviors. |
| void v3dDelete | ( | V3D * | v3d | ) |
Initialize a V3D.
| [in] | v3d | Pointer to an allocated V3D. |
V3D * v3dInit(V3D *v3d) { v3d->v[0] = v3d->v[1] = v3d->v[2] = 0.; v3d->v[3] = 1.; return v3d; }
/* v3dDelete ---------------------------------------------------------—
Free an malloc'ed T3D.
| [in] | t3d | Transformation. |
| [in] | v3d | Vector to be transformed. |
V3D * v3dApplyT3D(T3D *t3d, V3D *v3d) { V3D tmp; double *c, *v; int i, j;
if (!t3dConvertTo(T3D_MATRIX, t3d)) return NULL;
c = t3d->matrix.matrix; for(i=0; i<4; i++) { tmp.v[i] = 0.; v = v3d->v; for(j=0; j<4; j++) tmp.v[i] += *c++ * *v++; }
v3d = tmp; return v3d; }
/* – v3dProd -----------------------------------------------------—
Vector product
| [in] | a | First vector |
| [in] | b | Second vector |
double v3dDot(const V3D *a, const V3D *b) { double r;
if (!v3dDotIn(&r, a, b)) return 0; return r; }
/* – v3dProdIn ---------------------------------------------------—
Vector product
| [out] | c | Resulting vector |
| [in] | a | First vector |
| [in] | b | Second vector |
| int v3dFPrint | ( | FILE * | stream, |
| const V3D * | v3d ) |
| V3D * v3dNew | ( | void | ) |
Malloc a new initialized structure for a V3D.
Calls v3dInit() with an malloc'ed structure. Storage must be released with v3dDelete().
| double v3dNorm | ( | const V3D * | v3d | ) |
Compute euclidian norm of a V3D.
| [in] | v3d | Input vector |
| void v3dNormalize | ( | V3D * | v3d | ) |
Vector product.
| [in] | a | First vector |
| [in] | b | Second vector |
V3D * v3dProd(V3D *a, const V3D *b) { V3D r;
if (!v3dProdIn(&r, a, b)) return NULL; a = r; return a; }
/* – v3dProdIn ---------------------------------------------------—
Vector product
| [out] | c | Resulting vector |
| [in] | a | First vector |
| [in] | b | Second vector |