polyhedron.h File Reference

Detailed Description

Definition of the Tpolyhedron type and the associated functions.

See Also
Tpolyhedron, polyhedron.c.

Definition in file polyhedron.h.

Data Structures

struct  Tpolyhedron
 A polyhedron. More...
 

Macros

#define NORMAL_SHAPE   0
 One of the possible type of shapes. More...
 
#define HIDDEN_SHAPE   1
 One of the possible type of shapes. More...
 
#define DECOR_SHAPE   2
 One of the possible type of shapes. More...
 
#define OFF   0
 One of the possible type of polyhedrons. More...
 
#define SPHERE   1
 One of the possible type of polyhedrons. More...
 
#define CYLINDER   2
 One of the possible type of polyhedrons. More...
 
#define LINE   3
 One of the possible type of polyhedrons. More...
 
#define SEGMENTS   4
 One of the possible type of polyhedrons. More...
 

Functions

void InitPolyhedronFromFile (Tfilename *fname, Tcolor *c, unsigned int gr, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void InitPolyhedronFromTriangles (unsigned int nv, double **v, unsigned int nt, unsigned int **t, Tcolor *c, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void NewBox (double xl, double yl, double zl, double xu, double yu, double zu, Tcolor *c, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void NewSphere (double r, double *center, Tcolor *c, unsigned int gr, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void NewCylinder (double r, double *p1, double *p2, Tcolor *c, unsigned int gr, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void NewLine (double *p1, double *p2, Tcolor *c, unsigned int bs, Tpolyhedron *p)
 Constructor. More...
 
void NewSegments (unsigned int n, double *x, double *y, double *z, Tcolor *c, Tpolyhedron *p)
 Constructor. More...
 
void CopyPolyhedron (Tpolyhedron *p_dst, Tpolyhedron *p_src)
 Copy constructor. More...
 
void TransformPolyhedron (THTransform *t, Tpolyhedron *p)
 Applies a homogenoeus transform to a polyhedron. More...
 
void GetPolyhedronCenter (double *c, Tpolyhedron *p)
 Gets the center of the spheres. More...
 
unsigned int GetPolyhedronType (Tpolyhedron *p)
 Retrives the type of a polyhedron. More...
 
void SetPolyhedronColor (Tcolor *c, Tpolyhedron *p)
 Changes the color of a polyhedron. More...
 
void GetPolyhedronColor (Tcolor *c, Tpolyhedron *p)
 Gets the color of a polyhedron. More...
 
unsigned int GetPolyhedronStatus (Tpolyhedron *p)
 Gets the status of a polyhedron (NORMAL, HIDDEN, DECOR). More...
 
void GetOFFInfo (unsigned int *nv, double ***v, unsigned int *nf, unsigned int **nvf, unsigned int ***fv, Tpolyhedron *p)
 Gets the OFF information. More...
 
unsigned int GetPolyhedronNVertex (Tpolyhedron *p)
 Gets the number of vertexes of a polyhedron. More...
 
void GetPolyhedronDefiningPoint (unsigned int i, double *point, Tpolyhedron *p)
 Gets a point defining a a object. More...
 
double GetPolyhedronRadius (Tpolyhedron *p)
 Returns the radius used in the definition of the object. More...
 
void GetPolyhedronVertex (unsigned int i, double *point, Tpolyhedron *p)
 Gets a vertex of a polyhedron. More...
 
double GetPolyhedronMaxCoordinate (Tpolyhedron *p)
 Returns the maximum coordinate value used in a polyhedron. More...
 
void PlotPolyhedron (Tplot3d *pt, Tpolyhedron *p)
 Adds the polyhedron to a 3D geometry. More...
 
void PolyhedronPrintCenter (FILE *f, THTransform *t, Tpolyhedron *p)
 Prints the center of a sphere to a file. More...
 
void PolyhedronPrintCenterAndCenter (FILE *f, THTransform *t, Tpolyhedron *p)
 Prints the center and the radius of a sphere to a file. More...
 
void MovePolyhedron (Tplot3d *pt, THTransform *t, Tpolyhedron *p)
 Moves an object previously added to a 3D scene. More...
 
void SavePolyhedron (char *fileName, Tpolyhedron *p)
 Stores the geometic information of a polyhedron into a file. More...
 
void PrintPolyhedron (FILE *f, char *path, char *label, unsigned int n, Tpolyhedron *p)
 Stores the polyhedron information into a file. More...
 
void DeletePolyhedron (Tpolyhedron *p)
 Destructor. More...
 

Macro Definition Documentation

#define NORMAL_SHAPE   0

One of the possible type of shapes. A normal shape is show and considered for collisions.

See Also
Tpolyhedron

Definition at line 28 of file polyhedron.h.

Referenced by InitWorldFromMolecule(), main(), and PrintPolyhedron().

#define HIDDEN_SHAPE   1

One of the possible type of shapes. A hiden shape is not show but it is considered for collisions.

See Also
Tpolyhedron

Definition at line 37 of file polyhedron.h.

Referenced by InitPolyhedronFromFile(), InitWorldFromMolecule(), main(), MovePolyhedron(), PlotPolyhedron(), PrintPolyhedron(), and VisibleLink().

#define DECOR_SHAPE   2

One of the possible type of shapes. A decor(ation) shape is show but it is not considered for collisions.

See Also
Tpolyhedron

Definition at line 46 of file polyhedron.h.

Referenced by AddBody2Link(), AddShape2Solid(), CheckAllCollisions(), InitPQPCD(), InitSolidCD(), InitVcollideCD(), InitWorldFromMolecule(), main(), NewSegments(), PrintPolyhedron(), and SolidCorrection().

#define OFF   0

One of the possible type of polyhedrons. An OFF is a general polyhedron defined by its vertices and its faces. This is a standard geomview construction.

See Also
Tpolyhedron

Definition at line 59 of file polyhedron.h.

Referenced by AddShape2Solid(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), InitPolyhedronFromTriangles(), NewBox(), PlotPolyhedron(), PrintPolyhedron(), ReadGeneralMesh(), ReadOFF(), ReadSTL(), SavePolyhedron(), and SolidCorrection().

#define SPHERE   1

One of the possible type of polyhedrons. An SPHERE is defined by a center (x,y,z) and a radius. This is a standard geomview construction.

See Also
Tpolyhedron

Definition at line 70 of file polyhedron.h.

Referenced by AddBody2Link(), AddShape2Solid(), GenerateSphereOFF(), GetPolyhedronCenter(), GetPolyhedronDefiningPoint(), LinkNAtoms(), NewSphere(), PlotPolyhedron(), PolyhedronPrintCenter(), PolyhedronPrintCenterAndCenter(), PrintPolyhedron(), ReadSphere(), SavePolyhedron(), SolidCorrection(), and WorldAtomJacobian().

#define CYLINDER   2

One of the possible type of polyhedrons. A CYLINDER is defined by two 3d points. This is not standard in geomview.

See Also
Tpolyhedron

Definition at line 80 of file polyhedron.h.

Referenced by AddShape2Solid(), GenerateCylinderOFF(), GetPolyhedronDefiningPoint(), NewCylinder(), PlotPolyhedron(), PrintPolyhedron(), ReadCylinder(), SavePolyhedron(), and SolidCorrection().

#define LINE   3

One of the possible type of polyhedrons. A LINE is defined by two 3d points. This is standard in geomview.

See Also
Tpolyhedron

Definition at line 90 of file polyhedron.h.

Referenced by AddShape2Solid(), GenerateCylinderOFF(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), NewLine(), PlotPolyhedron(), PrintPolyhedron(), ReadLine(), SavePolyhedron(), and SolidCorrection().

#define SEGMENTS   4

One of the possible type of polyhedrons. A set of SEGMENTS is defined by a set of pairs of 3d points. This is standard in geomview.

See Also
Tpolyhedron

Definition at line 100 of file polyhedron.h.

Referenced by AddShape2Solid(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), NewSegments(), PlotPolyhedron(), PrintPolyhedron(), ReadSegments(), SavePolyhedron(), and SolidCorrection().

Function Documentation

void InitPolyhedronFromFile ( Tfilename fname,
Tcolor c,
unsigned int  gr,
unsigned int  bs,
Tpolyhedron p 
)

Define a Tpolyhedron from a file.

The default geometry file used in the CuikSuite are an variant of the geomview OFF files. Originally, the OFF files only include polygonal geometry (vertices and faces). We extended it to include also spheres, cylinders, lines and sets of 3D segments.

Additionally, the CuikSuite can natively read binary STL files.

Finally, if the Assimp libary is available we can read any of the file types supported by this libary. This includes, for instance, collada or blender files. The full list of supported file types is here. All those file formats are converted to a general OFF structure (vertices and faces).

Parameters
fnameThe name of the file from where to read the information.
cThe color of the object.
grThe granularity to define polyhedrons for spheres and cylinders.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 727 of file polyhedron.c.

References Tpolyhedron::color, CopyColor(), Error(), GetFileExtension(), GetFileFullName(), HIDDEN_SHAPE, NEW, NewColor(), NO_UINT, Tpolyhedron::obj3d, ReadCylinder(), ReadGeneralMesh(), ReadLine(), ReadOFF(), ReadSegments(), ReadSphere(), ReadSTL(), and Tpolyhedron::status.

Referenced by main().

void InitPolyhedronFromTriangles ( unsigned int  nv,
double **  v,
unsigned int  nt,
unsigned int **  t,
Tcolor c,
unsigned int  bs,
Tpolyhedron p 
)

Defines an OFF object from a set of triangles.

Parameters
nvNumber of vertexes defining the triangulated surface.
vThe 3D vertexes defining the surface.
ntNumber of triangles.
tThe triangle vertexes (indices of the vertexes defining the triangles).
cThe color of the sphere.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 801 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), Tpolyhedron::fv, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, NO_UINT, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, Tpolyhedron::type, and Tpolyhedron::v.

void NewBox ( double  xl,
double  yl,
double  zl,
double  xu,
double  yu,
double  zu,
Tcolor c,
unsigned int  bs,
Tpolyhedron p 
)

Defines an axis aligned box. The box is actually defined as an OFF. So, this function is just a convenient way to define OFFs for this simple shape.

Parameters
xlThe lower coordinate along the X axis.
ylThe lower coordinate along the Y axis.
zlThe lower coordinate along the Z axis.
xuThe upper coordinate along the X axis.
yuThe upper coordinate along the Y axis.
zuThe upper coordinate along the Z axis.
cThe color of the sphere.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 857 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), Error(), Tpolyhedron::fv, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, NO_UINT, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by main().

void NewSphere ( double  r,
double *  center,
Tcolor c,
unsigned int  gr,
unsigned int  bs,
Tpolyhedron p 
)

Defines a sphere (and its polyhedric approximation for collision detection).

Parameters
rThe radius of the sphere.
centerThe center of the sphere.
cThe color of the sphere.
grThe granularity to define approximating polyhedrons for the sphere.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 926 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), GenerateSphereOFF(), NO_UINT, Tpolyhedron::obj3d, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, SPHERE, Tpolyhedron::status, and Tpolyhedron::type.

Referenced by InitWorldFromMolecule(), and main().

void NewCylinder ( double  r,
double *  p1,
double *  p2,
Tcolor c,
unsigned int  gr,
unsigned int  bs,
Tpolyhedron p 
)

Defines a cylinder (and its polyhedric approximation for collision detection).

Parameters
rThe radius of the cylinder.
p1The initial point of the cylinder axis.
p2The final point of the cylinder axis.
cThe color of the cylinder.
grThe granularity to define approximating polyhedrons for the cylinder.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 950 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), CYLINDER, GenerateCylinderOFF(), NO_UINT, Tpolyhedron::obj3d, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, and Tpolyhedron::type.

Referenced by InitWorldFromMolecule(), and main().

void NewLine ( double *  p1,
double *  p2,
Tcolor c,
unsigned int  bs,
Tpolyhedron p 
)

Defines a line.

Parameters
p1The initial point of the line.
p2The final point of the line.
cThe color of the line.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
pThe polyhedron to create.

Definition at line 977 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), GenerateCylinderOFF(), LINE, NO_UINT, Tpolyhedron::obj3d, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, and Tpolyhedron::type.

