mirror of https://github.com/CGAL/cgal
More code for ORIGIN
This commit is contained in:
parent
26571bf354
commit
9023aaa542
|
|
@ -41,6 +41,23 @@ plane_from_points(const typename R::Point_3 &p,
|
|||
return PlaneC3<R>(a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
template <class R>
|
||||
CGAL_KERNEL_LARGE_INLINE
|
||||
PlaneC3<R>
|
||||
plane_from_points(Origin,
|
||||
const typename R::Point_3 &q,
|
||||
const typename R::Point_3 &r)
|
||||
{
|
||||
typename R::FT a, b, c, d(0);
|
||||
plane_from_pointsC3( /* origin, */
|
||||
q.x(), q.y(), q.z(),
|
||||
r.x(), r.y(), r.z(),
|
||||
a, b, c);
|
||||
return PlaneC3<R>(a, b, c, d);
|
||||
}
|
||||
|
||||
|
||||
template <class R>
|
||||
CGAL_KERNEL_LARGE_INLINE
|
||||
PlaneC3<R>
|
||||
|
|
@ -53,7 +70,7 @@ plane_from_point_direction(const typename R::Point_3 &p,
|
|||
return PlaneC3<R>(A, B, C, D);
|
||||
}
|
||||
|
||||
template <class R>
|
||||
template <class R>
|
||||
CGAL_KERNEL_LARGE_INLINE
|
||||
PlaneC3<R>
|
||||
plane_from_point_direction(Origin,
|
||||
|
|
|
|||
|
|
@ -238,6 +238,22 @@ plane_from_pointsC3(const FT &px, const FT &py, const FT &pz,
|
|||
pd = - pa*rx - pb*ry - pc*rz;
|
||||
}
|
||||
|
||||
|
||||
template <class FT>
|
||||
CGAL_KERNEL_MEDIUM_INLINE
|
||||
void
|
||||
plane_from_pointsC3( /* origin */
|
||||
const FT &qx, const FT &qy, const FT &qz,
|
||||
const FT &rx, const FT &ry, const FT &rz,
|
||||
FT &pa, FT &pb, FT &pc /* , zero */ )
|
||||
{
|
||||
pa = qy*rz - ry*qz;
|
||||
pb = qz*rx - rz*qx;
|
||||
pc = qx*ry - rx*qy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class FT>
|
||||
CGAL_KERNEL_MEDIUM_INLINE
|
||||
void
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public:
|
|||
PlaneH3() {}
|
||||
|
||||
PlaneH3(const Point_3&, const Point_3&, const Point_3& );
|
||||
PlaneH3(Origin, const Point_3&, const Point_3& );
|
||||
PlaneH3(const RT& a, const RT& b,
|
||||
const RT& c, const RT& d );
|
||||
PlaneH3(const Point_3&, const Ray_3& );
|
||||
|
|
@ -175,6 +176,16 @@ PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
|||
const typename PlaneH3<R>::Point_3& r)
|
||||
{ new_rep(p,q,r); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(Origin,
|
||||
const typename PlaneH3<R>::Point_3& q,
|
||||
const typename PlaneH3<R>::Point_3& r)
|
||||
{
|
||||
typename PlaneH3<R>::Point_3 p(0,0,0);
|
||||
new_rep(p,q,r);
|
||||
}
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const RT& a, const RT& b,
|
||||
|
|
@ -190,37 +201,37 @@ PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p ,
|
|||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
||||
const typename PlaneH3<R>::Segment_3& s)
|
||||
const typename PlaneH3<R>::Segment_3& s)
|
||||
{ new_rep(p, s.source(), s.target() ); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p ,
|
||||
const typename PlaneH3<R>::Ray_3& r)
|
||||
const typename PlaneH3<R>::Ray_3& r)
|
||||
{ new_rep(p, r.start(), r.start() + r.direction().to_vector() ); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Line_3& l ,
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
{ new_rep(l.point(0), p, l.point(1) ); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Segment_3& s,
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
{ new_rep(s.source(), p, s.target() ); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Ray_3& r,
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
const typename PlaneH3<R>::Point_3& p)
|
||||
{ new_rep(r.start(), p, r.start() + r.direction().to_vector() ); }
|
||||
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
||||
const typename PlaneH3<R>::Direction_3& d)
|
||||
const typename PlaneH3<R>::Direction_3& d)
|
||||
{
|
||||
Vector_3 ov = d.to_vector();
|
||||
new_rep( ov.hx()*p.hw(),
|
||||
|
|
@ -232,7 +243,7 @@ PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
|||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
||||
const typename PlaneH3<R>::Vector_3& ov)
|
||||
const typename PlaneH3<R>::Vector_3& ov)
|
||||
{
|
||||
new_rep( ov.hx()*p.hw(),
|
||||
ov.hy()*p.hw(),
|
||||
|
|
@ -254,8 +265,8 @@ PlaneH3<R>::PlaneH3(Origin,
|
|||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
|
||||
const typename PlaneH3<R>::Direction_3& d1,
|
||||
const typename PlaneH3<R>::Direction_3& d2)
|
||||
const typename PlaneH3<R>::Direction_3& d1,
|
||||
const typename PlaneH3<R>::Direction_3& d2)
|
||||
{ new_rep( p, p + d1.to_vector(), p + d2.to_vector() ); }
|
||||
|
||||
template < class R >
|
||||
|
|
|
|||
|
|
@ -2039,6 +2039,10 @@ namespace CommonKernelFunctors {
|
|||
operator()(Return_base_tag, const Point_3& p, const Point_3& q, const Point_3& r) const
|
||||
{ return Rep(p, q, r); }
|
||||
|
||||
Rep // Plane_3
|
||||
operator()(Return_base_tag, Origin o, const Point_3& q, const Point_3& r) const
|
||||
{ return Rep(o, q, r); }
|
||||
|
||||
Rep // Plane_3
|
||||
operator()(Return_base_tag, const Point_3& p, const Direction_3& d) const
|
||||
{ return Rep(p, d); }
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ public:
|
|||
Plane_3(const Point_3& p, const Point_3& q, const Point_3& r)
|
||||
: Rep(typename R::Construct_plane_3()(Return_base_tag(), p, q, r)) {}
|
||||
|
||||
Plane_3(Origin o, const Point_3& q, const Point_3& r)
|
||||
: Rep(typename R::Construct_plane_3()(Return_base_tag(), o, q, r)) {}
|
||||
|
||||
Plane_3(const Point_3& p, const Direction_3& d)
|
||||
: Rep(typename R::Construct_plane_3()(Return_base_tag(), p, d)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Sphere_circle() : Base() {}
|
|||
/*{\Mcreate creates some great circle.}*/
|
||||
|
||||
Sphere_circle(const Sphere_point<R>& p, const Sphere_point<R>&q)
|
||||
: Base(Point_3(0,0,0),p,q)
|
||||
: Base(CGAL::ORIGIN,p,q)
|
||||
/*{\Mcreate creates a great circle through $p$ and $q$. If $p$ and
|
||||
$q$ are not antipodal on $S_2$, then this circle is unique and oriented
|
||||
such that a walk along |\Mvar| meets $p$ just before the shorter segment
|
||||
|
|
@ -104,9 +104,9 @@ Sphere_circle(Sphere_circle<R> c, const Sphere_point<R>& p)
|
|||
{ CGAL_assertion(!c.has_on(p));
|
||||
if ( c.has_on_negative_side(p) ) c=c.opposite();
|
||||
if ( p == c.orthogonal_pole() )
|
||||
*this = Sphere_circle<R>(Base(Point_3(0,0,0),p,CGAL::ORIGIN+c.base1()));
|
||||
*this = Sphere_circle<R>(Base(CGAL::ORIGIN,p,CGAL::ORIGIN+c.base1()));
|
||||
else
|
||||
*this = Sphere_circle<R>(Base(Point_3(0,0,0),p,c.orthogonal_pole()));
|
||||
*this = Sphere_circle<R>(Base(CGAL::ORIGIN,p,c.orthogonal_pole()));
|
||||
}
|
||||
|
||||
/*{\Moperations 4 2}*/
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ Sphere_direction(const Sphere_circle<R>& c)
|
|||
: Base(c) {}
|
||||
|
||||
Sphere_direction(const Sphere_point<R>& p, const Sphere_point<R>&q)
|
||||
: Base(Point_3(0,0,0),p,q)
|
||||
: Base(CGAL::ORIGIN,p,q)
|
||||
/*{\Mcreate creates a direction that describes the orientation of
|
||||
the great circle through $p$ and $q$ (oriented such that the segment
|
||||
$pq$ is the shorter one of the two possible ones. \precond $p$ and $q$
|
||||
are not opposite on $S_2$.}*/
|
||||
{ CGAL_assertion(p!=q.opposite());
|
||||
Point_3 p4 = CGAL::ORIGIN + ((Base*) this)->orthogonal_vector();
|
||||
if ( CGAL::orientation(CGAL::ORIGIN,p,q,p4) != CGAL::POSITIVE )
|
||||
if ( R().orientation_3_object()(CGAL::ORIGIN,p,q,p4) != CGAL::POSITIVE )
|
||||
*this = Sphere_direction(opposite());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue