mesh3d::geometry Class Reference

collection of points, polygons, corners and their attributes

#include <geometry.h>

Public Types

typedef
attribute_map_collection
< point * > 
point_attribute_map_collection
typedef
attribute_map_collection
< corner * > 
corner_attribute_map_collection
typedef
attribute_map_collection
< polygon * > 
polygon_attribute_map_collection
typedef std::vector
< mesh3d::point * > 
point_collection
typedef std::vector
< mesh3d::polygon * > 
polygon_collection

Public Member Functions

 geometry ()
 ~geometry ()
point_attribute_map_collectionpoint_attributes ()
corner_attribute_map_collectioncorner_attributes ()
polygon_attribute_map_collectionpolygon_attributes ()
point_attribute_map_collection
const & 
point_attributes () const
corner_attribute_map_collection
const & 
corner_attributes () const
polygon_attribute_map_collection
const & 
polygon_attributes () const
void reserve_points (size_t point_count)
void reserve_polygons (size_t polygon_count)
pointmake_point ()
polygonmake_polygon ()
pointmake_point (float x, float y, float z)
pointmake_point (double x, double y, double z)
pointmake_point (double x, double y, double z, double nx, double ny, double nz, double s, double t)
polygonmake_polygon (point *p0)
polygonmake_polygon (point *p0, point *p1)
polygonmake_polygon (point *p0, point *p1, point *p2)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4, point *p5)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4, point *p5, point *p6)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4, point *p5, point *p6, point *p7)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4, point *p5, point *p6, point *p7, point *p8)
polygonmake_polygon (point *p0, point *p1, point *p2, point *p3, point *p4, point *p5, point *p6, point *p7, point *p8, point *p9)
polygonmake_polygon (size_t p0)
polygonmake_polygon (size_t p0, size_t p1)
polygonmake_polygon (size_t p0, size_t p1, size_t p2)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, size_t p8)
polygonmake_polygon (size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, size_t p8, size_t p9)
point_collectionpoints ()
point_collection const & points () const
polygon_collectionpolygons ()
polygon_collection const & polygons () const
void compute_polygon_normals ()
void compute_polygon_centroids ()
void compute_corner_normals (float max_smoothing_angle)

Detailed Description

Definition at line 42 of file geometry.h.


Member Typedef Documentation

Definition at line 45 of file geometry.h.

Definition at line 46 of file geometry.h.

Definition at line 47 of file geometry.h.

Definition at line 49 of file geometry.h.

Definition at line 50 of file geometry.h.


Constructor & Destructor Documentation

mesh3d::geometry::geometry (  ) 

Definition at line 34 of file geometry.cpp.

00035 {
00036 }

mesh3d::geometry::~geometry (  ) 

Definition at line 38 of file geometry.cpp.

00039 {
00040     for(
00041         polygon_collection::iterator i = polygons().begin();
00042         i != polygons().end();
00043         ++i
00044     )
00045     {
00046         polygon* pol = *i;
00047         delete pol;
00048     }
00049     for(
00050         point_collection::iterator i = points().begin();
00051         i != points().end();
00052         ++i
00053     )
00054     {
00055         point *pnt = *i;
00056         delete pnt;
00057     }
00058 }


Member Function Documentation

point_attribute_map_collection& mesh3d::geometry::point_attributes (  )  [inline]

Definition at line 57 of file geometry.h.

00057 { return m_point_attribute_map_collection; }

corner_attribute_map_collection& mesh3d::geometry::corner_attributes (  )  [inline]

Definition at line 58 of file geometry.h.

00058 { return m_corner_attribute_map_collection; }

polygon_attribute_map_collection& mesh3d::geometry::polygon_attributes (  )  [inline]

Definition at line 59 of file geometry.h.

00059 { return m_polygon_attribute_map_collection; }

point_attribute_map_collection const& mesh3d::geometry::point_attributes (  )  const [inline]

Definition at line 61 of file geometry.h.

00061 { return m_point_attribute_map_collection; }

corner_attribute_map_collection const& mesh3d::geometry::corner_attributes (  )  const [inline]

Definition at line 62 of file geometry.h.

00062 { return m_corner_attribute_map_collection; }

polygon_attribute_map_collection const& mesh3d::geometry::polygon_attributes (  )  const [inline]

Definition at line 63 of file geometry.h.

00063 { return m_polygon_attribute_map_collection; }

void mesh3d::geometry::reserve_points ( size_t  point_count  ) 

Definition at line 60 of file geometry.cpp.

