Subject: CGAL users discussion list
List archive
- From: Andreas Fabri <>
- To:
- Subject: Re: [cgal-discuss] point lying over a line problem
- Date: Wed, 23 Jul 2008 18:20:30 +0200
Hi Alejandro,
Cartesian has reference counted objects. You might try Simple_cartesian
instead.
Best regards,
andreas
Alejandro Aragon wrote:
By the way, talking about points in CGAL. I decided to create my own point class, templated by the dimension of the point to see the difference in creation time with that of the CGAL types. I introduced an implicit conversion so that I can use my point type where a CGAL algorithm needs it. Then my test was just creating points. It was surprising the time that it took the creation of 10e9 Point_2 objects compared to my simple templated point class:
int main(int argc, char *argv[]) {
typedef CGAL::Point_2 PointType;
Timer t1;
cout<<"CGAL point"<<endl;
t1.Reset();
for (long i=0; i<1.0e9; ++i) {
PointType p(3,5);
}
t1.Tac();
cout<<"my point"<<endl;
t1.Reset();
for (long i=0; i<1.0e9; ++i) {
geometry::Point<2> p(3,5);
}
t1.Tac();
exit(0);
}
$./a.out
CGAL point
Time: 74.2738sec
Measurement granularity: 1000000 of a second
my point
Time: 1.57362sec
Measurement granularity: 1000000 of a second
so can someone tell me why is this? I would never expect an almost factor of 50 in execution times! and this was just for creating a point.
Alejandro M. Aragón
On Jul 23, 2008, at 10:48 AM, Andreas Fabri wrote:
Sylvain Pion wrote:
Alejandro Aragon a écrit :
Hi, no one has replied to my post yet, so I decided to send it again in case someone will.Wrong decision : you should have decided to read the FAQ, for example.
http://www.cgal.org/FAQ.html#inexact_NT
I'm trying to check how the oriented_side() function works for a line. I
created a very simple example, where a point should lie on a line, but it
doesn't. The program is as follows:
#include <CGAL/Cartesian.h>
#include <iostream>
using std::cout;
using std::endl;
int main() {
typedef CGAL::Cartesian<double> KernelType;
typedef KernelType::Point_2 PointType;
typedef KernelType::Line_2 LineType;
PointType p(0.034,0.006);
cout<<"point -> "<<p<<endl;
LineType l(-0.004, 0.004, 0.000112);
cout<<"line -> "<<l<<endl;
CGAL::Oriented_side test = l.oriented_side(p);
if ( test == CGAL::ON_POSITIVE_SIDE ) {
cout<<"point on positive side"<<endl;
} else if ( test == CGAL::ON_NEGATIVE_SIDE ) {
cout<<"point on negative side"<<endl;
} else {
cout<<"point over line"<<endl;
}
return 0;
}
The output of this little program is:
point -> 0.034 0.006
line -> -0.004 0.004 0.000112
point on negative side
Can someone tell me what is happening here? The point should not be on the
negative side. Thank you all.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Andreas Fabri, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Fernando Cacciola, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Andreas Fabri, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Andreas Fabri, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Olivier Devillers, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Olivier Devillers, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Fernando Cacciola, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Andreas Fabri, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
Archive powered by MHonArc 2.6.16.