SurfaceMesh.cc

Go to the documentation of this file.
00001 #include <esg/mesh/SurfaceMesh.h>
00002 
00003 using namespace esg;
00004 
00005 void SurfaceMesh::rotate(const Matrix3&)
00006 {
00007     fprintf(stderr,"SurfaceMesh::rotate(): This is the adaptor which can't transform its original geometry\n");
00008 }
00009 
00010 void SurfaceMesh::translate(const Vector3&)
00011 {
00012     fprintf(stderr,"SurfaceMesh::translate(): This is the adaptor which can't transform its original geometry\n");
00013 }
00014 
00015 void SurfaceMesh::transform(const Matrix4&)
00016 {
00017     fprintf(stderr,"SurfaceMesh::transform(): This is the adaptor which can't transform its original geometry\n");
00018 }
00019 
00020 void SurfaceMesh::scale(float, float, float)
00021 {
00022     fprintf(stderr,"SurfaceMesh::scale(): This is the adaptor which can't transform its original geometry\n");
00023 }
00024 
00025 void SurfaceMesh::resetActPlane()
00026 {
00027     _pSurf = NULL;
00028     if (!_pSurface) return;
00029     _pSurf = _pSurface->firstPlane();
00030 }
00031 
00032 Mesh::Plane* SurfaceMesh::getActPlane()
00033 {
00034     if (!_pSurf) return NULL;
00035     if (!pActPlane) pActPlane = new Plane;
00036     
00037     Vector3 normal = _pSurf->getFacetNormal();
00038     
00039     pActPlane->jmeno_roviny   = -1;
00040     pActPlane->next_plane     = NULL;
00041     pActPlane->previous_plane = NULL;
00042     pActPlane->any_edge       = NULL;
00043     pActPlane->a              = normal.x;
00044     pActPlane->b              = normal.y;
00045     pActPlane->c              = normal.z;
00046     pActPlane->d              = _pSurf->getFXYZ();
00047     pActPlane->skalar         = -1;
00048     
00049     return pActPlane;
00050 }
00051 
00052 int SurfaceMesh::goToNextPlane()
00053 {
00054     _pSurf = _pSurface->nextPlane();
00055     return ((_pSurf) ? true : false);
00056 }
00057 
00058 void SurfaceMesh::resetActEdge()
00059 {
00060     _actVertIndex = 0;
00061 }
00062 
00063 int SurfaceMesh::goToNextEdge()
00064 {
00065     if (!_pSurf) return 0;
00066     if (_actVertIndex+1 < _pSurf->numVertices()) {
00067         _actVertIndex++;
00068         return 1;
00069     }
00070     return 0;
00071 }
00072 
00073 Vertex3 SurfaceMesh::getActVert1(bool)
00074 {
00075     return ((_pSurf) ? _pSurf->getVertex(_actVertIndex) : Vertex3(0,0,0));
00076 }
00077 
00078 Vertex3 SurfaceMesh::getActVert2(bool)
00079 {
00080     return ((_pSurf) ?
00081             _pSurf->getVertex((_actVertIndex+1)%_pSurf->numVertices()) :
00082             Vertex3(0,0,0));
00083 }
00084 
00085 Vertex3 SurfaceMesh::getActVert()
00086 {
00087     return ((_pSurface) ? _pSurface->actVertex() : Vertex3(0,0,0));
00088 }
00089 
00090 Vertex3 SurfaceMesh::getActVertNormal1(bool)
00091 {
00092     return ((_pSurf) ? _pSurf->getVertNormal(_actVertIndex) : Vertex3(0,0,0));
00093 }
00094 
00095 Vertex3 SurfaceMesh::getActVertNormal2(bool)
00096 {
00097     return ((_pSurf) ?
00098             _pSurf->getVertNormal((_actVertIndex+1)%_pSurf->numVertices()) :
00099             Vertex3(0,0,0));
00100 }
00101 
00102 Vertex3 SurfaceMesh::getActVertNormal()
00103 {
00104     return ((_pSurf) ? _pSurf->getVertNormal(_actVertIndex) : Vertex3(0,0,0));
00105 }
00106 
00107 Vertex3 SurfaceMesh::getActPlaneNormal() const
00108 {
00109     return ((_pSurf) ? _pSurf->getFacetNormal() : Vertex3(0,0,0));
00110 }
00111 
00112 Vertex3 SurfaceMesh::getActPlaneCentroid()
00113 {
00114     return ((_pSurf) ? _pSurf->centroid() : Vertex3(0,0,0));
00115 }
00116 
00117 void SurfaceMesh::resetEdgeWalkInSolid()
00118 {
00119     // resetActPlane():
00120     _pSurf = NULL;
00121     if (!_pSurface) return;
00122     _pSurf = _pSurface->firstPlane();
00123     // resetActEdge():
00124     _actVertIndex = 0;
00125 }
00126 
00127 int SurfaceMesh::stepInEdgeWalkInSolid()
00128 {
00129     if (goToNextEdge())   return 1;
00130     if (!goToNextPlane()) return 0;
00131     _actVertIndex = 0; // = resetActEdge()
00132     return 1;
00133 }
00134 
00135 void SurfaceMesh::resetVertWalkInSolid()
00136 {
00137     if (_pSurface) _pSurface->firstVertex();
00138 }
00139 
00140 bool SurfaceMesh::stepInVertWalkInSolid()
00141 {
00142     return ((_pSurface) ? _pSurface->nextVertex() : false);
00143 }
00144 
00145 int SurfaceMesh::numberOfVertices() const
00146 {
00147     return ((_pSurface) ? (int) _pSurface->numVertices() : 0);
00148 }
00149 
00150 int SurfaceMesh::numberOfEdges() const 
00151 {
00152     return ((_pSurface) ? (int) _pSurface->numEdges() : 0);
00153 }
00154 
00155 void SurfaceMesh::turnInsideOut(void)
00156 {
00157     fprintf(stderr,"SurfaceMesh::turnInsideOut(): This is the adapter which can't change its original geometry\n");
00158 }
00159 

Generated on Wed Jun 28 12:24:32 2006 for esg by  doxygen 1.4.6