polyhedron.h File Reference Detailed DescriptionDefinition of the Tpolyhedron type and the associated functions.
Definition in file polyhedron.h.
Macro Definition Documentation
One of the possible type of shapes. A normal shape is show and considered for collisions.
Definition at line 28 of file polyhedron.h. Referenced by InitWorldFromMolecule(), main(), PrintMechanism(), and PrintPolyhedron().
One of the possible type of shapes. A hiden shape is not show but it is considered for collisions.
Definition at line 37 of file polyhedron.h. Referenced by AddLeg2World(), InitPolyhedronFromFile(), InitWorldFromMolecule(), main(), MovePolyhedron(), PlotPolyhedron(), PrintMechanism(), PrintPolyhedron(), and VisibleLink().
One of the possible type of shapes. A decor(ation) shape is show but it is not considered for collisions.
Definition at line 46 of file polyhedron.h. Referenced by AddBody2Link(), AddLeg2World(), AddShape2Solid(), CheckAllCollisions(), InitPQPCD(), InitSolidCD(), InitVcollideCD(), InitWorldFromMolecule(), main(), NewSegments(), NewSpring(), PrintPolyhedron(), and SolidCorrection().
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.
Definition at line 59 of file polyhedron.h. Referenced by AddShape2Solid(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), InitPolyhedronFromTriangles(), NewBox(), NewTriangularPrism(), PlotPolyhedron(), PrintPolyhedron(), ReadGeneralMesh(), ReadOFF(), ReadSTL(), SavePolyhedron(), and SolidCorrection().
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.
Definition at line 70 of file polyhedron.h. Referenced by AddBody2Link(), AddShape2Solid(), GenerateSphereOFF(), GetPolyhedronCenter(), GetPolyhedronDefiningPoint(), LinkNAtoms(), NewSphere(), PlotPolyhedron(), PolyhedronPrintCenter(), PolyhedronPrintCenterAndRadius(), PrintPolyhedron(), ReadSphere(), SavePolyhedron(), SolidCorrection(), and WorldAtomJacobian().
One of the possible type of polyhedrons. A CYLINDER is defined by two 3d points. This is not standard in geomview.
Definition at line 80 of file polyhedron.h. Referenced by AddShape2Solid(), GenerateCylinderOFF(), GetPolyhedronDefiningPoint(), NewCylinder(), PlotPolyhedron(), PrintPolyhedron(), ReadCylinder(), SavePolyhedron(), and SolidCorrection().
One of the possible type of polyhedrons. A LINE is defined by two 3d points. This is standard in geomview.
Definition at line 90 of file polyhedron.h. Referenced by AddShape2Solid(), GenerateCylinderOFF(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), NewLine(), PlotPolyhedron(), PrintPolyhedron(), ReadLine(), SavePolyhedron(), and SolidCorrection().
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.
Definition at line 100 of file polyhedron.h. Referenced by AddShape2Solid(), GetPolyhedronDefiningPoint(), GetPolyhedronRadius(), NewSegments(), NewSpring(), PlotPolyhedron(), PrintPolyhedron(), ReadSegments(), SavePolyhedron(), and SolidCorrection().
One of the possible type of polyhedrons. Used when there is an error in the definition of the object.
Definition at line 110 of file polyhedron.h. Referenced by DeletePolyhedron(), EmptyPolyhedron(), and NewBox(). Function Documentation
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.
Denotes geometric objects that are defined but can not be displayed (i.e., boxes with size 0). It is not worth to add such objects to any mechanism.
Definition at line 856 of file polyhedron.c. References EMPTY_BODY, and Tpolyhedron::type. Referenced by AddBody2Link(), and AddShape2Environment().
Defines an triangular prism. Typically used to define triangles with some thick.
Definition at line 861 of file polyhedron.c. References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), CrossProduct(), DifferenceVector(), Tpolyhedron::fv, Tpolyhedron::maxCoord, Tpolyhedron::ne, NEW, Tpolyhedron::nf, NO_UINT, Normalize(), Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::obj3d, OFF, Tpolyhedron::p1, Tpolyhedron::p2, Tpolyhedron::rad, Tpolyhedron::status, SumVectorScale(), 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 946 of file polyhedron.c. References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), EMPTY_BODY, 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 1020 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 AddLeg2World(), InitWorldFromMolecule(), and main().
Defines a cylinder (and its polyhedric approximation for collision detection).
Definition at line 1044 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 AddLeg2World(), InitWorldFromMolecule(), and main().
Defines a line.
Definition at line 1071 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 1098 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 polyline that resembles a spring. This is used to get nice plots in tensegrites. The spring is always aligned with the X axis and rooted at the origin. It has a initial segment, a set of loops and a final segment.
Definition at line 1145 of file polyhedron.c. References Tpolyhedron::center, Tpolyhedron::color, CopyColor(), DECOR_SHAPE, Error(), M_2PI, 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 AddLeg2World().
Defines a polyhedron from another polyhedron.
Definition at line 1259 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 1321 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 1353 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 1363 of file polyhedron.c. References Tpolyhedron::type. Referenced by AddBody2Link(), AddShape2Solid(), LinkNAtoms(), SolidCorrection(), and WorldAtomJacobian().
Changes the color of a polyhedron.
Definition at line 1368 of file polyhedron.c. References Tpolyhedron::color, and CopyColor().
Gets the color of a polyhedron.
Definition at line 1373 of file polyhedron.c. References Tpolyhedron::color, and CopyColor(). Referenced by GetObstacleColor(), and PrintMechanism().
Gets the status of a polyhedron (NORMAL, HIDDEN, DECOR).
Definition at line 1378 of file polyhedron.c. References Tpolyhedron::status. Referenced by AddBody2Link(), AddShape2Solid(), GetLinkBodyStatus(), GetObstacleShapeStatus(), PrintMechanism(), 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 1383 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 1393 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 1398 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 1440 of file polyhedron.c. References Error(), LINE, OFF, Tpolyhedron::rad, SEGMENTS, and Tpolyhedron::type. Referenced by AddShape2Solid(), and PrintMechanism().
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 1447 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 1458 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 1463 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 1493 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 1505 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 1517 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 1523 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 1574 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 1692 of file polyhedron.c. References EMPTY_BODY, Tpolyhedron::fv, Tpolyhedron::nf, Tpolyhedron::nv, Tpolyhedron::nvf, Tpolyhedron::type, and Tpolyhedron::v. Referenced by AddLeg2World(), DeleteEnvironment(), DeleteLink(), InitWorldFromMolecule(), and main(). |
Follow us!