polygon.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef MESH3D__POLYGON__H
00028 #define MESH3D__POLYGON__H
00029
00030 #include "mesh3d/attribute_map.h"
00031 #include "mesh3d/vec3.h"
00032 #include <vector>
00033 #include <memory>
00034 #include <algorithm>
00035
00036 namespace mesh3d {
00037
00038 class geometry;
00039 class corner;
00040 class point;
00041
00043 class polygon
00044 {
00045
00046 public:
00047 typedef std::vector<mesh3d::corner*> corner_collection;
00048
00049 polygon(){}
00050 ~polygon();
00051
00052 public:
00053 void copy_polygon_normal_to_corners(
00054 std::tr1::shared_ptr<attribute_map<mesh3d::corner*, mesh3d::vec3> > corner_normals,
00055 std::tr1::shared_ptr<attribute_map<mesh3d::polygon*, mesh3d::vec3> > polygon_normals
00056 );
00057 void compute_normal(
00058 std::tr1::shared_ptr<attribute_map<mesh3d::polygon*, mesh3d::vec3> > polygon_normals,
00059 std::tr1::shared_ptr<attribute_map<mesh3d::point*, mesh3d::vec3> > point_locations
00060 );
00061 void compute_centroid(
00062 std::tr1::shared_ptr<attribute_map<mesh3d::polygon*, mesh3d::vec3> > polygon_centroids,
00063 std::tr1::shared_ptr<attribute_map<mesh3d::point*, mesh3d::vec3> > point_locations
00064 );
00065 void compute_corner_normals(
00066 std::tr1::shared_ptr<attribute_map<mesh3d::corner*, mesh3d::vec3> > corner_normals,
00067 std::tr1::shared_ptr<attribute_map<mesh3d::polygon*, mesh3d::vec3> > polygon_normals,
00068 std::tr1::shared_ptr<attribute_map<mesh3d::point*, mesh3d::vec3> > point_locations,
00069 float cos_max_smoothing_angle
00070 );
00071 mesh3d::corner *corner (mesh3d::point *pnt);
00072 mesh3d::corner *make_corner (mesh3d::point *pnt);
00073
00074 corner_collection &corners() { return m_corners; }
00075 corner_collection const &corners() const { return m_corners; }
00076
00077 void reverse() { std::reverse(m_corners.begin(), m_corners.end()); }
00078
00079 private:
00080 corner_collection m_corners;
00081 };
00082
00083 }
00084
00085 #endif
00086