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
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef POLYGON_H_
00033 # define POLYGON_H_
00034
00035 #include <V_3D.h>
00036 #include <Segment.h>
00037 #include <Triangle.h>
00038 #include <vector>
00039
00040
00042
00046 class Polygon
00047 {
00048 public:
00049
00050
00051
00052
00053
00055 Polygon();
00057 Polygon(const V_3D& x0,const V_3D& x1,const V_3D& x2);
00059 Polygon(const V_3D& x0,const V_3D& x1,const V_3D& x2,const V_3D& x3);
00061 Polygon(const std::vector <V_3D>& v);
00063 Polygon(const Polygon& poly);
00065 ~Polygon();
00066
00067
00068
00069
00070
00071
00072
00074 int size() const;
00075
00077 Segment get_segment(int index) const;
00078
00079
00080
00081
00082
00084 int destroy();
00085
00087 int set_polygon(const std::vector <V_3D>& v);
00089 int set_polygon(const V_3D& x0,const V_3D& x1,const V_3D& x2);
00090
00092 int add_vertex(const V_3D& v);
00094 int add_vertex(double x0,double x1,double x2);
00096 int add_vertex(const std::vector <V_3D>& v);
00097
00099
00100 std::vector <Polygon> triangulate() const;
00102
00103 std::vector <Triangle> get_triangulation() const;
00104
00106 V_3D normal() const;
00107
00109 Triangle to_triangle() const;
00110
00111
00112
00113
00114
00115
00117 double shortest_distance_to_point(const V_3D& x) const;
00118
00120
00127 V_3D closest_point(const V_3D& x,int *type) const;
00129 V_3D closest_point(const V_3D& x) const;
00130
00131
00133
00136 V_3D closest_segment_point(const Segment& s) const;
00137
00138
00140
00147 std::vector <V_3D> plane_intersection(const V_3D& n,const V_3D& x0,int *type) const;
00149
00150 std::vector <V_3D> plane_intersection(const V_3D& n,const V_3D& x0,int *type,std::vector <int> *type_edge) const;
00151
00152
00154
00158 Polygon half_space_intersection(const V_3D& n,const V_3D& x0,int *type);
00159
00160
00161
00162
00163
00164
00166
00171 std::vector <Polygon> subdivide_mid_edge() const;
00173
00177 std::vector <Polygon> subdivide_barycenter_mid_edge() const;
00178
00179
00180
00181
00182
00184 V_3D operator()(int index) const;
00186 V_3D& operator()(int index);
00188 V_3D operator[](int index) const;
00190 V_3D& operator[](int index);
00191
00193 Polygon& operator=(const Polygon&);
00194
00196 friend ostream& operator << (ostream& flux, const Polygon& _v);
00197
00198
00199 private:
00200 std::vector <V_3D> x;
00201
00202 };
00203
00204
00205 #endif