Class UtilLine2D_F64

java.lang.Object
georegression.geometry.UtilLine2D_F64

public class UtilLine2D_F64 extends Object
Various functions related to lines
  • Constructor Details

    • UtilLine2D_F64

      public UtilLine2D_F64()
  • Method Details

    • acuteAngle

      public static double acuteAngle(LineGeneral2D_F64 a, LineGeneral2D_F64 b)
      Returns the acute angle between the slope of two lines. Lines do not need to ever intersect. Found using the dot product.
      Parameters:
      a - (input) line
      b - (input) line
      Returns:
      acute angle in radians
    • acuteAngleN

      public static double acuteAngleN(LineGeneral2D_F64 a, LineGeneral2D_F64 b)
      Returns the acute angle between the slope of two lines and assumes that the lines have been normalized such that A*A + B*B = 1. This avoids the need to compute the square root twice. Lines do not need to ever intersect. Found using the dot product.
      Parameters:
      a - (input) normalized line
      b - (input) normalized line
      Returns:
      acute angle in radians
    • convert

      public static LineParametric2D_F64 convert(LinePolar2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret)
      Converts a line from polar form to parametric.
      Parameters:
      src - (input) line is polar notation
      ret - (output) line in parametric notation. If null a new instance will be created.
      Returns:
      Converted line in parametric notation
    • convert

      public static LineGeneral2D_F64 convert(LinePolar2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret)
      Converts a line from polar form to general. After conversion the line will be normalized, e.g. A*A + B*B == 1.
      Parameters:
      src - (input) line is polar notation
      ret - (output) line in general notation. If null a new instance will be created.
      Returns:
      Converted line in general notation
    • convert

      public static LinePolar2D_F64 convert(LineGeneral2D_F64 src, @Nullable @Nullable LinePolar2D_F64 ret)
      Converts a line from general to polar.
      Parameters:
      src - (input) line is general notation
      ret - (output) line in polar notation. If null a new instance will be created.
      Returns:
      Converted line in polar notation
    • convert

      public static LineParametric2D_F64 convert(LineSegment2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret)
      Converts a line segment into a parametric line. The start point will be 'src.a' and the direction will be in the direction of 'src.b-src.a'
      Parameters:
      src - (input) line segment
      ret - (output) line in parametric notation. If null a new instance will be created.
      Returns:
      Converted line in parametric notation
    • convert

      public static LineGeneral2D_F64 convert(LineSegment2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret)
      Converts a line segment into a general line.
      Parameters:
      src - (Input) line segment
      ret - (output) line in general notation. If null a new instance will be created.
      Returns:
      Line in general notation
    • convert

      public static LineGeneral2D_F64 convert(Point2D_F64 a, Point2D_F64 b, @Nullable @Nullable LineGeneral2D_F64 ret)
      Converts a line segment into a general line. Line segment is defined by two points.
      Parameters:
      a - (Input) End point of line segment
      b - (Input) End point of line segment
      ret - (output) line in general notation. If null a new instance will be created.
      Returns:
      Line in general notation
    • convert

      public static LineParametric2D_F64 convert(Point2D_F64 a, Point2D_F64 b, @Nullable @Nullable LineParametric2D_F64 ret)
      Converts a line segment into a line in parametric format. It will point from a to b. Point a and b must be unique.
      Parameters:
      a - (Input) End point of line segment
      b - (Input) End point of line segment
      ret - (output) Storage for new line.. If null a new instance will be created.
      Returns:
      The resulting line
    • convert

      public static LineParametric2D_F64 convert(Point2D_F64 a, double angle, @Nullable @Nullable LineParametric2D_F64 ret)
      Converts a point and angle into a parametric line.
      Parameters:
      a - (Input) Point on the line
      angle - (Input) Orientation describing the line's slope. Radians.
      ret - (output) Storage for new line.. If null a new instance will be created.
      Returns:
      The resulting line
    • convert

      public static LinePolar2D_F64 convert(LineParametric2D_F64 src, @Nullable @Nullable LinePolar2D_F64 ret)
      Converts a line from parametric to polar.
      Parameters:
      src - (Input) line in parametric notation
      ret - (output) line in polar notation. If null a new instance will be created.
      Returns:
      Line in polar notation
    • convert

      public static LineGeneral2D_F64 convert(LineParametric2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret)
      Converts a line from parametric to general
      Parameters:
      src - (input) line in parametric notation.
      ret - (output) line in general notation. If null a new instance will be created.
      Returns:
      Converted line in general notation
    • convert

      public static LineParametric2D_F64 convert(LineGeneral2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret)
      Converts a line from general to parametric
      Parameters:
      src - (input) line in general notation.
      ret - (output) line in parametric notation. If null a new instance will be created.
      Returns:
      Converted line in parametric notation
    • area2

      public static double area2(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c)
      Computes a signed area for the 3 point triangle. Useful when testing the relationship between line segments. See: Computational Geometry in C. 2nd Ed. Section 1.5
      Returns:
      a signed area of the triangle
    • isColinear

      public static boolean isColinear(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c, double tol)
    • isBetweenColinear

      public static boolean isBetweenColinear(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c)
      The three points are co-linear. Check to see if 'c' lies on the segment defined by 'a' and 'b', but if 'c' is identical to 'a' or 'b' it is between.
    • isBetweenColinearExclusive

      public static boolean isBetweenColinearExclusive(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c)
      The three points are co-linear. Check to see if 'c' lies on the segment defined by 'a' and 'b', but if 'c' is identical to 'a' or 'b' it is not between.