Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

libvrmltree.h File Reference


Detailed Description

This file defines some constants used into libvrmltree sources and provides function declarations for this library.

The libvrmltree library was developed as a support library for the D.R.I.V.E. Project, requested by Politecnico di Milano and supervised by our tutor Timothy Barbieri. This library is designed for reusability in other simple project, however the library itself is not yet finished. The writing of a VRML97 parser was not required by the project, and it was developed only for the project purpose. So, it was written for best performance and expandibility, but it isn't usable at this moment for production systems. Use it at your own risk.

Go to the source code of this file.

Defines

#define LIBVRMLTREE_H   1 /**< Protect from reinclusion. */
 Protect from reinclusion.

#define MAXINSTANCE   500 /**< Maximum context instance of nesting groups.*/
 Maximum context instance of nesting groups.

#define NODE_ORDER_ERROR   3 /**< Error code: The nodes are specified in the wrong order in the VRML source.*/
 Error code: The nodes are specified in the wrong order in the VRML source.

#define MAX_INLINE_DEPTH   10 /**< Maximum inline depth. */
 Maximum inline depth.

#define INLINE_FOUND   1 /**< Inline found. Just for avoid magic numbers.*/
 Inline found.

#define INLINE_NOT_FOUND   0 /**< Inline not found. Just for avoid magic numbers.*/
 Inline not found.

#define OUTFILE   "mem-print.wrl" /**< Default name of the dump file generated by the --preprocess directive. @see D.R.I.V.E. user manual.*/
 Default name of the dump file generated by the --preprocess directive.


Typedefs

typedef float vector [4]
 An homogeneus vector.

typedef float vrmlMatrix [4][4]
 An homogeneus roto-translation matrix.


Functions

void vrmlinline (void)
nodecreateNode (char *, node_type)
void btf (void)
void initLexer (void)
void test (void *)
void analize (void)
vectormake_vector (sfvec3f)
 Transform an sfvec3f in an homogeneus vector.

vrmlMatrixmake_identity (void)
 Creates an identity matrix.

void negate (vrmlMatrix)
 Multiply the given matrix for -1.

void matrix_premul (vrmlMatrix, vrmlMatrix)
 premoltiplica origin con la matrice pre e salva in origin.

vrmlMatrixmake_rot_matrix (sfrotation)
 Transform a sfrotation in an homogeneus rotation matrix.

vrmlMatrixmake_scale_matrix (sfvec3f)
 transform a sfvec3f in a scale matrix.

vrmlMatrixmake_translation_matrix (sfvec3f)
 Transform a sfvec3f ina a translation matrix.

vrmlMatrixmake_transform_matrix (vrmlMatrix, vrmlMatrix, vrmlMatrix, vrmlMatrix, vrmlMatrix, vrmlMatrix)
 Generates the transformation matrix from given ones.

float det (vrmlMatrix)
 Return determinant of entire matrix.

float det_minor (vrmlMatrix, int, int, int, int, int, int)
 Return determinant of 3x3 submatrix by given row and column indices.

int mem_print ()
 Dump internal vrml scene into OUTFILE file.

int exploreout (node *what)
 Dump a branch of the vrml scene graph in the dump file.

int addchild (node *, node *)
 Adds a child to a node.

int tree_init (void)
 Initializes VRML Scene root.

nodemknode (void)
 Creates an empty node.

nodegetsymFromRoot (char *)
 Search the scene for an identifier.

nodegetsym (char *, node *)
 Search the scene for an identifier into the given context.

nodegenUse (node *)
 Generates a USE Node.

nodegetInline (node *)
 Search the scene for an Inline node.

nodelastin (node *)
 Gives the latest added node for the current context.

int cleanup_tree (void)
 cleanup the entire tree.

int cleanup (node *)
 Frees allocated memory for the given context.

char * strduplicate (char *)
 Duplicate a string.

int minus (int, int)
 The minor function.


Define Documentation

#define INLINE_FOUND   1 /**< Inline found. Just for avoid magic numbers.*/
 

Inline found.

Just for avoid magic numbers.

#define INLINE_NOT_FOUND   0 /**< Inline not found. Just for avoid magic numbers.*/
 

Inline not found.

Just for avoid magic numbers.

#define LIBVRMLTREE_H   1 /**< Protect from reinclusion. */
 

Protect from reinclusion.

#define MAX_INLINE_DEPTH   10 /**< Maximum inline depth. */
 

Maximum inline depth.

#define MAXINSTANCE   500 /**< Maximum context instance of nesting groups.*/
 

Maximum context instance of nesting groups.

#define NODE_ORDER_ERROR   3 /**< Error code: The nodes are specified in the wrong order in the VRML source.*/
 

Error code: The nodes are specified in the wrong order in the VRML source.

#define OUTFILE   "mem-print.wrl" /**< Default name of the dump file generated by the --preprocess directive. @see D.R.I.V.E. user manual.*/
 

Default name of the dump file generated by the --preprocess directive.

See also:
D.R.I.V.E. user manual.


Typedef Documentation

typedef float vector[4]
 

An homogeneus vector.

typedef float vrmlMatrix[4][4]
 

An homogeneus roto-translation matrix.


Function Documentation

int addchild node parent,
node children
 

Adds a child to a node.

Returns:
the number of brothers.
Parameters:
parent the node where add the child
children the node whom has to be added.

void analize void   ) 
 