void NewSegments ( unsigned int  n,
double *  x,
double *  y,
double *  z,
Tcolor c,
Tpolyhedron p 
)

Defines a set of segments.

Parameters
nThe number of points defining the segmetns
xThe x components of the segmets (2 entries per segment).
yThe x components of the segmets (2 entries per segment).
zThe x components of the segmets (2 entries per segment).
cThe color of the set of segments.
pThe polyhedron to create.

Definition at line 1004 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), DECOR_SHAPE, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, NO_UINT, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, SEGMENTS, Tpolyhedron::status, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by InitWorldFromMolecule().

void CopyPolyhedron ( Tpolyhedron p_dst,
Tpolyhedron p_src 
)

Defines a polyhedron from another polyhedron.

Parameters
p_dstThe polyhedron to define.
p_srcThe polyhedron from where to copy.

Definition at line 1051 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), Tpolyhedron::fv, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by AddBody2Link(), and AddShape2Environment().

void TransformPolyhedron ( THTransform t,
Tpolyhedron p 
)

Applies a homogenoeus transform to a polyhedron.

Parameters
tThe transform to apply.
pThe polyhedron to transform.

Definition at line 1113 of file polyhedron.c.

References Tpolyhedron::center, HTransformApply(), HTransformIsIdentity(), Tpolyhedron::maxCoord, Tpolyhedron::nv, Tpolyhedron::p1, Tpolyhedron::p2, and Tpolyhedron::v.

