Class ApproximatePredicates_2

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

public class ApproximatePredicates_2 extends Object implements GeometricPredicates_2
Approximate geometric predicates for plane objects (points, segments, rays)
Version:
dec 2012
Author:
Luca Castelli Aleardi and Steve Oudot (INF562, Ecole Polytechnique)
  • Constructor Details

    • ApproximatePredicates_2

      public ApproximatePredicates_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)
    • 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 - first segment
      t - second segment
      Returns:
      true if s and 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
    • 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