diff --git a/src/Prep/Terra/Quadedge.cc b/src/Prep/Terra/Quadedge.cc index 91520269..478b2691 100644 --- a/src/Prep/Terra/Quadedge.cc +++ b/src/Prep/Terra/Quadedge.cc @@ -63,6 +63,7 @@ Edge::~Edge() e2->qnext = NULL; e3->qnext = NULL; +//FIXME: who deletes the edges allocated in ctor? (Torsten Dreyer 01/2019) //delete e1; //delete e2; //delete e3; diff --git a/src/Prep/Terra/Quadedge.h b/src/Prep/Terra/Quadedge.h index 6ac8f3f6..5df29e35 100644 --- a/src/Prep/Terra/Quadedge.h +++ b/src/Prep/Terra/Quadedge.h @@ -15,8 +15,8 @@ private: Edge(Edge *prev); -protected: - Vec2 *data; +//protected: + Vec2 data; Edge *next; Triangle *lface; @@ -47,16 +47,16 @@ public: Edge *Rprev() const { return Sym()->Onext(); } - Vec2& Org() const { return *data; } - Vec2& Dest() const { return *Sym()->data; } + const Vec2& Org() const { return data; } + const Vec2& Dest() const { return Sym()->data; } Triangle *Lface() const { return lface; } void set_Lface(Triangle *t) { lface = t; } - void EndPoints(Vec2& org, Vec2& dest) + void EndPoints(const Vec2& org, const Vec2& dest) { - data = &org; - Sym()->data = &dest; + data = org; + Sym()->data = dest; } // diff --git a/src/Prep/Terra/Subdivision.cc b/src/Prep/Terra/Subdivision.cc index b34fc358..e21c9ff1 100644 --- a/src/Prep/Terra/Subdivision.cc +++ b/src/Prep/Terra/Subdivision.cc @@ -28,7 +28,7 @@ Subdivision::~Subdivision() } } -Edge *Subdivision::makeEdge(Vec2& org, Vec2& dest) +Edge *Subdivision::makeEdge(const Vec2& org, const Vec2& dest) { Edge *e = new Edge(); edges.push_back(e); @@ -54,31 +54,26 @@ Edge *Subdivision::makeEdge() void Subdivision::initMesh(const Vec2& A,const Vec2& B, const Vec2& C,const Vec2& D) { - Vec2& a = A.clone(); - Vec2& b = B.clone(); - Vec2& c = C.clone(); - Vec2& d = D.clone(); - Edge *ea = makeEdge(); - ea->EndPoints(a, b); + ea->EndPoints(A, B); Edge *eb = makeEdge(); splice(ea->Sym(), eb); - eb->EndPoints(b, c); + eb->EndPoints(B, C); Edge *ec = makeEdge(); splice(eb->Sym(), ec); - ec->EndPoints(c, d); + ec->EndPoints(C, D); Edge *ed = makeEdge(); splice(ec->Sym(), ed); - ed->EndPoints(d, a); + ed->EndPoints(D, A); splice(ed->Sym(), ea); Edge *diag = makeEdge(); splice(ed->Sym(),diag); splice(eb->Sym(),diag->Sym()); - diag->EndPoints(a,c); + diag->EndPoints(A,C); startingEdge = ea; @@ -334,7 +329,7 @@ Edge *Subdivision::spoke(Vec2& x, Edge *e) // x lies within the Lface of e } - Edge *base = makeEdge(e->Org(), x.clone()); + Edge *base = makeEdge(e->Org(), x ); splice(base, e); diff --git a/src/Prep/Terra/Subdivision.h b/src/Prep/Terra/Subdivision.h index 1e65860a..c9022a35 100644 --- a/src/Prep/Terra/Subdivision.h +++ b/src/Prep/Terra/Subdivision.h @@ -66,7 +66,7 @@ protected: ~Subdivision(); Edge *makeEdge(); - Edge *makeEdge(Vec2& org, Vec2& dest); + Edge *makeEdge(const Vec2& org, const Vec2& dest); virtual Triangle *allocFace(Edge *e); Triangle& makeFace(Edge *e); diff --git a/src/Prep/Terra/Vec2.h b/src/Prep/Terra/Vec2.h index d57dbdb9..5c708a28 100644 --- a/src/Prep/Terra/Vec2.h +++ b/src/Prep/Terra/Vec2.h @@ -16,7 +16,6 @@ public: Vec2(real x=0, real y=0) { elt[0]=x; elt[1]=y; } Vec2(const Vec2& v) { copy(v); } Vec2(const real *v) { elt[0]=v[0]; elt[1]=v[1]; } - Vec2& clone() const { return *(new Vec2(elt[0], elt[1])); } // Access methods real& operator()(int i) { return elt[i]; }