Class LineND

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

public class LineND extends Object implements GeometricObject<PointND>
Represents an N-dimensional line.

A line is defined by a point and a direction vector. It extends infinitely in both directions along the direction vector.

Parametric form: L(t) = point + t * direction, where t ∈ ℝ

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

    • LineND

      public LineND(PointND point, Vector<Real> direction)
      Creates a line from a point and direction vector.
      Parameters:
      point - a point on the line
      direction - the direction vector (will be normalized)
  • Method Details

    • through

      public static LineND through(PointND p1, PointND p2)
      Creates a line passing through two points.
      Parameters:
      p1 - the first point
      p2 - the second point
    • 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<PointND>
      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<PointND>
      Returns:
      the ambient space dimension
    • getPoint

      public PointND getPoint()
    • getDirection

      public Vector<Real> getDirection()
    • at

      public PointND at(Real t)
      Evaluates the line at parameter t.

      Returns: point + t * direction

      Parameters:
      t - the parameter
      Returns:
      the point at parameter t
    • containsPoint

      public boolean containsPoint(PointND p)
    • closestPoint

      public PointND closestPoint(PointND p)
      Finds the closest point on this line to a given point.
      Parameters:
      p - the point
      Returns:
      the closest point on the line
    • distanceTo

      public Real distanceTo(PointND p)
      Computes the distance from a point to this line.
      Parameters:
      p - the point
      Returns:
      the distance
    • isParallelTo

      public boolean isParallelTo(LineND other)
      Checks if this line is parallel to another line.
      Parameters:
      other - the other line
      Returns:
      true if parallel
    • intersection

      public PointND intersection(LineND other)
      Finds the intersection point with another line (if it exists).

      Returns null if lines are parallel or skew (don't intersect).

      Parameters:
      other - the other line
      Returns:
      the intersection point, or null if no intersection
    • description

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object