Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

[cgal-discuss] point lying over a line problem


Chronological Thread 
  • From: Alejandro Aragon <>
  • To:
  • Subject: [cgal-discuss] point lying over a line problem
  • Date: Wed, 23 Jul 2008 10:36:10 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=M54A08gYqL0gZzmilLp2fPquGILQSalulycDfZGZyfTMfQ96wr/nC46hzX9b0/TXhE zSlJ/aqfpBVqPC5nfVAizQ27JzDSLaeiN8shh3sfewFE2fHok0/WUzUrm2LBz6fpzKb0 UpXh7Vx1yUFOSe0Vv0jhEqizLLiyx+tdBcalI=

Hi, no one has replied to my post yet, so I decided to send it again in case someone will. 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.



Archive powered by MHonArc 2.6.16.

Top of Page