gnu.gleem.linalg
Class Line

java.lang.Object
  |
  +--gnu.gleem.linalg.Line

public class Line
extends java.lang.Object

Represents a line in 3D space.


Constructor Summary
Line()
          Default constructor initializes line to point (0, 0, 0) and direction (1, 0, 0)
Line(Vec3f direction, Vec3f point)
          Line goes in direction direction through the point point.
 
Method Summary
 boolean closestPointToRay(Vec3f rayStart, Vec3f rayDirection, Vec3f closestPoint)
          Find closest point on this line to the given ray, specified by start point and direction.
 Vec3f getDirection()
          Direction is normalized internally, so direction is not necessarily equal to plane.setDirection(direction); plane.getDirection();
 Vec3f getPoint()
           
 void projectPoint(Vec3f pt, Vec3f projPt)
          Project a point onto the line
 void setDirection(Vec3f direction)
          Setter does some work to maintain internal caches.
 void setPoint(Vec3f point)
          Setter does some work to maintain internal caches.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Line

public Line()
Default constructor initializes line to point (0, 0, 0) and direction (1, 0, 0)


Line

public Line(Vec3f direction,
            Vec3f point)
Line goes in direction direction through the point point. direction does not need to be normalized but must not be the zero vector.

Method Detail

setDirection

public void setDirection(Vec3f direction)
Setter does some work to maintain internal caches. direction does not need to be normalized but must not be the zero vector.


getDirection

public Vec3f getDirection()
Direction is normalized internally, so direction is not necessarily equal to plane.setDirection(direction); plane.getDirection();


setPoint

public void setPoint(Vec3f point)
Setter does some work to maintain internal caches.


getPoint

public Vec3f getPoint()

projectPoint

public void projectPoint(Vec3f pt,
                         Vec3f projPt)
Project a point onto the line


closestPointToRay

public boolean closestPointToRay(Vec3f rayStart,
                                 Vec3f rayDirection,
                                 Vec3f closestPoint)
Find closest point on this line to the given ray, specified by start point and direction. If ray is parallel to this line, returns false and closestPoint is not modified.