point should lie on the line but it doesn't, please help

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

point should lie on the line but it doesn't, please help

aaragon
Hello everyone,

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.

Alejandro M. Aragón--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss