added centroid and Construct_centroid_[23]

This commit is contained in:
Susan Hert 2001-06-19 14:31:24 +00:00
parent 7704a8e4d7
commit 5fa8a239b0
33 changed files with 481 additions and 3 deletions

View File

@ -1,4 +1,7 @@
2.25 (18 June 2001)
2.26 (19 June 2001)
- added centroid and Construct_centroid_[23]
2.25 (19 June 2001)
- Added Bounded_side_2, Bounded_side_3
2.24 (18 June 2001)

View File

@ -99,6 +99,8 @@ for equality testing.
\ccGlue
\ccNestedType{Construct_center_2}{}
\ccGlue
\ccNestedType{Construct_centroid_2}{}
\ccGlue
\ccNestedType{Construct_circumcenter_2}{}
\ccGlue
\ccNestedType{Construct_bisector_2}{}
@ -303,6 +305,8 @@ If the result type is a number type, the prefix is \ccc{Compute_}:
\ccGlue
\ccNestedType{Construct_center_3}{}
\ccGlue
\ccNestedType{Construct_centroid_3}{}
\ccGlue
\ccNestedType{Construct_circumcenter_3}{}
\ccGlue
\ccNestedType{Construct_cross_product_vector_3}{}
@ -487,6 +491,8 @@ an \ccc{_object} suffix.
\ccGlue
\ccMemberFunction{Kernel::Construct_midpoint_2 construct_midpoint_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_centroid_2 construct_centroid_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_circumcenter_2 construct_circumcenter_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_bisector_2 construct_bisector_2_object() const ;}{}
@ -653,6 +659,8 @@ an \ccc{_object} suffix.
\ccGlue
\ccMemberFunction{Kernel::Construct_midpoint_3 construct_midpoint_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_centroid_3 construct_centroid_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_circumcenter_3 construct_circumcenter_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_cross_product_vector_3 construct_cross_product_vector_3_object() const ;}{}

View File

@ -0,0 +1,17 @@
\begin{ccRefFunctionObjectConcept}{Kernel::Construct_centroid_2}
A model for this must provide:
\ccCreationVariable{fo}
\ccMemberFunction{Kernel::Point_2 operator()(const Kernel::Point_2&p,
const Kernel::Point_2&q,
const Kernel::Point_2&r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccMemberFunction{Kernel::Point_2 operator()(const Kernel::Point_2&p,
const Kernel::Point_2&q,
const Kernel::Point_2&r,
const Kernel::Point_2&r);}
{compute the centroid of the points $p$, $q$, $r$ and $s$.}
\end{ccRefFunctionObjectConcept}

View File

@ -0,0 +1,17 @@
\begin{ccRefFunctionObjectConcept}{Kernel::Construct_centroid_3}
A model for this must provide:
\ccCreationVariable{fo}
\ccMemberFunction{Kernel::Point_3 operator()(const Kernel::Point_3&p,
const Kernel::Point_3&q,
const Kernel::Point_3&r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccMemberFunction{Kernel::Point_3 operator()(const Kernel::Point_3&p,
const Kernel::Point_3&q,
const Kernel::Point_3&r,
const Kernel::Point_3&r);}
{compute the centroid of the points $p$, $q$, $r$ and $s$.}
\end{ccRefFunctionObjectConcept}

View File

@ -0,0 +1,32 @@
\begin{ccRefFunction}{centroid}
\ccInclude{CGAL/basic_constructions_2.h}
\ccFunction{Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccFunction{Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r,
const Point_2<R>& s);}
{compute the centroid of the points $p$, $q$, $r$, and $s$.}
\ccInclude{CGAL/basic_constructions_3.h}
\ccFunction{Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccFunction{Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r,
const Point_3<R>& s);}
{compute the centroid of the points $p$, $q$, $r$, and $s$.}
\end{ccRefFunction}

View File

@ -37,6 +37,8 @@
\KernelRefLayout
\input{Ref/cartesian_to_homogeneous.tex}
\KernelRefLayout
\input{Ref/centroid.tex}
\KernelRefLayout
\input{Ref/Circle_2.tex}
\KernelRefLayout
\input{Ref/circumcenter.tex}
@ -229,6 +231,10 @@
\KernelRefLayout
\input{Ref/Kernel_Construct_center_3.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_centroid_2.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_centroid_3.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_circle_2.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_circumcenter_2.tex} %ck

View File

@ -1,4 +1,7 @@
3.42 (18 June 2001)
3.43 (19 June 2001)
- added Construct_centroid_[23]
3.42 (19 June 2001)
- added Bounded_side_2 and Bounded_side_3 to traits
3.41 (18 June 2001)

View File

@ -254,6 +254,22 @@ class p_Circumcenter
{ return circumcenter(p,q,r,s); }
};
template <class Point>
class p_Centroid
{
public:
typedef Point result_type;
Point
operator()(const Point& p, const Point& q, const Point& r) const
{ return centroid(p,q,r); }
Point
operator()(const Point& p, const Point& q,
const Point& r, const Point& s) const
{ return centroid(p,q,r,s); }
};
template <class Point, class Line>
class pl_Bisector
{

View File

@ -69,6 +69,7 @@ typedef CGALi::Call_perpendicular_to_get<Line_2>
typedef CGALi::p_Midpoint<Point_2> Construct_midpoint_2;
typedef CGALi::p_Center<Point_2> Construct_center_2;
typedef CGALi::p_Circumcenter<Point_2> Construct_circumcenter_2;
typedef CGALi::p_Centroid<Point_2> Construct_centroid_2;
typedef CGALi::pl_Bisector<Point_2, Line_2> Construct_bisector_2;
CGAL_Kernel_obj(Construct_point_on_2, construct_point_on_2_object)
@ -93,6 +94,7 @@ CGAL_Kernel_obj(Construct_perpendicular_line_2,
CGAL_Kernel_obj(Construct_midpoint_2, construct_midpoint_2_object)
CGAL_Kernel_obj(Construct_center_2, construct_center_2_object)
CGAL_Kernel_obj(Construct_circumcenter_2, construct_circumcenter_2_object)
CGAL_Kernel_obj(Construct_centroid_2, construct_centroid_2_object)
CGAL_Kernel_obj(Construct_bisector_2, construct_bisector_2_object)
@ -285,6 +287,7 @@ typedef CGALi::Call_perpendicular_line_to_get<Line_3>
typedef CGALi::p_Midpoint<Point_3> Construct_midpoint_3;
typedef CGALi::p_Center<Point_3> Construct_center_3;
typedef CGALi::p_Circumcenter<Point_3> Construct_circumcenter_3;
typedef CGALi::p_Centroid<Point_3> Construct_centroid_3;
typedef CGALi::v_Cross_product<Vector_3> Construct_cross_product_vector_3;
typedef CGALi::Call_opposite_to_get<Segment_3> Construct_opposite_segment_3;
typedef CGALi::Call_opposite_to_get<Ray_3> Construct_opposite_ray_3;
@ -317,6 +320,7 @@ CGAL_Kernel_obj(Construct_perpendicular_line_3,
CGAL_Kernel_obj(Construct_midpoint_3, construct_midpoint_3_object)
CGAL_Kernel_obj(Construct_center_3, construct_center_3_object)
CGAL_Kernel_obj(Construct_circumcenter_3, construct_circumcenter_3_object)
CGAL_Kernel_obj(Construct_centroid_3, construct_centroid_3_object)
CGAL_Kernel_obj(Construct_cross_product_vector_3,
construct_cross_product_vector_3_object)
CGAL_Kernel_obj(Construct_opposite_segment_3,

View File

@ -1,4 +1,7 @@
3.25 (18 June 2001)
3.26 (19 June 2001)
- added Construct_centroid_[23] and centroid
3.25 (19 June 2001)
- Add Bounded_side_2 and Bounded_side_3
3.24 (13 June 2001)

View File

@ -55,6 +55,11 @@ _test_fct_constructions_2(const R&)
assert( CGAL::circumcenter( pne, pse, pnw) == p);
assert( CGAL::circumcenter( psw, pse, pnw) == p);
// centroid
Point pe = p + Vector(RT1, RT0);
assert( CGAL::centroid( pne, pse, pe) == pe);
assert( CGAL::centroid( pne, psw, pse, pnw) == p);
// general position intersection point
return true;

View File

@ -65,6 +65,11 @@ _test_fct_constructions_3(const R&)
assert( CGAL::circumcenter( p101, p001, p010, p100) == p);
assert( CGAL::circumcenter( p001, p000, p110, p100) == p);
// centroid
Point p_11 = p + Vector(RT0, RT1, RT1);
assert( CGAL::centroid( p111, p010, p101, p000) == p);
assert( CGAL::centroid( p111, p_11, p011 ) == p_11);
// projection onto a plane
return true;

View File

@ -214,6 +214,11 @@ test_new_2(const R& rep)
= rep.construct_circumcenter_2_object();
Point_2 tmp13 = construct_circumcenter(p2,p3,p4);
typename R::Construct_centroid_2 construct_centroid
= rep.construct_centroid_2_object();
tmp13 = construct_centroid(p2,p3,p4);
tmp13 = construct_centroid(p2,p3,p4,p5);
typename R::Construct_bisector_2 construct_bisector
= rep.construct_bisector_2_object();

View File

@ -230,6 +230,11 @@ test_new_3(const R& rep)
= rep.construct_circumcenter_3_object();
tmp4 = construct_circumcenter(p2,p3,p4,p5);
typename R::Construct_centroid_3 construct_centroid
= rep.construct_centroid_3_object();
tmp4 = construct_centroid(p2,p3,p4);
tmp4 = construct_centroid(p2,p3,p4,p5);
typename R::Construct_cross_product_vector_3 construct_cross_product
= rep.construct_cross_product_vector_3_object();
Vector_3 tmp9 = construct_cross_product(v3,v4);

View File

@ -57,6 +57,34 @@ circumcenter( const Point_2<R>& p,
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r)));
}
template < class R >
inline
Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r)
{
typedef typename R::Point_2_base RPoint_2;
return( centroid( static_cast<const RPoint_2&>(p),
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r)));
}
template < class R >
inline
Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r,
const Point_2<R>& s)
{
typedef typename R::Point_2_base RPoint_2;
return( centroid( static_cast<const RPoint_2&>(p),
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r),
static_cast<const RPoint_2&>(s)));
}
CGAL_END_NAMESPACE
#endif // CGAL_BASIC_CONSTRUCTIONS_2_H