00061 {
00062     if(point_count > m_points.size())
00063     {
00064         m_points.reserve(point_count);
00065     }
00066 }

void mesh3d::geometry::reserve_polygons ( size_t  polygon_count  ) 

Definition at line 68 of file geometry.cpp.

00069 {
00070     if(polygon_count > m_polygons.size())
00071     {
00072         m_polygons.reserve(polygon_count);
00073     }
00074 }

point * mesh3d::geometry::make_point (  ) 

Definition at line 76 of file geometry.cpp.

00077 {
00078     mesh3d::point *pnt = new mesh3d::point();
00079     m_points.push_back(pnt);
00080     return pnt;
00081 }

polygon * mesh3d::geometry::make_polygon (  ) 

Definition at line 83 of file geometry.cpp.

00084 {
00085     mesh3d::polygon *pol = new mesh3d::polygon();
00086     m_polygons.push_back(pol);
00087     return pol;
00088 }

point * mesh3d::geometry::make_point ( float  x,
float  y,
float  z 
)

Definition at line 165 of file geometry.cpp.

00166 {
00167     point *pnt = make_point();
00168     std::tr1::shared_ptr<attribute_map<point*, vec3> > point_positions = 
00169         point_attributes().find_or_create<vec3>("point_locations");
00170 
00171     point_positions->set_value(pnt, vec3(x, y, z));
00172 
00173     return pnt;
00174 }

point * mesh3d::geometry::make_point ( double  x,
double  y,
double  z 
)

Definition at line 176 of file geometry.cpp.

00177 {
00178     return make_point(float(x), float(y), float(z));
00179 }

point* mesh3d::geometry::make_point ( double  x,
double  y,
double  z,
double  nx,
double  ny,
double  nz,
double  s,
double  t 
)
polygon * mesh3d::geometry::make_polygon ( point p0  ) 

Definition at line 181 of file geometry.cpp.

00182 {
00183     polygon *p = make_polygon();
00184     p->make_corner(p0);
00185     return p;
00186 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1 
)

Definition at line 188 of file geometry.cpp.

00189 {
00190     polygon *p = make_polygon();
00191     p->make_corner(p0);
00192     p->make_corner(p1);
00193     return p;
00194 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2 
)

Definition at line 196 of file geometry.cpp.

00197 {
00198     polygon *p = make_polygon();
00199     p->make_corner(p0);
00200     p->make_corner(p1);
00201     p->make_corner(p2);
00202     return p;
00203 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3 
)

Definition at line 205 of file geometry.cpp.

00206 {
00207     polygon *p = make_polygon();
00208     p->make_corner(p0);
00209     p->make_corner(p1);
00210     p->make_corner(p2);
00211     p->make_corner(p3);
00212     return p;
00213 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4 
)

Definition at line 215 of file geometry.cpp.

00216 {
00217     polygon *p = make_polygon();
00218     p->make_corner(p0);
00219     p->make_corner(p1);
00220     p->make_corner(p2);
00221     p->make_corner(p3);
00222     p->make_corner(p4);
00223     return p;
00224 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4,
point p5 
)

Definition at line 226 of file geometry.cpp.

00227 {
00228     polygon *p = make_polygon();
00229     p->make_corner(p0);
00230     p->make_corner(p1);
00231     p->make_corner(p2);
00232     p->make_corner(p3);
00233     p->make_corner(p4);
00234     p->make_corner(p5);
00235     return p;
00236 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4,
point p5,
point p6 
)

Definition at line 238 of file geometry.cpp.

00239 {
00240     polygon *p = make_polygon();
00241     p->make_corner(p0);
00242     p->make_corner(p1);
00243     p->make_corner(p2);
00244     p->make_corner(p3);
00245     p->make_corner(p4);
00246     p->make_corner(p5);
00247     p->make_corner(p6);
00248     return p;
00249 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4,
point p5,
point p6,
point p7 
)

Definition at line 251 of file geometry.cpp.

00252 {
00253     polygon *p = make_polygon();
00254     p->make_corner(p0);
00255     p->make_corner(p1);
00256     p->make_corner(p2);
00257     p->make_corner(p3);
00258     p->make_corner(p4);
00259     p->make_corner(p5);
00260     p->make_corner(p6);
00261     p->make_corner(p7);
00262     return p;
00263 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4,
point p5,
point p6,
point p7,
point p8 
)

Definition at line 265 of file geometry.cpp.