Referenced by main().

void GetPolyhedronCenter ( double *  c,
Tpolyhedron p 
)

Gets the center of the spheres. When applied to other type of polyhedrons an error is triggered.

Parameters
c3D vector where to return the center.
pThe (sphere) polyhedron.

Definition at line 1145 of file polyhedron.c.

References Tpolyhedron::center, Error(), SPHERE, and Tpolyhedron::type.

Referenced by SolidCorrection(), and WorldAtomJacobian().

unsigned int GetPolyhedronType ( Tpolyhedron p)

Retrives the type of a polyhedron.

Parameters
pThe polyhedron to query.
Returns
The type of the polyhedron: OFF, SPHERE, CYLINDER, LINE, SEGMENTS.

Definition at line 1155 of file polyhedron.c.

References Tpolyhedron::type.

Referenced by AddBody2Link(), AddShape2Solid(), LinkNAtoms(), SolidCorrection(), and WorldAtomJacobian().

void SetPolyhedronColor ( Tcolor c,
Tpolyhedron p 
)

Changes the color of a polyhedron.

Parameters
cThe new color for the polyhedron.
pThe polyhedron to update.

Definition at line 1160 of file polyhedron.c.

References Tpolyhedron::color, and CopyColor().

void GetPolyhedronColor ( Tcolor c,
Tpolyhedron p 
)

