Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] point lying over a line problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] point lying over a line problem


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] point lying over a line problem
  • Date: Wed, 23 Jul 2008 17:38:38 +0200
  • Organization: INRIA

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.


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.


--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.16.

Top of Page