Transparent With Number Types

We see that the number types for the function CGAL::orientation can vary.

The following uses the normal 2D point type:

// examples/Tutorial_SCG99/orientation.C
// -------------------------------------
#include "tutorial.h"
#include <CGAL/Point_2.h>
#include <CGAL/predicates_on_points_2.h>
#include <iostream>

int main() {
    Point p( 1.0, 0.0);
    Point q( 1.3, 1.7);
    Point r( 2.2, 6.8);
    switch ( CGAL::orientation( p, q, r)) {
	case CGAL::LEFTTURN:   std::cout << "Left turn.\n";  break;
	case CGAL::RIGHTTURN:  std::cout << "Right turn.\n"; break;
	case CGAL::COLLINEAR:  std::cout << "Collinear.\n";  break;
    }
    return 0;
}

The following uses the 2D point type with exact numbers:

// examples/Tutorial_SCG99/exact_orientation.C
// -------------------------------------------
#include <CGAL/Homogeneous.h>
#include <CGAL/Point_2.h>
#include <CGAL/predicates_on_points_2.h>
#include <iostream>

typedef CGAL::Homogeneous<long>         Rep;
typedef CGAL::Point_2<Rep>              Point;

int main() {
    Point p( 10,  0, 10);
    Point q( 13, 17, 10);
    Point r( 22, 68, 10);
    switch ( CGAL::orientation( p, q, r)) {
	case CGAL::LEFTTURN:   std::cout << "Left turn.\n";  break;
	case CGAL::RIGHTTURN:  std::cout << "Right turn.\n"; break;
	case CGAL::COLLINEAR:  std::cout << "Collinear.\n";  break;
    }
    return 0;
}
 

We see it's OK to use the same function CGAL::orientation to operate on both types.