View File

@ -46,6 +46,34 @@ midpoint( const Point_3<R>& p,
static_cast<const RPoint_3&>(q)));
}
template < class R >
inline
Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r,
const Point_3<R>& s)
{
typedef typename R::Point_3_base RPoint_3;
return( centroid( static_cast<const RPoint_3&>(p),
static_cast<const RPoint_3&>(q),
static_cast<const RPoint_3&>(r),
static_cast<const RPoint_3&>(s)));
}
template < class R >
inline
Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r)
{
typedef typename R::Point_3_base RPoint_3;
return( centroid( static_cast<const RPoint_3&>(p),
static_cast<const RPoint_3&>(q),
static_cast<const RPoint_3&>(r)));
}
template < class R >
inline
Point_3<R>

View File

@ -1,3 +1,6 @@
Version 6.19 (19 June 2001)
- added centroid
Version 6.18 (18 June 2001)
- Move definition of CGAL_REP_CLASS_DEFINED.

View File

@ -50,6 +50,31 @@ circumcenter(const PointC2<R CGAL_CTAG> &p,
return PointC2<R CGAL_CTAG>(x, y);
}
template < class R >
inline
PointC2<R CGAL_CTAG>
centroid(const PointC2<R CGAL_CTAG> &p,
const PointC2<R CGAL_CTAG> &q,
const PointC2<R CGAL_CTAG> &r)
{
typename R::FT x, y;
centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), x, y);
return PointC2<R CGAL_CTAG>(x, y);
}
template < class R >
inline
PointC2<R CGAL_CTAG>
centroid(const PointC2<R CGAL_CTAG> &p,
const PointC2<R CGAL_CTAG> &q,
const PointC2<R CGAL_CTAG> &r,
const PointC2<R CGAL_CTAG> &s)
{
typename R::FT x, y;
centroidC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), s.x(), s.y(), x, y);
return PointC2<R CGAL_CTAG>(x, y);
}
template < class R >
inline
PointC2<R>

