Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] anyone give me an expample of snap_rounding with custom point
  • Date: Sat, 14 Jul 2012 10:30:25 +0300

One way to go about it is to extend the kernel point type; see http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23/Chapter_main.html#Section_11.5.

On Sat, Jul 14, 2012 at 6:45 AM, cnng0315 <> wrote:
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.

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





--
   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/






Archive powered by MHonArc 2.6.18.

Top of Page