Add Plane_3 constructor with Origin/Vector_3

This commit is contained in:
Andreas Fabri 2022-03-17 22:35:09 +01:00
parent 2edb6dcf32
commit 71bba3e226
6 changed files with 32 additions and 1 deletions

View File

@ -60,6 +60,9 @@ public:
PlaneC3(const Point_3 &p, const Vector_3 &v)
{ *this = plane_from_point_direction<R>(p, v.direction()); }
PlaneC3(Origin o, const Vector_3 &v)
{ *this = plane_from_point_direction<R>(o, v.direction()); }
PlaneC3(const FT &a, const FT &b, const FT &c, const FT &d)
: base(CGAL::make_array(a, b, c, d)) {}

View File

@ -53,6 +53,15 @@ plane_from_point_direction(const typename R::Point_3 &p,
return PlaneC3<R>(A, B, C, D);
}
template <class R>
CGAL_KERNEL_LARGE_INLINE
PlaneC3<R>
plane_from_point_direction(Origin o,
const typename R::Direction_3 &d)
{
return PlaneC3<R>(d.dx(), d.dy(), d.dz(), 0);
}
} //namespace CGAL
#endif // CGAL_CARTESIAN_PLANE_CONSTRUCTIONS_3_H

View File

@ -58,6 +58,7 @@ public:
PlaneH3(const Ray_3&, const Point_3& );
PlaneH3(const Point_3&, const Direction_3& );
PlaneH3(const Point_3&, const Vector_3& );
PlaneH3(Origin, const Vector_3& );
PlaneH3(const Point_3&, const Direction_3&, const Direction_3& );
const RT & a() const;
@ -239,6 +240,17 @@ PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
-(ov.hx()*p.hx() + ov.hy()*p.hy() + ov.hz()*p.hz() ) );
}
template < class R >
CGAL_KERNEL_INLINE
PlaneH3<R>::PlaneH3(Origin,
const typename PlaneH3<R>::Vector_3& ov)
{
new_rep( ov.hx(),
ov.hy(),
ov.hz(),
RT(0) );
}
template < class R >
CGAL_KERNEL_INLINE
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,

View File

@ -2046,6 +2046,10 @@ namespace CommonKernelFunctors {
operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const
{ return Rep(p, v); }
Rep // Plane_3
operator()(Return_base_tag, Origin o, const Vector_3& v) const
{ return Rep(o, v); }
Rep // Plane_3
operator()(Return_base_tag, const Line_3& l, const Point_3& p) const
{ return Rep(l, p); }

View File

@ -78,6 +78,9 @@ public:
Plane_3(const Point_3& p, const Vector_3& v)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), p, v)) {}
Plane_3(Origin o, const Vector_3& v)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), o, v)) {}
Plane_3(const RT& a, const RT& b, const RT& c, const RT& d)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), a, b, c, d)) {}

View File

@ -43,7 +43,7 @@ Sphere_segment_rep(const Point& p1, const Point& p2,
CGAL_warning(p1 != p2.antipode());
CGAL_assertion(p1 != p2.antipode());
if ( p1 == p2 ) {
Plane_3 h(Point_3(CGAL::ORIGIN),(p1-CGAL::ORIGIN));
Plane_3 h(CGAL::ORIGIN, (p1-CGAL::ORIGIN));
c_ = Sphere_circle<R_>(Plane_3(Point_3(CGAL::ORIGIN),h.base1()));
}
if (!shorter_arc) c_ = c_.opposite();