Gets the color of a polyhedron.

Parameters
cThe color of the polyhedron.
pThe polyhedron to query.

Definition at line 1165 of file polyhedron.c.

References Tpolyhedron::color, and CopyColor().

Referenced by GetObstacleColor().

unsigned int GetPolyhedronStatus ( Tpolyhedron p)

Gets the status of a polyhedron (NORMAL, HIDDEN, DECOR).

Parameters
pThe polyhedron to query.
Returns
The status of a polyhedron.

Definition at line 1170 of file polyhedron.c.

References Tpolyhedron::status.

Referenced by AddBody2Link(), AddShape2Solid(), GetLinkBodyStatus(), GetObstacleShapeStatus(), SolidCorrection(), and VisibleLink().

void GetOFFInfo ( unsigned int *  nv,
double ***  v,
unsigned int *  nf,
unsigned int **  nvf,
unsigned int ***  fv,
Tpolyhedron p 
)

Returns the OFF information defining a shape (an OFF is the format for polyhedrons used in Geomview). Note that this can also be used for spheres and cylinders since they also have an OFF defined (a polygon approximating them).

This function returns pointers to the internal structures in the polyhedron. Use them with care (for query but without modifying them)

Parameters
nvNumber of vertexes in the OFF.
vVertexes defining the OFF.
nfNumber of faces in the OFF.
nvfNumber of vertexes for each face.
fvThe index of the vertexes for each face.
pThe polyhedron.