void btf void   ) 
 

int cleanup node context  ) 
 

Frees allocated memory for the given context.

Note that this function is still in beta testing. It may cause a segfault if used over unchecked tree.

Parameters:
context the root node of the branch that must be freed.
Returns:
1 if no error occurred.

int cleanup_tree void   ) 
 

cleanup the entire tree.

Returns:
1 if no error occurred.
See also:
cleanup

Here is the call graph for this function:

node* createNode char *  ,
node_type 
 

float det vrmlMatrix  matrix  ) 
 

Return determinant of entire matrix.

Parameters:
matrix the matrix to work on.
Returns:
the determinant.

Here is the call graph for this function:

float det_minor vrmlMatrix  matrix,
int  r1,
int  r2,
int  r3,
int  c1,
int  c2,
int  c3
 

Return determinant of 3x3 submatrix by given row and column indices.

Parameters:
matrix the matrix to work on.
r1 row index.
r2 row index.
r3 row index.
c1 column index.
c2 column index.
c3 column index.
Returns:
the determinant.

int exploreout node what  ) 
 

Dump a branch of the vrml scene graph in the dump file.

Note that the dump file must be initialized before any call to this function. You can open the file by yourself and store it's descriptor in mem_out FILE* or use mem_print() function to dump the entire scene.

Parameters:
what the root node of the branch you want dump.
Returns:
0 if no errors occurred.

node* genUse node def  ) 
 

Generates a USE Node.

The USE node is created generating a new node with the same fields of the given node.

Parameters:
def the source node.
Returns:
a use instance of the given node.

Here is the call graph for this function:

node* getInline node context  ) 
 

Search the scene for an Inline node.

Parameters:
context the actual context.
Returns:
the first matching found. NULL if not found.

node* getsym char *  identifier,
node context
 

Search the scene for an identifier into the given context.

Parameters:
identifier the identifier to search.
context the context where to search the given identifier.
Returns:
the first matching found. NULL if not found.

node* getsymFromRoot char *  identifier  ) 
 

Search the scene for an identifier.

Parameters:
identifier the identifier to search.
Returns:
the first matching found. NULL if not found.

Here is the call graph for this function:

void initLexer void   ) 
 

node* lastin node begin  ) 
 

Gives the latest added node for the current context.

Returns:
the last child of the given context, NULL if the context is invalid.
Parameters:
begin the context node

vrmlMatrix* make_identity void   ) 
 

Creates an identity matrix.

Returns:
an identity vrmlMatrix.

vrmlMatrix* make_rot_matrix sfrotation  rot  ) 
 

Transform a sfrotation in an homogeneus rotation matrix.

Parameters:
rot an sfrotation.
Returns:
a corresponding vrmlMatrix.

vrmlMatrix* make_scale_matrix sfvec3f  scale  ) 
 

transform a sfvec3f in a scale matrix.

Parameters:
scale an sfvec3f
Returns:
a corresponding vrmlMatrix.

vrmlMatrix* make_transform_matrix vrmlMatrix  translation,
vrmlMatrix  rotation,
vrmlMatrix  scale,
vrmlMatrix  scaleOrientation,
vrmlMatrix  inverseScaleOrientation,
vrmlMatrix  center
 

Generates the transformation matrix from given ones.

Returns:
the resulting vrmlMatrix.
Parameters:
translation the translation matrix.
rotation the rotation matrix.
scale the scale matrix.
scaleOrientation the rotation that defines the sistem used by the scale matrix.
inverseScaleOrientation the inverse rotation of the one that defines the sistem used by the scale matrix.
center the transltion to the ccenter of rotation.

Here is the call graph for this function:

vrmlMatrix* make_translation_matrix sfvec3f  translation  ) 
 

Transform a sfvec3f ina a translation matrix.

Parameters:
translation an sfvec3f
Returns:
a corresponding vrmlMatrix

vector* make_vector sfvec3f  data  ) 
 

Transform an sfvec3f in an homogeneus vector.

Parameters:
data an sfvec3f.
Returns:
a corresponding vector.

void matrix_premul vrmlMatrix  ,
vrmlMatrix 
 

premoltiplica origin con la matrice pre e salva in origin.

Here is the call graph for this function:

int mem_print  ) 
 

Dump internal vrml scene into OUTFILE file.

Explore node* vp_root writing a vrml file with the scene stored in the internal tree.

See also:
libvrmltree.h documentation.

Here is the call graph for this function:

int minus int  a,
int  b
 

The minor function.

This function is required for a compatibilty problem of the minor template between win32 and linux.

Parameters:
a an integer
b another integer
Returns:
the minor integer between a and b.

node* mknode void   ) 
 

Creates an empty node.

Returns:
an empty node.

void negate vrmlMatrix  matrix  ) 
 

Multiply the given matrix for -1.

Parameters:
matrix the matrix.

char* strduplicate char *  origin  ) 
 

Duplicate a string.

Equivalent to strdup, but not specific for BSD or SVID.

Parameters:
origin the string to duplicate.
Returns:
the duplicate of the given string.

void test void *   ) 
 

int tree_init void   ) 
 

Initializes VRML Scene root.

Returns:
1 if no error occurred.

Here is the call graph for this function:

void vrmlinline void   ) 
 


SourceForge.net Logo

Generated on Mon Jun 14 17:25:56 2004 for D.R.I.V.E. by doxygen 1.3.7