View File

@ -39,6 +39,36 @@ midpoint(const PointC3<R CGAL_CTAG> &p,
return PointC3<R CGAL_CTAG>(x, y, z);
}
template < class R >
PointC3<R CGAL_CTAG>
centroid(const PointC3<R CGAL_CTAG> &p,
const PointC3<R CGAL_CTAG> &q,
const PointC3<R CGAL_CTAG> &r,
const PointC3<R CGAL_CTAG> &s)
{
typename R::FT x, y, z;
centroidC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z(),
s.x(), s.y(), s.z(),
x, y, z);
return PointC3<R CGAL_CTAG>(x, y, z);
}
template < class R >
PointC3<R CGAL_CTAG>
centroid(const PointC3<R CGAL_CTAG> &p,
const PointC3<R CGAL_CTAG> &q,
const PointC3<R CGAL_CTAG> &r)
{
typename R::FT x, y, z;
centroidC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z(),
x, y, z);
return PointC3<R CGAL_CTAG>(x, y, z);
}
template < class R >
PointC3<R CGAL_CTAG>
circumcenter(const PointC3<R CGAL_CTAG> &p,

View File

@ -76,6 +76,31 @@ circumcenterC2( const FT &px, const FT &py,
y += py;
}
template < class FT >
CGAL_KERNEL_MEDIUM_INLINE
void
centroidC2( const FT &px, const FT &py,
const FT &qx, const FT &qy,
const FT &rx, const FT &ry,
FT &x, FT &y)
{
x = (px + qx + rx)/FT(3);
y = (py + qy + ry)/FT(3);
}
template < class FT >
CGAL_KERNEL_MEDIUM_INLINE
void
centroidC2( const FT &px, const FT &py,
const FT &qx, const FT &qy,
const FT &rx, const FT &ry,
const FT &sx, const FT &sy,
FT &x, FT &y)
{
x = (px + qx + rx + sx)/FT(4);
y = (py + qy + ry + sy)/FT(4);
}
template < class FT >
inline
void

View File

@ -132,6 +132,31 @@ circumcenterC3( const FT &px, const FT &py, const FT &pz,
z = sz + num_z*inv;
}
template < class FT >
void
centroidC3( const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &rx, const FT &ry, const FT &rz,
const FT &sx, const FT &sy, const FT &sz,
FT &x, FT &y, FT &z)
{
x = (px + qx + rx + sx)/FT(4);
y = (py + qy + ry + sy)/FT(4);
z = (pz + qz + rz + sz)/FT(4);
}
template < class FT >
void
centroidC3( const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &rx, const FT &ry, const FT &rz,
FT &x, FT &y, FT &z)
{
x = (px + qx + rx)/FT(3);
y = (py + qy + ry)/FT(3);
z = (pz + qz + rz)/FT(3);
}
template < class FT >
CGAL_KERNEL_MEDIUM_INLINE
FT

View File

@ -1,3 +1,6 @@
2.30 (19 June 2001)
- added centroid
2.29 (18 June 2001)
- Move definition of CGAL_REP_CLASS_DEFINED.

View File

@ -111,6 +111,30 @@ midpoint( PointH2<R> const& p, PointH2<R> const& q )
return( PointH2<R>( hx, hy, hw));
}
template < class R >
CGAL_KERNEL_MEDIUM_INLINE
PointH2<R>
centroid( const PointH2<R>& p,
const PointH2<R>& q,
const PointH2<R>& r )
{
typedef typename R::RT RT;
return PointH2<R>((p.hx() + q.hx() + r.hx())/RT(4),
(p.hy() + q.hy() + r.hy())/RT(4));
}
template < class R >
CGAL_KERNEL_MEDIUM_INLINE
PointH2<R>
centroid( const PointH2<R>& p,
const PointH2<R>& q,
const PointH2<R>& r,
const PointH2<R>& s )
{
typedef typename R::RT RT;
return PointH2<R>((p.hx() + q.hx() + r.hx() + s.hx())/RT(4),
(p.hy() + q.hy() + r.hy() + s.hy())/RT(4));
}
template <class R>
CGAL_KERNEL_LARGE_INLINE

