4 #ifndef U3D_TRIANGLED_ABSTRACT_SURFACE_HPP_
5 #define U3D_TRIANGLED_ABSTRACT_SURFACE_HPP_
7 #include <u3d_point.hpp>
8 #include <u3d_triangle.hpp>
9 #include "u3d_math_abstract_surface.hpp"
31 virtual void addPoint(
U3dPoint*) = 0;
32 virtual bool removePoint(
int pointId) = 0;
33 virtual void movePoint(
int pointId,
double x,
double y,
double z) = 0;
35 virtual class U3dBox getBox() const = 0;
51 else { triangle = m_triangles[id];
return true; }
78 else { point =
U3dPoint(*m_tps[
id]);
return true; }
81 const U3dPoint*
getPoint(
int id)
const throw(std::out_of_range) {
return m_tps.at(
id); }
87 bool getPoint(
int id,
double &x,
double &y,
double &z)
91 x = m_tps[id]->getX();
92 y = m_tps[id]->getY();
93 z = m_tps[id]->getZ();
135 virtual void calculateTrPlanes();
140 U3dTrianglesAr m_triangles;
142 U3dPointsAr m_initPoints;
157 class Delone2DTriangulator {
165 My2DPoint(
double ix,
double iy) : x(ix), y(iy) {};
166 double distance(
const My2DPoint& other)
const;
167 double getX()
const {
return x; };
168 double getY()
const {
return y; };
176 MyHVector(
double aa,
double bb, My2DPoint point) : a(aa), b(bb), p(point) {};
177 My2DPoint intersect(
const MyHVector& v)
const throw(std::overflow_error);
178 double getA()
const {
return a; };
179 double getB()
const {
return b; };
180 double getX()
const {
return p.getX(); };
181 double getY()
const {
return p.getY(); };
182 const My2DPoint& getP()
const {
return p; };
191 Edge(My2DPoint* s, My2DPoint* d);
193 bool isPointOnRight(
const My2DPoint& p)
const;
194 const MyHVector& getPerpendicular()
const {
return hvec; };
195 bool operator==(
const Edge& other)
const;
196 My2DPoint* source()
const {
return sorc; };
197 My2DPoint* dest()
const {
return dst; };
198 double getLength() {
return sorc->distance(*dst); };
200 My2DPoint *sorc, *dst;
206 double vectOP[3], vectOQ[3];
207 double lengthOP, lengthOQ;
209 typedef std::map< My2DPoint*, unsigned> T_2d_3d_Assigns;
210 T_2d_3d_Assigns assigns;
213 typedef std::list<Edge> Front;
216 void addNewEdge(
const Edge& edge);
217 const Edge* getNextEdge();
218 Front::iterator itrNextEdge;
220 My2DPoint* vertexes[3];
222 void init(
const U3dPoint& p0,
const U3dPoint& p1,
double A,
double B,
double C);
227 Delone2DTriangulator(
double A,
double B,
double C,
int ind0,
const U3dPoint* p0,
int ind1,
const U3dPoint* p1,
int ind2,
const U3dPoint* p2);
228 Delone2DTriangulator(
const U3dPoint& p0,
const U3dPoint& p1,
double A,
double B,
double C);
229 My2DPoint* add3DPoint(
unsigned index,
const U3dPoint* p);
231 ~Delone2DTriangulator();
238 friend class Intersect;
243 const double& mx,
const double& my,
const double& mz);
246 bool incIfEqual(Intersect& other);
247 const std::vector<int>& triangles()
const {
return m_triangs; };
248 const double& getX()
const {
return x; };
249 const double& getY()
const {
return y; };
250 const double& getZ()
const {
return z; };
251 const int& ind1()
const {
return index1; };
252 const int& ind2()
const {
return ind2vec.front(); };
253 const int& ind3()
const {
return ind3vec.front(); };
255 bool find(
const double& xin,
const double& yin,
const double& zin,
256 double& xother,
double& yother,
double& zother);
261 std::list<int> ind2vec, ind3vec;
262 std::vector<int> m_triangs;
270 struct SegmentChecked {
272 bool operator< (
const SegmentChecked& other)
const {
273 if (ind1 < other.ind1)
return true;
274 if (ind1 > other.ind1)
return false;
275 return ind2 < other.ind2;
288 int getTrPointIndex(
const int& trnum,
const double& x,
const double& y,
289 const double& z,
int& index)
const;
298 #endif // U3D_TRIANGLED_ABSTRACT_SURFACE_HPP_
const U3dPoint * getPoint(int id) const
Definition: u3d_triangled_abstract_surface.hpp:91
const U3dTriangle * getTriangle(int id) const
Definition: u3d_triangled_abstract_surface.hpp:52
Definition: u3d_math_abstract_surface.hpp:11
void getInitialPoints(U3dPointsAr &ps)
Definition: u3d_triangled_abstract_surface.hpp:108
Definition: u3d_triangled_abstract_surface.hpp:31
const int_set & getActTrNums()
Definition: u3d_triangled_abstract_surface.hpp:128
virtual void getIntersections(U3dPoint p0, U3dPoint p1, std::vector< int > &int_trIds, U3dPointsAr &int_points)
bool getPoint(int id, double &x, double &y, double &z)
Definition: u3d_triangled_abstract_surface.hpp:87
Definition: u3d_box.hpp:24
int getTrianglesNum() const
Definition: u3d_triangled_abstract_surface.hpp:68
Definition: u3d_triangle.hpp:18
Definition: geometry.H:16
bool isTriangulated()
Definition: u3d_triangled_abstract_surface.hpp:124
void severance(U3dTriangledAbstractSurface *other, const U3D_COLOR &)
virtual bool getSideColor(const U3dPoint &p, U3D_COLOR &u3dcolor) const
void setWhitePoint(const U3dPoint &p)
Definition: u3d_triangled_abstract_surface.hpp:66
Definition: u3d_point.hpp:16
int getPointsNum()
Definition: u3d_triangled_abstract_surface.hpp:109
U3dPoint getWhitePoint() const
Definition: u3d_triangled_abstract_surface.hpp:69
bool m_is_triangulated
Definition: u3d_triangled_abstract_surface.hpp:163
void getPoints(U3dPointsAr &ps)
Definition: u3d_triangled_abstract_surface.hpp:102