org.apache.commons.math3.geometry.euclidean.threed
Class LineSegment

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.LineSegment
All Implemented Interfaces:
Serializable

public final class LineSegment
extends Object
implements Serializable

This is a describing class for a line segment in 3D space, with a method to compute the shortest distance to a line.

Since:
1.0
Version:
$Id: LineSegment.java 11374 2014-10-30 15:39:29Z sabatini $
Author:
Thomas Trapier
See Also:
Serialized Form
Use sample :

Creation with two dimensions, a length and three Vector3D : Vector3D origin = new Vector3D(1.0, 6.0, -2.0); Vector3D direction = new Vector3D(6.0, -3.0, -1.0); double length = 2.0; LineSegment segment = new LineSegment(origin, direction, length); Distance to a line : double distance = segment.distanceTo(line);

Concurrency :
immutable

Constructor Summary
LineSegment(Vector3D inOrigin, Vector3D inDirection, double inLength)
          Build a line segment from its origin, direction and length.
 
Method Summary
 Vector3D[] closestPointTo(Line line)
          Computation of the closest point to a line, and the associated point of the line;
 double distanceTo(Line line)
          Computes the shortest distance to a line of space.
 Vector3D getDirection()
           
 Vector3D getEnd()
           
 double getLength()
           
 Vector3D getOrigin()
           
 String toString()
          Get a representation for this line segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineSegment

public LineSegment(Vector3D inOrigin,
                   Vector3D inDirection,
                   double inLength)
Build a line segment from its origin, direction and length.

Parameters:
inOrigin - the segment's origin
inDirection - the segment's direction
inLength - the segment's length
Method Detail

getOrigin

public Vector3D getOrigin()
Returns:
the origin

getEnd

public Vector3D getEnd()
Returns:
the end

getLength

public double getLength()
Returns:
the length

getDirection

public Vector3D getDirection()
Returns:
the direction

distanceTo

public double distanceTo(Line line)
Computes the shortest distance to a line of space.

Parameters:
line - the line
Returns:
the distance

closestPointTo

public Vector3D[] closestPointTo(Line line)
Computation of the closest point to a line, and the associated point of the line;

Parameters:
line - the line
Returns:
the point of the line and the point of the segment.

toString

public String toString()
Get a representation for this line segment. The given parameters are in the same order as in the constructor.

Overrides:
toString in class Object
Returns:
a representation for this line segment


Copyright © 2016 CNES. All Rights Reserved.