Definition at line 1175 of file polyhedron.c.

References Tpolyhedron::fv, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, and Tpolyhedron::v.

Referenced by AddShape2Solid(), InitPQPCD(), and InitVcollideCD().

unsigned int GetPolyhedronNVertex ( Tpolyhedron p)

Gets the number of vertexes of a polyhedron.

Parameters
pThe polyhedron to query.
Returns
The number of vertexes of a polyhedron.

Definition at line 1185 of file polyhedron.c.

References Tpolyhedron::nv.

void GetPolyhedronDefiningPoint ( unsigned int  i,
double *  point,
Tpolyhedron p 
)

Gets the coordinates of a point defining of a object.

A SEGMENTS is a set of segments defined by pairs of points. In this case one of the points defining the segment is returned.

A LINE is defined by two points: the initial and the end points of the cylinder.

A CYLINDER is defined by two points: the initial and the end points of the cylinder.

A SPHERE is defined by one point: the center of the sphere.

For OFFs, all vertexes are considered defining points.

If the polyhedron has less defining points than the requested number, this function triggers an error.

Parameters
iNumber of the defining point to retrive.
pointSpace to store the three coordinates of the requested vertex.
pThe polyhedron to query.

Definition at line 1190 of file polyhedron.c.

References Tpolyhedron::center, CYLINDER, Error(), GetPolyhedronVertex(), LINE, OFF, Tpolyhedron::p1, Tpolyhedron::p2, SEGMENTS, SPHERE, and Tpolyhedron::type.

Referenced by GetMechanismDefiningPoint(), and SolidCorrection().

double GetPolyhedronRadius ( Tpolyhedron p)

Returns the radius used in the definition of the object. This function is only defined for SPHEREs and CYLINDERs. It triggers an error if used on a OFF.

Parameters
pThe polyhedron to query.
Returns
The radius used in the object definition, if any.

Definition at line 1232 of file polyhedron.c.

References Error(), LINE, OFF, Tpolyhedron::rad, SEGMENTS, and Tpolyhedron::type.

Referenced by AddShape2Solid().

void GetPolyhedronVertex ( unsigned int  i,
double *  point,
Tpolyhedron p 
)

Gets the coordinates of the vertex of a polyhedron.

For cylinders and spheres point on the approximating OFF are returned.

If the polyhedron has less vertexes than the requested element, this function triggers an error.

Parameters
iNumber of the vertex to retrive.
pointSpace to store the three coordinates of the requested vertex.
pThe polyhedron to query.

Definition at line 1239 of file polyhedron.c.

References Error(), Tpolyhedron::nv, and Tpolyhedron::v.

Referenced by GetPolyhedronDefiningPoint().

double GetPolyhedronMaxCoordinate ( Tpolyhedron p)

Returns the maximum coordinate value (either in X, Y, or Z) used in a polyhedron. This is used in higher levels to define an over-estimate bounding-box of the mechanism. This bounding box is used to define the ranges for some of the coordinate and separating planes variables.

Parameters
pThe polyhedron to query.
Returns
The maximum coordinate value.

Definition at line 1250 of file polyhedron.c.

References Tpolyhedron::maxCoord.

Referenced by AddBody2Link(), and AddShape2Environment().

void PlotPolyhedron ( Tplot3d pt,
Tpolyhedron p 
)

Adds the polyhedron to a 3D geometry. Each object in a 3D scene gets an identifier that is stored in the polyhedron object for future reference.

Parameters
ptThe 3D geometry where to add the polyhedron.
pThe polyhedron to plot.

Definition at line 1255 of file polyhedron.c.

References Tpolyhedron::center, Close3dObject(), Tpolyhedron::color, CYLINDER, Tpolyhedron::fv, HIDDEN_SHAPE, LINE, Tpolyhedron::ne, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Plot3dObject(), PlotLine(), PlotSegments(), PlotSphere(), Tpolyhedron::rad, SEGMENTS, SPHERE, StartNew3dObject(), Tpolyhedron::status, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by PlotEnvironment(), and PlotLink().

