mirror of https://github.com/CGAL/cgal
Add Origin based constructor to sphere_point and avoid conditional constructor
This commit is contained in:
parent
8ab3b8ffda
commit
a0d5fae2bd
|
|
@ -2037,7 +2037,7 @@ class SNC_constructor<SNC_indexed_items, SNC_structure_>
|
|||
D.link_as_isolated_vertex(v2, f2);
|
||||
D.link_as_loop(l,f1);
|
||||
D.link_as_loop(l->twin(),f2);
|
||||
l->circle() = Sphere_circle(faces_p->plane());
|
||||
l->circle() = Sphere_circle(CGAL::ORIGIN,faces_p->plane());
|
||||
l->twin()->circle() = l->circle().opposite();
|
||||
f2->mark() = mf2;
|
||||
l->mark() = l->twin()->mark() = ml;
|
||||
|
|
@ -2053,7 +2053,7 @@ class SNC_constructor<SNC_indexed_items, SNC_structure_>
|
|||
SHalfedge_handle se1;
|
||||
SHalfedge_handle se2;
|
||||
SFace_handle sf;
|
||||
Sphere_circle c(f->plane());
|
||||
Sphere_circle c(CGAL::ORIGIN,f->plane());
|
||||
|
||||
SHalfedge_handle next_edge;
|
||||
SHalfedge_around_svertex_const_circulator ec(E.out_edges(e)), ee(ec);
|
||||
|
|
@ -2104,7 +2104,7 @@ class SNC_constructor<SNC_indexed_items, SNC_structure_>
|
|||
se1 = D.new_shalfedge_pair(ec2->twin(), en->twin(), -1, 1);
|
||||
CGAL_NEF_TRACEN("new edge pair " << ec2->twin()->source()->vector() <<
|
||||
" -> " << en->twin()->source()->vector());
|
||||
se1->circle() = Sphere_circle(faces_p->plane());
|
||||
se1->circle() = Sphere_circle(CGAL::ORIGIN,faces_p->plane());
|
||||
se1->twin()->circle() = se1->circle().opposite();
|
||||
se1->mark() = se1->twin()->mark() = BOP(mark_of_right_sface[ec2], faces_p->mark(), inv);
|
||||
|
||||
|
|
|
|||
|
|
@ -250,8 +250,7 @@ void polygon_mesh_to_nef_3(PolygonMesh& P, SNC_structure& S, FaceIndexMap fimap,
|
|||
with_border = true;
|
||||
else {
|
||||
std::size_t i = get(fimap,face(pe_prev,P));
|
||||
Plane ss_plane( CGAL::ORIGIN, normals[i]);
|
||||
Sphere_circle ss_circle(ss_plane);
|
||||
Sphere_circle ss_circle(CGAL::ORIGIN, normals[i]);
|
||||
CGAL_assertion_code(if(num_edges[i] > 3) {
|
||||
CGAL_assertion(ss_circle.has_on(sp));
|
||||
CGAL_assertion(ss_circle.has_on(sv_prev->point()));
|
||||
|
|
@ -283,8 +282,7 @@ void polygon_mesh_to_nef_3(PolygonMesh& P, SNC_structure& S, FaceIndexMap fimap,
|
|||
e = sv_prev->out_sedge();
|
||||
} else {
|
||||
std::size_t i = get(fimap,face(pe_prev,P));
|
||||
Plane ss_plane( CGAL::ORIGIN, normals[i]);
|
||||
Sphere_circle ss_circle(ss_plane);
|
||||
Sphere_circle ss_circle(CGAL::ORIGIN, normals[i]);
|
||||
|
||||
CGAL_assertion_code(if(num_edges[i] > 3) {
|
||||
CGAL_assertion(ss_circle.has_on(sp_0));
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Nef_S2/Sphere_point.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ typedef std::pair< Sphere_segment<R>,Sphere_segment<R> >
|
|||
typedef typename R_::Plane_3 Plane_3;
|
||||
typedef typename R_::Line_3 Line_3;
|
||||
typedef typename R_::Point_3 Point_3;
|
||||
typedef typename R_::Vector_3 Vector_3;
|
||||
typedef Sphere_circle<R_> Self;
|
||||
typedef typename R_::Plane_3 Base;
|
||||
|
||||
|
|
@ -78,15 +80,20 @@ create any great circle that contains $p$ and $q$.}*/
|
|||
}
|
||||
}
|
||||
|
||||
Sphere_circle(const Plane_3& h) : Base(h)
|
||||
Sphere_circle(const Plane_3& h) : Base(h)
|
||||
/*{\Mcreate creates the circle of $S_2$ corresponding to the plane
|
||||
|h|. If |h| does not contain the origin, then |\Mvar| becomes the
|
||||
circle parallel to |h| containing the origin.}*/
|
||||
{
|
||||
if(h.d() != 0) *this = Plane_3(h.a(),h.b(),h.c(),RT(0));
|
||||
if(h.d() != 0)
|
||||
*this = Plane_3(h.a(),h.b(),h.c(),RT(0));
|
||||
}
|
||||
|
||||
Sphere_circle(const RT& x, const RT& y, const RT& z): Base(x,y,z,0) {}
|
||||
Sphere_circle(const Origin& o, const Vector_3& v) : Base(o,v) {}
|
||||
|
||||
Sphere_circle(const Origin&, const Plane_3& h) : Base(h.a(),h.b(),h.c(),RT(0)) {}
|
||||
|
||||
Sphere_circle(const RT& x, const RT& y, const RT& z) : Base(x,y,z,0) {}
|
||||
|
||||
/*{\Mcreate creates the circle orthogonal to the vector $(x,y,z)$.}*/
|
||||
|
||||
|
|
@ -102,10 +109,9 @@ Sphere_circle(Sphere_circle<R> c, const Sphere_point<R>& p)
|
|||
}
|
||||
|
||||
/*{\Moperations 4 2}*/
|
||||
|
||||
Sphere_circle<R> opposite() const
|
||||
/*{\Mop returns the opposite of |\Mvar|.}*/
|
||||
{ return Base::opposite(); }
|
||||
{ return Sphere_circle<R>(Base::opposite(),Private_tag{}); }
|
||||
|
||||
bool has_on(const Sphere_point<R>& p) const
|
||||
/*{\Mop returns true iff |\Mvar| contains |p|.}*/
|
||||
|
|
@ -117,7 +123,7 @@ Plane_3 plane() const { return Base(*this); }
|
|||
Plane_3 plane_through(const Point_3& p) const
|
||||
/*{\Mop returns the plane parallel to |\Mvar| that
|
||||
contains point |p|.}*/
|
||||
{ return Plane_3(p,((Base*) this)->orthogonal_direction()); }
|
||||
{ return Plane_3(p,((Base*) this)->orthogonal_vector()); }
|
||||
|
||||
Sphere_point<R> orthogonal_pole() const
|
||||
/*{\Mop returns the point that is the pole of the
|
||||
|
|
@ -134,6 +140,10 @@ of splitting |\Mvar| at the $x$-$y$-coordinate plane if |\Mvar|
|
|||
is not part of it. Otherwise |\Mvar| is split at the
|
||||
$x$-$z$-coordinate plane.}*/
|
||||
|
||||
private:
|
||||
struct Private_tag{};
|
||||
Sphere_circle(const Plane_3& h,Private_tag) : Base(h){}
|
||||
|
||||
}; // Sphere_circle<R>
|
||||
|
||||
/*{\Mtext\headerline{Global functions}}*/
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <CGAL/Handle_for.h>
|
||||
#include <CGAL/Nef_S2/Sphere_point.h>
|
||||
#include <CGAL/Nef_S2/Sphere_circle.h>
|
||||
#include <CGAL/Kernel/global_functions.h>
|
||||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -37,7 +38,7 @@ Sphere_segment_rep() { ps_ = pt_ = Point(); c_ = Circle(); }
|
|||
|
||||
Sphere_segment_rep(const Point& p1, const Point& p2,
|
||||
bool shorter_arc=true) :
|
||||
ps_(p1), pt_(p2), c_(Plane_3(p1,p2,Point_3(CGAL::ORIGIN)))
|
||||
ps_(p1), pt_(p2), c_(CGAL::ORIGIN,CGAL::orthogonal_vector(p1,p2,Point_3(CGAL::ORIGIN)))
|
||||
{ // warning stays as reminder that one gets an arbitrary plane equation
|
||||
// in this degenerate case
|
||||
CGAL_warning(p1 != p2.antipode());
|
||||
|
|
|
|||
Loading…
Reference in New Issue