Class Line2D

java.lang.Object
org.episteme.core.mathematics.geometry.Line2D
All Implemented Interfaces:
GeometricObject<Point2D>

public final class Line2D extends Object implements GeometricObject<Point2D>
A line in 2D Euclidean space.

Represented in parametric form: P(t) = point + t * direction

* @author Silvere Martin-Michiellot
Since:
1.0
Author:
Gemini AI (Google DeepMind)
  • Constructor Details

  • Method Details

    • getPoint

      public Point2D getPoint()
    • getDirection

      public Vector2D getDirection()
    • pointAt

      public Point2D pointAt(Real t)
    • distanceTo

      public Real distanceTo(Point2D p)
    • dimension

      public int dimension()
      Description copied from interface: GeometricObject
      Returns the intrinsic dimension of this geometric object.

      Examples:

      • Point: 0
      • Line/Segment: 1
      • Plane/Surface: 2
      • Volume: 3

      Specified by:
      dimension in interface GeometricObject<Point2D>
      Returns:
      the dimension
    • ambientDimension

      public int ambientDimension()
      Description copied from interface: GeometricObject
      Returns the dimension of the ambient space containing this object.

      For example, a 2D plane in 3D space has dimension=2 but ambientDimension=3.

      Specified by:
      ambientDimension in interface GeometricObject<Point2D>
      Returns:
      the ambient space dimension
    • containsPoint

      public boolean containsPoint(Point2D p)
    • description

      public String description()
      Description copied from interface: GeometricObject
      Returns a human-readable description of this geometric object.
      Specified by:
      description in interface GeometricObject<Point2D>
      Returns:
      description string
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNormal

      public Vector2D getNormal()
    • signedDistance

      public Real signedDistance(Point2D p)
      Calculates the signed distance from a point to this line. Positive if on the side of the normal (left/right depending on system), negative otherwise.
      Parameters:
      p - the point
      Returns:
      the signed distance
    • flipped

      public Line2D flipped()
      Returns a flipped version of this line (reverses direction).
    • intersection

      public Point2D intersection(Line2D other)
      Computes the intersection point with another line.
      Parameters:
      other - the other line
      Returns:
      the intersection point, or null if lines are parallel