00266 {
00267     polygon *p = make_polygon();
00268     p->make_corner(p0);
00269     p->make_corner(p1);
00270     p->make_corner(p2);
00271     p->make_corner(p3);
00272     p->make_corner(p4);
00273     p->make_corner(p5);
00274     p->make_corner(p6);
00275     p->make_corner(p7);
00276     p->make_corner(p8);
00277     return p;
00278 }

polygon * mesh3d::geometry::make_polygon ( point p0,
point p1,
point p2,
point p3,
point p4,
point p5,
point p6,
point p7,
point p8,
point p9 
)

Definition at line 280 of file geometry.cpp.

00281 {
00282     polygon *p = make_polygon();
00283     p->make_corner(p0);
00284     p->make_corner(p1);
00285     p->make_corner(p2);
00286     p->make_corner(p3);
00287     p->make_corner(p4);
00288     p->make_corner(p5);
00289     p->make_corner(p6);
00290     p->make_corner(p7);
00291     p->make_corner(p8);
00292     p->make_corner(p9);
00293     return p;
00294 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0  ) 

Definition at line 296 of file geometry.cpp.

00297 {
00298     polygon *p = make_polygon();
00299     p->make_corner(m_points[p0]);
00300     return p;
00301 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1 
)

Definition at line 303 of file geometry.cpp.

00304 {
00305     polygon *p = make_polygon();
00306     p->make_corner(m_points[p0]);
00307     p->make_corner(m_points[p1]);
00308     return p;
00309 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2 
)

Definition at line 311 of file geometry.cpp.

00312 {
00313     polygon *p = make_polygon();
00314     p->make_corner(m_points[p0]);
00315     p->make_corner(m_points[p1]);
00316     p->make_corner(m_points[p2]);
00317     return p;
00318 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3 
)

Definition at line 320 of file geometry.cpp.

00321 {
00322     polygon *p = make_polygon();
00323     p->make_corner(m_points[p0]);
00324     p->make_corner(m_points[p1]);
00325     p->make_corner(m_points[p2]);
00326     p->make_corner(m_points[p3]);
00327     return p;
00328 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4 
)

Definition at line 330 of file geometry.cpp.

00331 {
00332     polygon *p = make_polygon();
00333     p->make_corner(m_points[p0]);
00334     p->make_corner(m_points[p1]);
00335     p->make_corner(m_points[p2]);
00336     p->make_corner(m_points[p3]);
00337     p->make_corner(m_points[p4]);
00338     return p;
00339 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4,
size_t  p5 
)

Definition at line 341 of file geometry.cpp.

00342 {
00343     polygon *p = make_polygon();
00344     p->make_corner(m_points[p0]);
00345     p->make_corner(m_points[p1]);
00346     p->make_corner(m_points[p2]);
00347     p->make_corner(m_points[p3]);
00348     p->make_corner(m_points[p4]);
00349     p->make_corner(m_points[p5]);
00350     return p;
00351 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4,
size_t  p5,
size_t  p6 
)

Definition at line 353 of file geometry.cpp.

00354 {
00355     polygon *p = make_polygon();
00356     p->make_corner(m_points[p0]);
00357     p->make_corner(m_points[p1]);
00358     p->make_corner(m_points[p2]);
00359     p->make_corner(m_points[p3]);
00360     p->make_corner(m_points[p4]);
00361     p->make_corner(m_points[p5]);
00362     p->make_corner(m_points[p6]);
00363     return p;
00364 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4,
size_t  p5,
size_t  p6,
size_t  p7 
)

Definition at line 366 of file geometry.cpp.

00367 {
00368     polygon *p = make_polygon();
00369     p->make_corner(m_points[p0]);
00370     p->make_corner(m_points[p1]);
00371     p->make_corner(m_points[p2]);
00372     p->make_corner(m_points[p3]);
00373     p->make_corner(m_points[p4]);
00374     p->make_corner(m_points[p5]);
00375     p->make_corner(m_points[p6]);
00376     p->make_corner(m_points[p7]);
00377     return p;
00378 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4,
size_t  p5,
size_t  p6,
size_t  p7,
size_t  p8 
)

Definition at line 380 of file geometry.cpp.

00381 {
00382     polygon *p = make_polygon();
00383     p->make_corner(m_points[p0]);
00384     p->make_corner(m_points[p1]);
00385     p->make_corner(m_points[p2]);
00386     p->make_corner(m_points[p3]);
00387     p->make_corner(m_points[p4]);
00388     p->make_corner(m_points[p5]);
00389     p->make_corner(m_points[p6]);
00390     p->make_corner(m_points[p7]);
00391     p->make_corner(m_points[p8]);
00392     return p;
00393 }

