Class Segment3D

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

public class Segment3D extends Object implements GeometricObject<Point3D>
Represents a line segment in 3D space. Defined by two points: start and end.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • Segment3D

      public Segment3D(Vector3D start, Vector3D end)
      Creates a new segment.
      Parameters:
      start - the start point
      end - the end point
  • Method Details

    • getStart

      public Vector3D getStart()
    • getEnd

      public Vector3D getEnd()
    • length

      public Real length()
    • contains

      public boolean contains(Vector3D p, double tolerance)
      Checks if a point lies on the segment.
      Parameters:
      p - the point
      tolerance - the tolerance
      Returns:
      true if p is on the segment
    • 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
    • clip

      public Segment3D clip(Vector3D min, Vector3D max)
      Clips this segment against a box defined by min and max points. Uses a simplified Cohen-Sutherland or Liang-Barsky approach logic.
      Parameters:
      min - box min point
      max - box max point
      Returns:
      the clipped segment, or null if outside