public class Line3d
extends java.lang.Object
Constructor and Description |
---|
Line3d()
Creates a Line3d and initializes it to the x axis.
|
Line3d(double[] values)
Creates a Line3d and initialises it to the prescribed values.
|
Line3d(double dirx,
double diry,
double dirz,
double x,
double y,
double z)
Creates a Line3d and initialises it to the prescribed values.
|
Line3d(Line3d line3d)
Creates a Line3d and initializes it from an existing Line3d.
|
Line3d(Vector3d direction,
Point3d point)
Creates an Line3d and sets it to the prescribed values.
|
Modifier and Type | Method and Description |
---|---|
Point3d |
closestPoint(Line3d line)
Finds the point on THIS line that is closest to the supplied line
|
Point3d |
closestPoint(Line3d line,
double epsilon)
Finds the point on THIS line that is closest to the supplied line
|
static boolean |
closestPointBetweenLines(Line3d line1,
Line3d line2,
Point3d pnt1,
Point3d pnt2,
double epsilon) |
static boolean |
closestPointBetweenLines(Vector3d v1,
Point3d p1,
Vector3d v2,
Point3d p2,
Point3d out1,
Point3d out2,
double epsilon) |
boolean |
contains(Point3d point)
Returns true if supplied point lies exactly on the line
|
double |
distance(Vector3d pnt)
Finds the distance of a point to this line.
|
boolean |
epsilonContains(Point3d point,
double eps)
Returns true if the supplied point lies on this line within
a specified tolerance
|
boolean |
epsilonEquals(Line3d line3d,
double eps)
Returns true if the elements of this Line3d equal those of another
Line3d within a prescribed tolerance
epsilon . |
boolean |
equals(Line3d line3d)
Returns true if the elements of this Line3d equal those of another
Line3d exactly.
|
boolean |
equals(java.lang.Object obj)
Returns true if the supplied object is a Line3d and its elements equal
those of this Line3d exactly.
|
void |
get(double[] values)
Gets the values associated with this Line3d.
|
void |
getDirection(Vector3d d)
Gets the direction vector for the line
|
void |
getPoint(Vector3d p)
Gets a point on the line
|
Point3d |
project(Vector3d point)
Finds the closest point to the supplied Point3d that lies
on the line.
|
void |
set(double[] values)
Sets this Line3d to the prescribed values.
|
void |
set(double dirx,
double diry,
double dirz,
double x,
double y,
double z)
Sets this Line3d to the prescribed values.
|
void |
set(Line3d line3d)
Sets this Line3d to the values of another Line3d.
|
void |
set(Vector3d direction,
Point3d point)
Sets this Line3d to the prescribed values.
|
void |
setDirection(Vector3d d) |
void |
setPoint(Point3d p) |
java.lang.String |
toString()
Returns a String representation of this Line3d, consisting of the
components of the direction vector followed by those of the point
|
java.lang.String |
toString(NumberFormat fmt)
Returns a String representation of this Point3d, consisting of the x, y,
and z components of the direction vector, followed by components of the
point.
|
java.lang.String |
toString(java.lang.String fmtStr)
Returns a String representation of this Point3d, consisting of the x, y,
and z components of the direction vector, followed by components of the
point.
|
public Line3d()
public Line3d(double[] values)
values
- Line3d values given as an array. The x, y, and z components of the
direction vector are given by elements 0 through 2, and point is given
by elements 3-5.public Line3d(double dirx, double diry, double dirz, double x, double y, double z)
dirx
- x component of the direction vectordiry
- y component of the direction vectordirz
- z component of the direction vectorx
- x component of the pointy
- y component of the pointz
- z component of the pointpublic Line3d(Vector3d direction, Point3d point)
direction
- direction vectorpoint
- Point on the linepublic Line3d(Line3d line3d)
line3d
- Line3d to supply initial valuespublic void set(double dirx, double diry, double dirz, double x, double y, double z)
dirx
- x component of direction vectordiry
- y component of direction vectordirz
- z component of direction vectorx
- x component of pointy
- y component of pointz
- z component of pointpublic void set(double[] values)
values
- Line3d values given as an array. The x, y, and z components of the
direction vector are given by elements 0 through 2, and the position
components by elements 3 through 5public void set(Vector3d direction, Point3d point)
direction
- direction vectorpoint
- point on the linepublic void set(Line3d line3d)
line3d
- Line3d supplying new valuespublic void get(double[] values)
values
- returns the Line3d values. The x, y, and z components of the direction
vector are given by elements 0 through 2, and the components of the point
on the line are given by elements 3 through 5public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String fmtStr)
printf
style
format string. For a description of the format string syntax, see
NumberFormat
.fmtStr
- numeric format specificationpublic java.lang.String toString(NumberFormat fmt)
printf
style as
decribed by the parameter NumberFormat
. When called numerous
times, this routine can be more efficient than
toString(String)
, because the NumberFormat
does not need to be recreated each
time from a specification string.fmt
- numeric formatpublic Point3d project(Vector3d point)
point
- The Point3d to projectpublic double distance(Vector3d pnt)
pnt
- Point to find the distance topublic boolean epsilonContains(Point3d point, double eps)
point
- Point to test if is on the lineeps
- Tolerance distancepublic boolean contains(Point3d point)
point
- Point3d to testpublic boolean epsilonEquals(Line3d line3d, double eps) throws ImproperSizeException
epsilon
.line3d
- Line3d to compare witheps
- comparison toleranceImproperSizeException
public boolean equals(Line3d line3d)
line3d
- Line3d to compare withpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to compare withpublic void getDirection(Vector3d d)
d
- Filled by the values of the direction vectorpublic void getPoint(Vector3d p)
p
- Filled by values of a point on the linepublic void setDirection(Vector3d d)
public void setPoint(Point3d p)
public Point3d closestPoint(Line3d line, double epsilon)
line
- The Line3d to which we search for the closest pointepsilon
- Tolerance for which lines are considered parallelpublic static boolean closestPointBetweenLines(Line3d line1, Line3d line2, Point3d pnt1, Point3d pnt2, double epsilon)
public static boolean closestPointBetweenLines(Vector3d v1, Point3d p1, Vector3d v2, Point3d p2, Point3d out1, Point3d out2, double epsilon)
public Point3d closestPoint(Line3d line)
line
- The Line3d to which we search for the closest point