Class FilteredPredicates_2

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

public class FilteredPredicates_2 extends Object implements GeometricPredicates_2
Filtered geometric predicates for plane objects (points, segments, rays)

Remark
Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
Version:
2.0, updated 12/11/2022 (created, december 2022)
Author:
Luca Castelli Aleardi and Steve Oudot (INF562, Ecole Polytechnique)
  • Field Details

  • Constructor Details

    • FilteredPredicates_2

      public FilteredPredicates_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 Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
    • 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

      Remark
      Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
      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

      Remark
      Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
      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

      Remark
      Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
      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 Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
    • 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 Test is filtered: if precision bound epsilon is reached, then perform computation with infinite precision arithmetic (using the java.util.BigDecimal class)
    • doIntersect

      public boolean doIntersect(Segment_2 s, Ray_2 r)
      Returns true if segment s and ray r intersect Test is not filtered.
      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