Class ExactPredicates_2

java.lang.Object
Jcg.geometry.kernel.ExactPredicates_2
All Implemented Interfaces:
GeometricPredicates_2

public class ExactPredicates_2 extends Object implements GeometricPredicates_2
Exact geometric predicates for plane objects (points, segments, rays) Computations are performed with infinite precision arithmetic (using the java.util.BigDecimal class)
Version:
dec 2012
Author:
Luca Castelli Aleardi and Steve Oudot (INF562, Ecole Polytechnique)
  • Constructor Details

    • ExactPredicates_2

      public ExactPredicates_2()
  • Method Details

    • orientation

      public int orientation(Point_2 a, Point_2 b, Point_2 c)
      Returns the orientation of a, b and c
      Specified by:
      orientation in interface GeometricPredicates_2
      Parameters:
      a - ,b,c the 3 points to test
      Returns:
      1 if sequence (a, b, c) turns in counter-clockwise direction, -1 if it turns in clockwise direction, 0 if the points are collinear
    • isCounterClockwise

      public boolean isCounterClockwise(Point_2 a, Point_2 b, Point_2 c)
      Returns true if a, b and c turn in counter-clockwise direction
      Specified by:
      isCounterClockwise in interface GeometricPredicates_2
      Parameters:
      a - ,b,c the 3 points to test
      Returns:
      true if a, b and c turn in counter-clockwise direction.
      Warning: the result is false if the three points are collinear
    • isClockwise

      public boolean isClockwise(Point_2 a, Point_2 b, Point_2 c)
      Returns true if a, b and c turn in clockwise direction
      Specified by:
      isClockwise in interface GeometricPredicates_2
      Parameters:
      a - ,b,c the 3 points to test
      Returns:
      true if a, b and c turn in clockwise direction.
      Warning: the result is false if the three points are collinear
    • collinear

      public boolean collinear(Point_2 a, Point_2 b, Point_2 c)
      Returns true if a, b and c lie on a same line
      Specified by:
      collinear in interface GeometricPredicates_2
      Parameters:
      a - ,b,c the 3 points to test
      Returns:
      true if a, b and c are collinear (lie on a same line) Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
    • inCircle

      public boolean inCircle(Point_2 p, Point_2 a, Point_2 b, Point_2 c)
      Tests if point p lies inside the circumcircle of triangle a,b,c
      Specified by:
      inCircle in interface GeometricPredicates_2
      Parameters:
      p - point to test
      a - ,b,c triangle
      Returns:
      true/false
    • doIntersect

      public boolean doIntersect(Segment_2 s, Segment_2 t)
      Returns true if segments s and t intersect
      Specified by:
      doIntersect in interface GeometricPredicates_2
      Parameters:
      s - ,t the 2 segments
      Returns:
      true if s,t intersect each other
    • doIntersect

      public boolean doIntersect(Segment_2 s, Ray_2 r)
      Returns true if segment s and ray r intersect
      Specified by:
      doIntersect in interface GeometricPredicates_2
      Parameters:
      s - the segment
      r - the ray
      Returns:
      true if s intersects r Warning: test is not exact.
    • liesOn

      public boolean liesOn(Point_2 p, Point_2 a, Point_2 b)
      Returns true if point p lies on segment ab
      Specified by:
      liesOn in interface GeometricPredicates_2
      Parameters:
      a - ,b,p the 3 points
      Returns:
      true if ab contains point p