Class Line3D

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

public class Line3D extends Object implements GeometricObject<Point3D>
Represents a line in 3D Euclidean space.

Defined by a point P and a direction vector V: L(t) = P + tV.

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

    • Line3D

      public Line3D(Vector3D point, Vector3D direction)
      Creates a line from a point and a direction.
      Parameters:
      point - a point on the line
      direction - the direction vector of the line (will be normalized)
  • Method Details

    • getPoint

      public Vector3D getPoint()
    • getDirection

      public Vector3D getDirection()
    • distance

      public Real distance(Vector3D p)
      Calculates the distance from a point to this line.
      Parameters:
      p - the point
      Returns:
      the perpendicular distance
    • contains

      public boolean contains(Vector3D p, double tolerance)
      Checks if a point lies on this line (within tolerance).
      Parameters:
      p - the point
      tolerance - the error tolerance
      Returns:
      true if p is on the line
    • 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<Point3D>
      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<Point3D>
      Returns:
      the ambient space dimension
    • containsPoint

      public boolean containsPoint(Point3D 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<Point3D>
      Returns:
      description string
    • intersection

      public Vector3D intersection(Line3D other)
      Computes the intersection point with another line.
      Parameters:
      other - the other line
      Returns:
      the intersection point, or null if lines are parallel or skew
    • closestPoint

      public Vector3D closestPoint(Line3D other)
      Computes the closest point on this line to another line.
      Parameters:
      other - the other line
      Returns:
      the closest point on this line to the other line