Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] anyone give me an expample of snap_rounding with custom point

Subject: CGAL users discussion list

List archive

[cgal-discuss] anyone give me an expample of snap_rounding with custom point


Chronological Thread 
  • From: cnng0315 <>
  • To:
  • Subject: [cgal-discuss] anyone give me an expample of snap_rounding with custom point
  • Date: Fri, 13 Jul 2012 20:45:59 -0700 (PDT)

I would like to add some extra info to point, so I derived from CGAL::Point_2
like the code below. but with the custom point, the snap_rounding algorithm
gives error result compared with the standard point.

template<class Gt,typename Info>
class Point_With_Info : public Gt::Point_2
{
// Private types
private:

typedef typename Gt::Point_2 Base;

// Public types
public:

typedef Gt Geom_traits; ///< Geometric traits class
typedef typename Geom_traits::FT FT;
typedef typename Geom_traits::RT RT;
typedef typename Geom_traits::Point_2 Point; ///< typedef to
Geom_traits::Point_3

// Public methods
public:

/// Point is (0,0,0) by default.
/// Normal is (0,0,0) by default.
Point_With_Info()
: Base()
{
}
Point_With_Info(FT x, FT y)
: Base(x,y)
{
}
Point_With_Info(FT x, FT y,const Info& tmp)
: Base(x,y),info(tmp)
{
}
//Point_With_Info(RT hx, RT hy)
// : Base(hx,hy)
//{
//}
Point_With_Info(const Point& point,const Info& tmp)
: Base(point),info(tmp)
{
}
Point_With_Info(const Point& point)
: Base(point)
{
}

/// Copy constructor
Point_With_Info(const Point_With_Info& pwn)
: Base(pwn),info(pwn.info)
{
}
template <class K,typename Info>
Point_With_Info(const Point_With_Info<K,Info>& pwn)
: Base(pwn),info(pwn.info)
{
}
/// Operator =()
Point_With_Info& operator=(const Point_With_Info& pwn)
{
Base::operator=(pwn);
info = pwn.info;
return *this;
}

/// Gets/sets position.
const Point& position() const { return *this; }
Point& position() { return *this; }
// Data

Info info;
};


-----
technology change life!
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/anyone-give-me-an-expample-of-snap-rounding-with-custom-point-tp4655450.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page