math.geom3d.line
Class LineSegment3D

java.lang.Object
  extended by math.geom3d.line.LineSegment3D
All Implemented Interfaces:
ContinuousCurve3D, Curve3D, Shape3D

public class LineSegment3D
extends java.lang.Object
implements ContinuousCurve3D

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom3d.Shape3D
ACCURACY
 
Constructor Summary
LineSegment3D(Point3D p1, Point3D p2)
           
 
Method Summary
 Box3D boundingBox()
           
 Shape3D clip(Box3D box)
           
 boolean contains(Point3D point)
           
 java.util.Collection<LineSegment3D> continuousCurves()
          Returns the collection of continuous curves which constitute this curve.
 double distance(Point3D point)
          Gets the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.
 Point3D firstPoint()
          Get the first point of the curve.
 double getT0()
          Return 0, by definition of LineSegment.
 double getT1()
          Return 1, by definition of LineSegment.
 boolean isBounded()
          Returns true, as a LineSegment3D is always bounded.
 boolean isEmpty()
          Returns false, as a LineSegment3D is never empty.
 Point3D lastPoint()
          Get the last point of the curve.
 Point3D point(double t)
          Gets the point from a parametric representation of the curve.
 double position(Point3D point)
          If point does not project on the line segment, return Double.NaN.
 double project(Point3D point)
          Returns the position of the closest orthogonal projection of the point on the curve, or of the closest singular point.
 Curve3D reverseCurve()
          Returns the curve with same trace on the plane with parametrization in reverse order.
 java.util.Collection<Point3D> singularPoints()
          Returns the2 end points.
 LineSegment3D subCurve(double t0, double t1)
          Returns a portion of the original curve, delimited by two positions on the curve.
 StraightLine3D supportingLine()
           
 Curve3D transform(AffineTransform3D trans)
          Transforms the curve by an affine transform.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineSegment3D

public LineSegment3D(Point3D p1,
                     Point3D p2)
Method Detail

supportingLine

public StraightLine3D supportingLine()

continuousCurves

public java.util.Collection<LineSegment3D> continuousCurves()
Description copied from interface: Curve3D
Returns the collection of continuous curves which constitute this curve.

Specified by:
continuousCurves in interface Curve3D
Returns:
a collection of continuous curves.

firstPoint

public Point3D firstPoint()
Description copied from interface: Curve3D
Get the first point of the curve. It must returns the same result as getPoint(getT0()).

Specified by:
firstPoint in interface Curve3D
Returns:
the first point of the curve

lastPoint

public Point3D lastPoint()
Description copied from interface: Curve3D
Get the last point of the curve. It must returns the same result as getPoint(getT1()).

Specified by:
lastPoint in interface Curve3D
Returns:
the last point of the curve.

point

public Point3D point(double t)
Description copied from interface: Curve3D
Gets the point from a parametric representation of the curve. If the parameter lies outside the definition range, the parameter corresponding to the closest bound is used instead. This method can be used to draw an approximated outline of a curve, by selecting multiple values for t and drawing lines between them.

Specified by:
point in interface Curve3D

position

public double position(Point3D point)
If point does not project on the line segment, return Double.NaN.

Specified by:
position in interface Curve3D
Parameters:
point - a point belonging to the curve
Returns:
the position of the point on the curve
See Also:
Curve3D.position(math.geom3d.Point3D)

reverseCurve

public Curve3D reverseCurve()
Description copied from interface: Curve3D
Returns the curve with same trace on the plane with parametrization in reverse order.

Specified by:
reverseCurve in interface Curve3D

singularPoints

public java.util.Collection<Point3D> singularPoints()
Returns the2 end points.

Specified by:
singularPoints in interface Curve3D
Returns:
a collection of Point3D.
See Also:
Curve3D.singularPoints()

subCurve

public LineSegment3D subCurve(double t0,
                              double t1)
Description copied from interface: Curve3D
Returns a portion of the original curve, delimited by two positions on the curve.

Specified by:
subCurve in interface Curve3D
Parameters:
t0 - position of the start of the sub-curve
t1 - position of the end of the sub-curve
Returns:
the portion of original curve comprised between t0 and t1.

getT0

public double getT0()
Return 0, by definition of LineSegment.

Specified by:
getT0 in interface Curve3D
See Also:
Curve3D.getT0()

getT1

public double getT1()
Return 1, by definition of LineSegment.

Specified by:
getT1 in interface Curve3D
See Also:
Curve3D.getT1()

project

public double project(Point3D point)
Description copied from interface: Curve3D
Returns the position of the closest orthogonal projection of the point on the curve, or of the closest singular point. This function should always returns a valid value.

Specified by:
project in interface Curve3D
Parameters:
point - a point to project
Returns:
the position of the closest orthogonal projection

transform

public Curve3D transform(AffineTransform3D trans)
Description copied from interface: Curve3D
Transforms the curve by an affine transform. The result is an instance of Curve3D.

Specified by:
transform in interface Curve3D
Specified by:
transform in interface Shape3D

clip

public Shape3D clip(Box3D box)
Specified by:
clip in interface Shape3D

contains

public boolean contains(Point3D point)
Specified by:
contains in interface Shape3D

boundingBox

public Box3D boundingBox()
Specified by:
boundingBox in interface Shape3D

distance

public double distance(Point3D point)
Description copied from interface: Shape3D
Gets the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.

Specified by:
distance in interface Shape3D

isBounded

public boolean isBounded()
Returns true, as a LineSegment3D is always bounded.

Specified by:
isBounded in interface Shape3D
See Also:
Shape3D.isBounded()

isEmpty

public boolean isEmpty()
Returns false, as a LineSegment3D is never empty.

Specified by:
isEmpty in interface Shape3D
See Also:
Shape3D.isEmpty()