View File

@ -1,3 +1,6 @@
2.29 (19 June 2001)
- added centroid
2.28 (2 May 2001)
- angle()
- Fix operator<<(Iso_cuboid_3).

View File

@ -102,6 +102,33 @@ bisector( PointH3<R> const& p,
PointH3<R> const& q)
{ return PlaneH3<R>( midpoint(p,q), q-p); }
template <class R>
CGAL_KERNEL_MEDIUM_INLINE
PointH3<R>
centroid( PointH3<R> const& p,
PointH3<R> const& q,
PointH3<R> const& r,
PointH3<R> const& s)
{
typedef typename R::RT RT;
return PointH3<R>((p.hx() + q.hx() + r.hx() + s.hx())/RT(4),
(p.hy() + q.hy() + r.hy() + s.hy())/RT(4),
(p.hz() + q.hz() + r.hz() + s.hz())/RT(4));
}
template <class R>
CGAL_KERNEL_MEDIUM_INLINE
PointH3<R>
centroid( PointH3<R> const& p,
PointH3<R> const& q,
PointH3<R> const& r)
{
typedef typename R::RT RT;
return PointH3<R>((p.hx() + q.hx() + r.hx())/RT(4),
(p.hy() + q.hy() + r.hy())/RT(4),
(p.hz() + q.hz() + r.hz())/RT(4));
}
template <class R>
PointH3<R>
circumcenter( PointH3<R> const& p,

View File

@ -99,6 +99,8 @@ for equality testing.
\ccGlue
\ccNestedType{Construct_center_2}{}
\ccGlue
\ccNestedType{Construct_centroid_2}{}
\ccGlue
\ccNestedType{Construct_circumcenter_2}{}
\ccGlue
\ccNestedType{Construct_bisector_2}{}
@ -303,6 +305,8 @@ If the result type is a number type, the prefix is \ccc{Compute_}:
\ccGlue
\ccNestedType{Construct_center_3}{}
\ccGlue
\ccNestedType{Construct_centroid_3}{}
\ccGlue
\ccNestedType{Construct_circumcenter_3}{}
\ccGlue
\ccNestedType{Construct_cross_product_vector_3}{}
@ -487,6 +491,8 @@ an \ccc{_object} suffix.
\ccGlue
\ccMemberFunction{Kernel::Construct_midpoint_2 construct_midpoint_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_centroid_2 construct_centroid_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_circumcenter_2 construct_circumcenter_2_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_bisector_2 construct_bisector_2_object() const ;}{}
@ -653,6 +659,8 @@ an \ccc{_object} suffix.
\ccGlue
\ccMemberFunction{Kernel::Construct_midpoint_3 construct_midpoint_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_centroid_3 construct_centroid_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_circumcenter_3 construct_circumcenter_3_object() const ;}{}
\ccGlue
\ccMemberFunction{Kernel::Construct_cross_product_vector_3 construct_cross_product_vector_3_object() const ;}{}

View File

@ -0,0 +1,32 @@
\begin{ccRefFunction}{centroid}
\ccInclude{CGAL/basic_constructions_2.h}
\ccFunction{Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccFunction{Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r,
const Point_2<R>& s);}
{compute the centroid of the points $p$, $q$, $r$, and $s$.}
\ccInclude{CGAL/basic_constructions_3.h}
\ccFunction{Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r);}
{compute the centroid of the points $p$, $q$, and $r$.}
\ccFunction{Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r,
const Point_3<R>& s);}
{compute the centroid of the points $p$, $q$, $r$, and $s$.}
\end{ccRefFunction}