polygon * mesh3d::geometry::make_polygon ( size_t  p0,
size_t  p1,
size_t  p2,
size_t  p3,
size_t  p4,
size_t  p5,
size_t  p6,
size_t  p7,
size_t  p8,
size_t  p9 
)

Definition at line 395 of file geometry.cpp.

00396 {
00397     polygon *p = make_polygon();
00398     p->make_corner(m_points[p0]);
00399     p->make_corner(m_points[p1]);
00400     p->make_corner(m_points[p2]);
00401     p->make_corner(m_points[p3]);
00402     p->make_corner(m_points[p4]);
00403     p->make_corner(m_points[p5]);
00404     p->make_corner(m_points[p6]);
00405     p->make_corner(m_points[p7]);
00406     p->make_corner(m_points[p8]);
00407     p->make_corner(m_points[p9]);
00408     return p;
00409 }

geometry::point_collection & mesh3d::geometry::points (  ) 

Definition at line 90 of file geometry.cpp.

00090 { return m_points;   }

geometry::point_collection const & mesh3d::geometry::points (  )  const

Definition at line 91 of file geometry.cpp.

00091 { return m_points;   }

geometry::polygon_collection & mesh3d::geometry::polygons (  ) 

Definition at line 92 of file geometry.cpp.

00092 { return m_polygons; }

geometry::polygon_collection const & mesh3d::geometry::polygons (  )  const

Definition at line 93 of file geometry.cpp.

00093 { return m_polygons; }

void mesh3d::geometry::compute_polygon_normals (  ) 

Definition at line 95 of file geometry.cpp.

00096 {
00097     std::tr1::shared_ptr<attribute_map<polygon*, vec3> > polygon_normals = polygon_attributes().find_or_create<vec3>("polygon_normals");
00098     std::tr1::shared_ptr<attribute_map<point*,   vec3> > point_locations = point_attributes().find<vec3>("point_locations");
00099     for(
00100         polygon_collection::iterator i = polygons().begin();
00101         i != polygons().end();
00102         ++i
00103     )
00104     {
00105         polygon *pol = *i;
00106         pol->compute_normal(
00107             polygon_normals,
00108             point_locations
00109         );
00110     }
00111 }

void mesh3d::geometry::compute_polygon_centroids (  ) 

Definition at line 112 of file geometry.cpp.

00113 {
00114     std::tr1::shared_ptr<attribute_map<polygon*, vec3> > polygon_centroids = polygon_attributes().find_or_create<vec3>("polygon_centroids");
00115     std::tr1::shared_ptr<attribute_map<point*,   vec3> > point_locations = point_attributes().find<vec3>("point_locations");
00116 
00117     for(
00118         polygon_collection::iterator i = polygons().begin();
00119         i != polygons().end();
00120         ++i
00121     )
00122     {
00123         polygon *pol = *i;
00124         pol->compute_centroid(
00125             polygon_centroids,
00126             point_locations
00127         );
00128     }
00129 }

void mesh3d::geometry::compute_corner_normals ( float  max_smoothing_angle  ) 

Definition at line 131 of file geometry.cpp.

00132 {
00133     std::tr1::shared_ptr<attribute_map<corner*,  vec3> > corner_normals  = corner_attributes ().find_or_create<vec3>("corner_normals");
00134     std::tr1::shared_ptr<attribute_map<polygon*, vec3> > polygon_normals = polygon_attributes().find<vec3>("polygon_normals");
00135     std::tr1::shared_ptr<attribute_map<point*,   vec3> > point_locations = point_attributes  ().find<vec3>("point_locations");
00136     float cos_max_smoothing_angle = std::cos(max_smoothing_angle);
00137 
00138     for(
00139         polygon_collection::iterator i = polygons().begin();
00140         i != polygons().end();
00141         ++i
00142     )
00143     {
00144         polygon *pol = *i;
00145 
00146         if(max_smoothing_angle == 0)
00147         {
00148             pol->copy_polygon_normal_to_corners(
00149                 corner_normals,
00150                 polygon_normals
00151             );
00152         }
00153         else
00154         {
00155             pol->compute_corner_normals(
00156                 corner_normals,
00157                 polygon_normals,
00158                 point_locations,
00159                 cos_max_smoothing_angle
00160             );
00161         }
00162     }
00163 }


The documentation for this class was generated from the following files:
Generated on Sun Apr 11 12:23:11 2010 for RenderStack by  doxygen 1.6.3