mirror of https://github.com/CGAL/cgal
make less copies of points
This commit is contained in:
parent
1dca582e62
commit
2d9186184d
|
|
@ -203,7 +203,7 @@ check_boundary_is_clockwise_weakly_polygon() const
|
|||
for (vit = v_min = this->vertices_begin() ; vit != this->vertices_end(); ++vit)
|
||||
if ( K.compare_xy(point(vit), point(v_min))<0 ) v_min = vit;
|
||||
CGAL_assertion_msg(!is_isolated(v_min),"Minimal vertex not connected.");
|
||||
Point p_min = point(v_min);
|
||||
const Point& p_min = point(v_min);
|
||||
// determine boundary edge incident to v_min:
|
||||
Halfedge_const_handle e_boundary_at_v_min = first_out_edge(v_min);
|
||||
// all out edges are forward oriented due to minimality
|
||||
|
|
@ -211,8 +211,8 @@ check_boundary_is_clockwise_weakly_polygon() const
|
|||
hvit(e_boundary_at_v_min), hend(hvit);
|
||||
do {
|
||||
--hvit;
|
||||
Point p1 = point(target(e_boundary_at_v_min));
|
||||
Point p2 = point(target(hvit));
|
||||
const Point& p1 = point(target(e_boundary_at_v_min));
|
||||
const Point& p2 = point(target(hvit));
|
||||
if ( K.orientation(p_min,p1,p2) > 0 ) { // left_turn
|
||||
e_boundary_at_v_min = hvit;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -605,18 +605,18 @@ avoid the simplification for edge pairs referenced by |e|.}*/
|
|||
CGAL_For_all(hfc,hend) {
|
||||
set_face(hfc,f);
|
||||
if(target(hfc) == target(e_min)) {
|
||||
Point p1 = point(source(hfc)),
|
||||
p2 = point(target(hfc)),
|
||||
p3 = point(target(next(hfc)));
|
||||
const Point& p1 = point(source(hfc));
|
||||
const Point& p2 = point(target(hfc));
|
||||
const Point& p3 = point(target(next(hfc)));
|
||||
if (!K.left_turn(p1,p2,p3) )
|
||||
e_min = hfc;
|
||||
} else if ( K.compare_xy(point(target(hfc)), point(target(e_min))) < 0 )
|
||||
e_min = hfc;
|
||||
linked[hfc]=true;
|
||||
}
|
||||
Point p1 = point(source(e_min)),
|
||||
p2 = point(target(e_min)),
|
||||
p3 = point(target(next(e_min)));
|
||||
const Point& p1 = point(source(e_min));
|
||||
const Point& p2 = point(target(e_min));
|
||||
const Point& p3 = point(target(next(e_min)));
|
||||
if ( K.orientation(p1,p2,p3) > 0 ) set_halfedge(f,e_min); // outer
|
||||
else set_hole(f,e_min); // store as inner
|
||||
}
|
||||
|
|
@ -633,8 +633,8 @@ avoid the simplification for edge pairs referenced by |e|.}*/
|
|||
}
|
||||
} else { // v not isolated
|
||||
Halfedge_handle e2 = first_out_edge(v), e1 = previous(e2);
|
||||
Point p1 = point(source(e1)), p2 = point(v),
|
||||
p3 = point(target(e2));
|
||||
const Point& p1 = point(source(e1)), p2 = point(v);
|
||||
const Point& p3 = point(target(e2));
|
||||
if ( has_outdeg_two(v) &&
|
||||
mark(v) == mark(e1) && mark(v) == mark(e2) &&
|
||||
(K.orientation(p1,p2,p3) == 0) )
|
||||
|
|
@ -838,9 +838,9 @@ void create_face_objects(const Below_info& D) const
|
|||
CGAL_For_all(hfc,hend) {
|
||||
FaceCycle[hfc]=i; // assign face cycle number
|
||||
if(target(hfc) == target(e_min)) {
|
||||
Point p1 = point(source(hfc)),
|
||||
p2 = point(target(hfc)),
|
||||
p3 = point(target(next(hfc)));
|
||||
const Point& p1 = point(source(hfc));
|
||||
const Point&p2 = point(target(hfc));
|
||||
const Point&p3 = point(target(next(hfc)));
|
||||
if (!K.left_turn(p1,p2,p3) )
|
||||
e_min = hfc;
|
||||
} else if ( K.compare_xy(point(target(hfc)), point(target(e_min))) < 0 )
|
||||
|
|
@ -854,10 +854,10 @@ void create_face_objects(const Below_info& D) const
|
|||
Face_handle f_outer = this->new_face();
|
||||
for (int j=0; j<i; ++j) {
|
||||
Halfedge_handle e = MinimalHalfedge[j];
|
||||
CGAL_NEF_TRACEN(" face cycle "<<j);CGAL_NEF_TRACEN(" minimal halfedge "<<PE(e));
|
||||
Point p1 = point(source(e)),
|
||||
p2 = point(target(e)),
|
||||
p3 = point(target(next(e)));
|
||||
CGAL_NEF_TRACEN(" face cycle "<<j);CGAL_NEF_TRACEN(" minimal halfedge "<<PE(e));
|
||||
const Point& p1 = point(source(e));
|
||||
const Point& p2 = point(target(e));
|
||||
const Point& p3 = point(target(next(e)));
|
||||
if ( K.left_turn(p1,p2,p3) ) { // left_turn => outer face cycle
|
||||
CGAL_NEF_TRACEN(" creating new face object");
|
||||
Face_handle f = this->new_face();
|
||||
|
|
@ -899,9 +899,9 @@ void create_face_objects_pl(const Below_info& D) const
|
|||
CGAL_For_all(hfc,hend) {
|
||||
FaceCycle[hfc]=i; // assign face cycle number
|
||||
if(target(hfc) == target(e_min)) {
|
||||
Point p1 = point(source(hfc)),
|
||||
p2 = point(target(hfc)),
|
||||
p3 = point(target(next(hfc)));
|
||||
const Point& p1 = point(source(hfc));
|
||||
const Point& p2 = point(target(hfc));
|
||||
const Point& p3 = point(target(next(hfc)));
|
||||
if (!K.left_turn(p1,p2,p3) )
|
||||
e_min = hfc;
|
||||
} else if ( K.compare_xy(point(target(hfc)), point(target(e_min))) < 0 )
|
||||
|
|
@ -915,10 +915,10 @@ void create_face_objects_pl(const Below_info& D) const
|
|||
(void)/* Face_handle f_outer = */ this->new_face();
|
||||
for (int j=0; j<i; ++j) {
|
||||
Halfedge_handle e = MinimalHalfedge[j];
|
||||
CGAL_NEF_TRACEN(" face cycle "<<j);CGAL_NEF_TRACEN(" minimal halfedge "<<PE(e));
|
||||
Point p1 = point(source(e)),
|
||||
p2 = point(target(e)),
|
||||
p3 = point(target(next(e)));
|
||||
CGAL_NEF_TRACEN(" face cycle "<<j);CGAL_NEF_TRACEN(" minimal halfedge "<<PE(e));
|
||||
const Point& p1 = point(source(e));
|
||||
const Point& p2 = point(target(e));
|
||||
const Point& p3 = point(target(next(e)));
|
||||
if ( K.left_turn(p1,p2,p3) ) { // left_turn => outer face cycle
|
||||
CGAL_NEF_TRACEN(" creating new face object");
|
||||
Face_handle f = this->new_face();
|
||||
|
|
@ -963,8 +963,8 @@ Segment segment(const Const_decorator& N,
|
|||
|
||||
bool is_forward_edge(const Const_decorator& N,
|
||||
Halfedge_const_iterator hit) const
|
||||
{ Point p1 = N.point(N.source(hit));
|
||||
Point p2 = N.point(N.target(hit));
|
||||
{ const Point& p1 = N.point(N.source(hit));
|
||||
const Point& p2 = N.point(N.target(hit));
|
||||
return (K.compare_xy(p1,p2) < 0); }
|
||||
|
||||
void assert_type_precondition() const
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ struct PM_persistent_PL_traits
|
|||
|
||||
EdgeCategory ClassifyEdge(const Graph& G, const Edge& e, const Node& u)
|
||||
{
|
||||
Point p_u = G.point(u);
|
||||
Point p_v = G.point(opposite(G,e,u));
|
||||
const Point& p_u = G.point(u);
|
||||
const Point& p_v = G.point(opposite(G,e,u));
|
||||
|
||||
int cmpX = pK->compare_x(p_u, p_v);
|
||||
if ( cmpX < 0 ) return StartingNonVertical;
|
||||
|
|
@ -111,7 +111,8 @@ struct PM_persistent_PL_traits
|
|||
Curve makeCurve(const Graph& G, const Node& n) const
|
||||
{ return makeCurve(G.point(n)); }
|
||||
Curve makeCurve(const Graph& G, const Edge& e) const
|
||||
{ Point ps = G.point(G.source(e)), pt = G.point(G.target(e));
|
||||
{ const Point& ps = G.point(G.source(e));
|
||||
const Point& pt = G.point(G.target(e));
|
||||
Curve res(G.point(G.source(e)),G.point(G.target(e)));
|
||||
if ( pK->compare_xy(ps,pt) < 0 ) res = pK->construct_segment(ps,pt);
|
||||
else res = pK->construct_segment(pt,ps);
|
||||
|
|
@ -135,10 +136,10 @@ struct PM_persistent_PL_traits
|
|||
|
||||
int operator()(const Curve& s1, const Curve& s2) const
|
||||
{
|
||||
Point a = pK->source(s1);
|
||||
Point b = pK->target(s1);
|
||||
Point c = pK->source(s2);
|
||||
Point d = pK->target(s2);
|
||||
const Point& a = pK->source(s1);
|
||||
const Point& b = pK->target(s1);
|
||||
const Point& c = pK->source(s2);
|
||||
const Point& d = pK->target(s2);
|
||||
if ( a==b )
|
||||
if ( c==d ) return pK->compare_y(a,c);
|
||||
else return cmppntseg(a, s2);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public:
|
|||
{ CGAL_NEF_TRACEN("out_wedge "<<PV(v));
|
||||
CGAL_assertion(!is_isolated(v));
|
||||
collinear=false;
|
||||
Point p = point(v);
|
||||
const Point& p = point(v);
|
||||
Halfedge_const_handle e_res = first_out_edge(v);
|
||||
Direction d_res = direction(e_res);
|
||||
Halfedge_around_vertex_const_circulator el(e_res),ee(el);
|
||||
|
|
@ -219,7 +219,7 @@ public:
|
|||
{ CGAL_NEF_TRACEN("locate naivly "<<s);
|
||||
if (this->number_of_vertices() == 0)
|
||||
CGAL_error_msg("PM_naive_point_locator: plane map is empty.");
|
||||
Point p = K.source(s);
|
||||
const Point& p = K.source(s);
|
||||
Vertex_const_iterator vit;
|
||||
for(vit = this->vertices_begin(); vit != this->vertices_end(); ++vit) {
|
||||
if ( p == point(vit) ) return make_object(vit);
|
||||
|
|
@ -236,7 +236,7 @@ public:
|
|||
Direction dso = K.construct_direction(K.target(s),p), d_res;
|
||||
CGAL::Unique_hash_map<Halfedge_const_handle,bool> visited(false);
|
||||
for(vit = this->vertices_begin(); vit != this->vertices_end(); ++vit) {
|
||||
Point p_res, vp = point(vit);
|
||||
const Point& vp = point(vit);
|
||||
if ( K.contains(ss,vp) ) {
|
||||
CGAL_NEF_TRACEN(" location via vertex at "<<vp);
|
||||
ss = K.construct_segment(p,vp); // we shrink the segment
|
||||
|
|
@ -260,8 +260,8 @@ public:
|
|||
|
||||
for (eit = this->halfedges_begin(); eit != this->halfedges_end(); ++eit) {
|
||||
if ( visited[eit] ) continue;
|
||||
Point se = point(source(eit)),
|
||||
te = point(target(eit));
|
||||
const Point& se = point(source(eit));
|
||||
const Point& te = point(target(eit));
|
||||
int o1 = K.orientation(ss,se);
|
||||
int o2 = K.orientation(ss,te);
|
||||
if ( o1 == -o2 && // internal intersection
|
||||
|
|
@ -298,7 +298,7 @@ public:
|
|||
along |s| does not hit any object |h| of |P| with |M(h)|.}*/
|
||||
{ CGAL_NEF_TRACEN("naive ray_shoot "<<s);
|
||||
CGAL_assertion( !K.is_degenerate(s) );
|
||||
Point p = K.source(s);
|
||||
const Point& p = K.source(s);
|
||||
Segment ss(s);
|
||||
Direction d = K.construct_direction(K.source(s),K.target(s));
|
||||
Object_handle h = locate(s);
|
||||
|
|
@ -311,7 +311,7 @@ public:
|
|||
h = Object_handle();
|
||||
CGAL_NEF_TRACEN("not contained");
|
||||
for (v = this->vertices_begin(); v != this->vertices_end(); ++v) {
|
||||
Point pv = point(v);
|
||||
const Point& pv = point(v);
|
||||
if ( !K.contains(ss,pv) ) continue;
|
||||
CGAL_NEF_TRACEN("candidate "<<pv);
|
||||
if ( M(v) ) {
|
||||
|
|
@ -643,10 +643,10 @@ protected:
|
|||
Halfedge_handle e3 = next(e);
|
||||
// e1,e3: edges of quadrilateral with diagonal e
|
||||
|
||||
Point a = point(source(e1));
|
||||
Point b = point(target(e1));
|
||||
Point c = point(source(e3));
|
||||
Point d = point(target(e3));
|
||||
const Point& a = point(source(e1));
|
||||
const Point& b = point(target(e1));
|
||||
const Point& c = point(source(e3));
|
||||
const Point& d = point(target(e3));
|
||||
|
||||
if (! (this->K.orientation(b,d,a) > 0 && // left_turn
|
||||
this->K.orientation(b,d,c) < 0) ) // right_turn
|
||||
|
|
@ -731,7 +731,7 @@ public:
|
|||
Halfedge_const_handle& e,
|
||||
const Tag_false& ) const {
|
||||
CGAL_NEF_TRACEN("target on outer facet");
|
||||
Point p = this->K.source(s);
|
||||
const Point& p = this->K.source(s);
|
||||
Vertex_const_handle v1 = CT.vertices_begin();
|
||||
Halfedge_const_handle e1 = CT.twin(CT.first_out_edge(v1));
|
||||
Halfedge_around_face_const_circulator circ(e1), end(circ);
|
||||
|
|
@ -782,7 +782,7 @@ public:
|
|||
{ Segment s(ss);
|
||||
CGAL_NEF_TRACEN("ray_shoot "<<s);
|
||||
CGAL_assertion( !this->K.is_degenerate(s) );
|
||||
Point p = this->K.source(s);
|
||||
const Point& p = this->K.source(s);
|
||||
Direction d = this->K.construct_direction(p,s.target());
|
||||
Vertex_const_handle v;
|
||||
Halfedge_const_handle e;
|
||||
|
|
@ -813,9 +813,9 @@ public:
|
|||
if ( M(input_face(e)) ) // face mark
|
||||
return make_object(input_face(e));
|
||||
|
||||
Point p1 = CT.point(CT.source(e)),
|
||||
p2 = CT.point(CT.target(e)),
|
||||
p3 = CT.point(CT.target(next(e)));
|
||||
const Point& p1 = CT.point(CT.source(e));
|
||||
const Point& p2 = CT.point(CT.target(e));
|
||||
const Point& p3 = CT.point(CT.target(next(e)));
|
||||
int or1 = this->K.orientation(p,s.target(),p1);
|
||||
int or2 = this->K.orientation(p,s.target(),p2);
|
||||
int or3 = this->K.orientation(p,s.target(),p3);
|
||||
|
|
@ -999,7 +999,7 @@ PM_point_locator<PMD,GEO>::walk_in_triangulation(const Point& q) const
|
|||
return Object_handle();
|
||||
|
||||
Halfedge_const_handle e;
|
||||
Point p = CT.point(v);
|
||||
const Point& p = CT.point(v);
|
||||
if ( p == q ) return make_object(v);
|
||||
// Segment s = this->K.construct_segment(p,q);
|
||||
Direction dir = this->K.construct_direction(p,q);
|
||||
|
|
|
|||
|
|
@ -161,11 +161,13 @@ public:
|
|||
}
|
||||
|
||||
|
||||
Point_2 source(ISegment is) const
|
||||
Point_2 source(const ISegment& is) const
|
||||
{ return K.source(is->first()); }
|
||||
Point_2 target(ISegment is) const
|
||||
|
||||
Point_2 target(const ISegment& is) const
|
||||
{ return K.target(is->first()); }
|
||||
ITERATOR original(ISegment s) const
|
||||
|
||||
ITERATOR original(xonst ISegment& s) const
|
||||
{ return s->second(); }
|
||||
|
||||
int orientation(ST_item sit, const Point_2& p) const
|
||||
|
|
@ -474,7 +476,7 @@ public:
|
|||
|
||||
public:
|
||||
compare_segs_at_sweepline(const Point_2& pi,
|
||||
ISegment s1, ISegment s2,
|
||||
ISegment s1, ISegment s2,
|
||||
const GEOMETRY& k)
|
||||
: p(pi), s_bottom(s1), s_top(s2), K(k)
|
||||
{}
|
||||
|
|
@ -673,6 +675,7 @@ public:
|
|||
|
||||
Point_2 source(ISegment is) const
|
||||
{ return K.source(is->first); }
|
||||
|
||||
Point_2 target(ISegment is) const
|
||||
{ return K.target(is->first); }
|
||||
|
||||
|
|
@ -687,7 +690,8 @@ public:
|
|||
*sit1 == &sh ||
|
||||
*sit2 == &sl ||
|
||||
*sit2 == &sh) return false;
|
||||
Point_2 ps = source(*sit2), pt = target(*sit2);
|
||||
const Point_2& ps = source(*sit2);
|
||||
const Point_2& pt = target(*sit2);
|
||||
return ( orientation(sit1,ps)==0 &&
|
||||
orientation(sit1,pt)==0 );
|
||||
}
|
||||
|
|
@ -758,8 +762,8 @@ public:
|
|||
continue; // ignore zero-length segments regarding YS
|
||||
}
|
||||
|
||||
Point_2 p = *it1;
|
||||
Point_2 q = *it2;
|
||||
const Point_2& p = *it1;
|
||||
const Point_2& q = *it2;
|
||||
|
||||
Segment_2 s1;
|
||||
if ( K.compare_xy(p,q) < 0 )
|
||||
|
|
|
|||
Loading…
Reference in New Issue