void PolyhedronPrintCenter ( FILE *  f,
THTransform t,
Tpolyhedron p 
)

Prints the center of spheres to a file. Other types of polyhedrons are non considered (they are just skiped).

This is used only whent the world represents a molecule and we want to store the atom (i.e., the sphere) positions into a file.

This is also useful to get particular points from configurations of mechanisms (we just put a sphere on the point and then use cuiksamples2atoms to convert configurations to samples.

Note that the sphere centers are translated to gobal coordinates before printing them.

Parameters
fThe file where to store the sphere center.
tThe transform to get the global coordinates of the center.
pThe polyhedron to process.

Definition at line 1285 of file polyhedron.c.

References Tpolyhedron::center, HTransformApply(), SPHERE, and Tpolyhedron::type.

Referenced by LinkPrintAtoms().

void PolyhedronPrintCenterAndCenter ( FILE *  f,
THTransform t,
Tpolyhedron p 
)

Prints the center of spheres and the radius to a file. Other types of polyhedrons are non considered (they are just skiped).

This is an auxiliary function of LinkStoreAtoms.

Parameters
fThe file where to store the sphere center.
tThe transform to get the global coordinates of the center.
pThe polyhedron to process.

Definition at line 1297 of file polyhedron.c.

References Tpolyhedron::center, HTransformApply(), Tpolyhedron::rad, SPHERE, and Tpolyhedron::type.

Referenced by LinkStoreAtoms().

void MovePolyhedron ( Tplot3d pt,
THTransform t,
Tpolyhedron p 
)

Moves an object previously added to a 3D scene.

Parameters
ptThe 3D geometry where the polyhedron was added.
tThe homogeneous transform to apply to the polyhedron.
pThe polyhedron to move.

Definition at line 1309 of file polyhedron.c.

References HIDDEN_SHAPE, Move3dObject(), NO_UINT, Tpolyhedron::obj3d, and Tpolyhedron::status.

Referenced by MoveLinkFromTransform().

void SavePolyhedron ( char *  fileName,
Tpolyhedron p 
)

Stores the geometic information of a polyhedron into a file. Basically, it creates a file that can be latter read using InitPolyhedronFromFile

Parameters
fileNameName of the file where to store the geometric information.
pThe polyhedron to save.

Definition at line 1315 of file polyhedron.c.

References Tpolyhedron::center, CYLINDER, Error(), Tpolyhedron::fv, LINE, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, SEGMENTS, SPHERE, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by main(), and PrintPolyhedron().

void PrintPolyhedron ( FILE *  f,
char *  path,
char *  label,
unsigned int  n,
Tpolyhedron p 
)

Stores the polyhedron information into a file in the format valid to be read by InitWorldFromFile.

Spheres and cylinders are directly written, but OFFs are stored in a separate file.

Parameters
fThe file where to store the information.
pathThe working folder.
labelSting identifying the entity containing the polyhedron.
nIdentifier of the polyhedron in the link.
pThe polyhedron to save.

Definition at line 1366 of file polyhedron.c.

References Tpolyhedron::center, Tpolyhedron::color, CreateFileName(), CYLINDER, DECOR_SHAPE, DeleteFileName(), Error(), FALSE, GetBlue(), GetFileFullName(), GetGreen(), GetRed(), HIDDEN_SHAPE, LINE, NEW, NORMAL_SHAPE, Tpolyhedron::nv, OFF, OFF_EXT, Tpolyhedron::p1, Tpolyhedron::p2, Print3Reals(), Tpolyhedron::rad, SavePolyhedron(), SEGMENTS, SPHERE, Tpolyhedron::status, TRUE, Tpolyhedron::type, and Tpolyhedron::v.

Referenced by PrintEnvironment(), and PrintLink().

void DeletePolyhedron ( Tpolyhedron p)

Deletes the information stored in a Tpolyhedron and frees the allocated memory.

Parameters
pThe polyhedron to delete.

Definition at line 1484 of file polyhedron.c.

References Tpolyhedron::fv, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, and Tpolyhedron::v.

Referenced by DeleteEnvironment(), DeleteLink(), InitWorldFromMolecule(), and main().