View File

@ -37,6 +37,8 @@
\KernelRefLayout
\input{Ref/cartesian_to_homogeneous.tex}
\KernelRefLayout
\input{Ref/centroid.tex}
\KernelRefLayout
\input{Ref/Circle_2.tex}
\KernelRefLayout
\input{Ref/circumcenter.tex}
@ -229,6 +231,10 @@
\KernelRefLayout
\input{Ref/Kernel_Construct_center_3.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_centroid_2.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_centroid_3.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_circle_2.tex} %ck
\KernelRefLayout
\input{Ref/Kernel_Construct_circumcenter_2.tex} %ck

View File

@ -254,6 +254,22 @@ class p_Circumcenter
{ return circumcenter(p,q,r,s); }
};
template <class Point>
class p_Centroid
{
public:
typedef Point result_type;
Point
operator()(const Point& p, const Point& q, const Point& r) const
{ return centroid(p,q,r); }
Point
operator()(const Point& p, const Point& q,
const Point& r, const Point& s) const
{ return centroid(p,q,r,s); }
};
template <class Point, class Line>
class pl_Bisector
{

View File

@ -57,6 +57,34 @@ circumcenter( const Point_2<R>& p,
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r)));
}
template < class R >
inline
Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r)
{
typedef typename R::Point_2_base RPoint_2;
return( centroid( static_cast<const RPoint_2&>(p),
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r)));
}
template < class R >
inline
Point_2<R>
centroid( const Point_2<R>& p,
const Point_2<R>& q,
const Point_2<R>& r,
const Point_2<R>& s)
{
typedef typename R::Point_2_base RPoint_2;
return( centroid( static_cast<const RPoint_2&>(p),
static_cast<const RPoint_2&>(q),
static_cast<const RPoint_2&>(r),
static_cast<const RPoint_2&>(s)));
}
CGAL_END_NAMESPACE
#endif // CGAL_BASIC_CONSTRUCTIONS_2_H

View File

@ -46,6 +46,34 @@ midpoint( const Point_3<R>& p,
static_cast<const RPoint_3&>(q)));
}
template < class R >
inline
Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r,
const Point_3<R>& s)
{
typedef typename R::Point_3_base RPoint_3;
return( centroid( static_cast<const RPoint_3&>(p),
static_cast<const RPoint_3&>(q),
static_cast<const RPoint_3&>(r),
static_cast<const RPoint_3&>(s)));
}
template < class R >
inline
Point_3<R>
centroid( const Point_3<R>& p,
const Point_3<R>& q,
const Point_3<R>& r)
{
typedef typename R::Point_3_base RPoint_3;
return( centroid( static_cast<const RPoint_3&>(p),
static_cast<const RPoint_3&>(q),
static_cast<const RPoint_3&>(r)));
}
template < class R >
inline
Point_3<R>

View File

@ -214,6 +214,11 @@ test_new_2(const R& rep)
= rep.construct_circumcenter_2_object();
Point_2 tmp13 = construct_circumcenter(p2,p3,p4);
typename R::Construct_centroid_2 construct_centroid
= rep.construct_centroid_2_object();
tmp13 = construct_centroid(p2,p3,p4);
tmp13 = construct_centroid(p2,p3,p4,p5);
typename R::Construct_bisector_2 construct_bisector
= rep.construct_bisector_2_object();

View File

@ -230,6 +230,11 @@ test_new_3(const R& rep)
= rep.construct_circumcenter_3_object();
tmp4 = construct_circumcenter(p2,p3,p4,p5);
typename R::Construct_centroid_3 construct_centroid
= rep.construct_centroid_3_object();
tmp4 = construct_centroid(p2,p3,p4);
tmp4 = construct_centroid(p2,p3,p4,p5);
typename R::Construct_cross_product_vector_3 construct_cross_product
= rep.construct_cross_product_vector_3_object();
Vector_3 tmp9 = construct_cross_product(v3,v4);