polyhedron.c File Reference Detailed DescriptionImplementaton of the function operating on Tpolyhedron.
Definition in file polyhedron.c.
Function Documentation
Constructs a convex polyhedrom from a general mesh file via the assimp library.
Definition at line 231 of file polyhedron.c. References Error(), FALSE, Tpolyhedron::fv, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, OFF, TRUE, Tpolyhedron::type, and Tpolyhedron::v. Referenced by InitPolyhedronFromFile().
Constructs a convex polyhedrom from a binary STL file. The parsing of the STL file is done following the instructions given here.
Definition at line 287 of file polyhedron.c. References Distance(), Error(), FALSE, Tpolyhedron::fv, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, OFF, Tpolyhedron::type, and Tpolyhedron::v. Referenced by InitPolyhedronFromFile().
Constructs a convex polyhedrom from a file. This function is to be used when the heading of the file is already processed and the file includes for sure the definition of an OFF.
Definition at line 366 of file polyhedron.c. References Tpolyhedron::center, Error(), Tpolyhedron::fv, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::type, and Tpolyhedron::v. Referenced by InitPolyhedronFromFile().
Generates and OFF that approximates a cylinder. This polyhedric approximation is the one used int collision detection. Note that only the vertexes of the OFFS are generates (no face information is created) since for collision detection only the vertexes of the convex polyhedrons are used.
Definition at line 422 of file polyhedron.c. References CYLINDER, Error(), Tpolyhedron::fv, HTransformApply(), HTransformDelete(), HTransformX2Vect(), LINE, M_2PI, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::type, and Tpolyhedron::v. Referenced by NewCylinder(), NewLine(), ReadCylinder(), and ReadLine().
Constructs a convex polyhedrom from a file. This function is to be used when the heading of the file is already processed and the file includes for sure the definition of an LINE.
Definition at line 508 of file polyhedron.c. References Tpolyhedron::center, GenerateCylinderOFF(), LINE, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, and Tpolyhedron::type. Referenced by InitPolyhedronFromFile().
Constructs a convex polyhedrom from a file. This function is to be used when the heading of the file is already processed and the file includes for sure the definition of an SEGMENT.
Definition at line 529 of file polyhedron.c. References Tpolyhedron::center, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, SEGMENTS, Tpolyhedron::type, and Tpolyhedron::v. Referenced by InitPolyhedronFromFile().
Constructs a convex polyhedrom from a file. This function is to be used when the heading of the file is already processed and the file includes for sure the definition of an CYLINDER.
Definition at line 572 of file polyhedron.c. References Tpolyhedron::center, CYLINDER, GenerateCylinderOFF(), Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, and Tpolyhedron::type. Referenced by InitPolyhedronFromFile().
Generates and OFF that approximates a sphere. This polyhedric approximation is the one used int collision detection. Note that only the vertexes of the OFFS are generates (no face information is created) since for collision detection only the vertexes of the convex polyhedrons are used.
Definition at line 593 of file polyhedron.c. References Tpolyhedron::center, Error(), Tpolyhedron::fv, HTransformApply(), HTransformDelete(), HTransformProduct(), HTransformRz(), HTransformTxyz(), M_2PI, M_PI, M_PI_2, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::rad, SPHERE, Tpolyhedron::type, and Tpolyhedron::v. Referenced by NewSphere(), and ReadSphere().
Constructs a convex polyhedrom from a file. This function is to be used when the heading of the file is already processed and the file includes for sure the definition of an SPHERE.
Definition at line 709 of file polyhedron.c. References Tpolyhedron::center, GenerateSphereOFF(), Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, SPHERE, and Tpolyhedron::type. Referenced by InitPolyhedronFromFile().
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).
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().
Defines an OFF object from a set of triangles.
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.
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.
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().
Defines a sphere (and its polyhedric approximation for collision detection).
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().
Defines a cylinder (and its polyhedric approximation for collision detection).
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().
Defines a line.
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.
Defines a set of segments.
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().
Defines a polyhedron from another polyhedron.
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().
Applies a homogenoeus transform to a polyhedron.
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().
Gets the center of the spheres. When applied to other type of polyhedrons an error is triggered.
Definition at line 1145 of file polyhedron.c. References Tpolyhedron::center, Error(), SPHERE, and Tpolyhedron::type. Referenced by SolidCorrection(), and WorldAtomJacobian().
Retrives the type of a polyhedron.
Definition at line 1155 of file polyhedron.c. References Tpolyhedron::type. Referenced by AddBody2Link(), AddShape2Solid(), LinkNAtoms(), SolidCorrection(), and WorldAtomJacobian().
Changes the color of a polyhedron.
Definition at line 1160 of file polyhedron.c. References Tpolyhedron::color, and CopyColor().
Gets the color of a polyhedron.
Definition at line 1165 of file polyhedron.c. References Tpolyhedron::color, and CopyColor(). Referenced by GetObstacleColor().
Gets the status of a polyhedron (NORMAL, HIDDEN, DECOR).
Definition at line 1170 of file polyhedron.c. References Tpolyhedron::status. Referenced by AddBody2Link(), AddShape2Solid(), GetLinkBodyStatus(), GetObstacleShapeStatus(), SolidCorrection(), and VisibleLink().
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)
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().
Gets the number of vertexes of a polyhedron.
Definition at line 1185 of file polyhedron.c. References Tpolyhedron::nv.
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.
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().
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.
Definition at line 1232 of file polyhedron.c. References Error(), LINE, OFF, Tpolyhedron::rad, SEGMENTS, and Tpolyhedron::type. Referenced by AddShape2Solid().
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.
Definition at line 1239 of file polyhedron.c. References Error(), Tpolyhedron::nv, and Tpolyhedron::v. Referenced by GetPolyhedronDefiningPoint().
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.
Definition at line 1250 of file polyhedron.c. References Tpolyhedron::maxCoord. Referenced by AddBody2Link(), and AddShape2Environment().
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.
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().
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.
Definition at line 1285 of file polyhedron.c. References Tpolyhedron::center, HTransformApply(), SPHERE, and Tpolyhedron::type. Referenced by LinkPrintAtoms().
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.
Definition at line 1297 of file polyhedron.c. References Tpolyhedron::center, HTransformApply(), Tpolyhedron::rad, SPHERE, and Tpolyhedron::type. Referenced by LinkStoreAtoms().
Moves an object previously added to a 3D scene.
Definition at line 1309 of file polyhedron.c. References HIDDEN_SHAPE, Move3dObject(), NO_UINT, Tpolyhedron::obj3d, and Tpolyhedron::status. Referenced by MoveLinkFromTransform().
Stores the geometic information of a polyhedron into a file. Basically, it creates a file that can be latter read using InitPolyhedronFromFile
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().
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.
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().
Deletes the information stored in a Tpolyhedron and frees the allocated memory.
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(). |
Follow us!