NASA World Wind

gov.nasa.worldwind.geom
Class Line

java.lang.Object
  extended by gov.nasa.worldwind.geom.Line

public final class Line
extends java.lang.Object


Constructor Summary
Line(Vec4 origin, Vec4 direction)
           
 
Method Summary
static Vec4[] clipToFrustum(Vec4 pa, Vec4 pb, Frustum frustum)
          Clip a line segment to a frustum, returning the end points of the portion of the segment that is within the frustum.
 double distanceTo(Vec4 p)
          Calculate the shortests distance between this line and a specified Vec4.
static double distanceToSegment(Vec4 p0, Vec4 p1, Vec4 p)
           
 boolean equals(java.lang.Object o)
          Performs a comparison to test whether this Object is internally identical to the other Object o.
static Line fromSegment(Vec4 pa, Vec4 pb)
          Create the line containing a line segement between two points.
 Vec4 getDirection()
           
 Vec4 getOrigin()
           
 Vec4 getPointAt(double t)
           
 int hashCode()
           
static Vec4 nearestPointOnSegment(Vec4 p0, Vec4 p1, Vec4 p)
           
 Vec4 nearestPointTo(Vec4 p)
           
 double selfDot()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line

public Line(Vec4 origin,
            Vec4 direction)
Parameters:
origin -
direction -
Throws:
java.lang.IllegalArgumentException - if origin is null, or direction is null or has zero length
Method Detail

clipToFrustum

public static Vec4[] clipToFrustum(Vec4 pa,
                                   Vec4 pb,
                                   Frustum frustum)
Clip a line segment to a frustum, returning the end points of the portion of the segment that is within the frustum.

Parameters:
pa - the first point of the segment.
pb - the second point of the segment.
frustum - the frustum.
Returns:
The two points at which the segment intersects the frustum, or null if the segment does not intersect and the frustum does not fully contain it. If the segment is coincident with a plane of the frustum, the returned segment is the portion of the original segment on that plane, clipped to the other frustum planes.

distanceTo

public final double distanceTo(Vec4 p)
Calculate the shortests distance between this line and a specified Vec4. This method returns a positive distance.

Parameters:
p - the Vec4 whose distance from this Line will be calculated
Returns:
the distance between this Line and the specified Vec4
Throws:
java.lang.IllegalArgumentException - if p is null

distanceToSegment

public static double distanceToSegment(Vec4 p0,
                                       Vec4 p1,
                                       Vec4 p)

equals

public final boolean equals(java.lang.Object o)
Performs a comparison to test whether this Object is internally identical to the other Object o. This method takes into account both direction and origin, so two lines which may be equivalent may not be considered equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared against.
Returns:
true if these two objects are equal, false otherwise

fromSegment

public static Line fromSegment(Vec4 pa,
                               Vec4 pb)
Create the line containing a line segement between two points.

Parameters:
pa - the first point of the line segment.
pb - the second point of the line segment.
Returns:
The line containing the two points.
Throws:
java.lang.IllegalArgumentException - if either point is null or they are coincident.

getDirection

public final Vec4 getDirection()

getOrigin

public final Vec4 getOrigin()

getPointAt

public final Vec4 getPointAt(double t)

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

nearestPointOnSegment

public static Vec4 nearestPointOnSegment(Vec4 p0,
                                         Vec4 p1,
                                         Vec4 p)

nearestPointTo

public final Vec4 nearestPointTo(Vec4 p)

selfDot

public final double selfDot()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

NASA World Wind