|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.Plane
public class Plane
Implements a plane in three space, as characterized by the points x which satisfy
T n x - d = 0where n is the plane normal and d is the offset.
Field Summary | |
---|---|
Vector3d |
normal
Plane normal |
double |
offset
Plane offset (distance of the origin from the plane) |
Constructor Summary | |
---|---|
Plane()
Creates a plane initialized to the x-y plane. |
|
Plane(double nx,
double ny,
double nz,
double off)
Creates a plane from normal components and the an offset value. |
|
Plane(Plane p)
Creates a plane initialized to another plane. |
|
Plane(Point3d p1,
Point3d p2,
Point3d p3)
Constructs a plane given three non-colinear points arranged counter-clockwise around the normal. |
|
Plane(Vector3d n,
double d)
Creates a plane with a specified normal and offset. |
|
Plane(Vector3d n,
Point3d p)
Creates a plane which passes through a particular point with a specified normal direction. |
Method Summary | |
---|---|
double |
distance(Vector3d p)
Returns the signed distance between a point and this plane. |
void |
fit(Point3d[] pnts,
int num)
Fits this plane to a set of points. |
Vector3d |
getNormal()
Returns the normal for this plane. |
double |
getOffset()
Returns the offset for this plane. |
double |
intersectLine(Point3d isect,
Vector3d dir,
Vector3d pnt)
Intersects this plane with a line. |
boolean |
intersectPlane(Point3d pnt,
Vector3d dir,
Plane plane)
Intersects this plane with another plane. |
boolean |
intersectRay(Point3d isect,
Vector3d dir,
Vector3d origin)
Intersects this plane with a directed ray. |
void |
inverseTransform(AffineTransform3dBase X)
Applies an inverse affine transformation to this plane, in place. |
void |
inverseTransform(AffineTransform3dBase X,
Plane plane)
Applies an inverse affine transformation to a specified plane and places the result in this plane. |
void |
inverseTransform(RigidTransform3d X)
Applies an inverse rigid transformation to this plane, in place. |
void |
inverseTransform(RigidTransform3d X,
Plane plane)
Applies an inverse rigid transformation to a specified plane and places the result in this plane. |
double |
project(Point3d pr,
Point3d p1)
Projects a point onto this plane, and returns the signed distance of the original point from the plane. |
void |
reflect(Point3d pr,
Point3d p1)
Reflects a point about this plane. |
void |
scale(double s)
Scales the units of this plane by the specified scale factor. |
void |
scan(ReaderTokenizer rtok)
Sets the contents of this plane to values read from a ReaderTokenizer. |
void |
set(double nx,
double ny,
double nz,
double d)
Sets the plane to the indicated normal direction and offset. |
void |
set(Plane p)
Sets this plane to the values of another plane. |
void |
set(Point3d p1,
Point3d p2,
Point3d p3)
Sets this plane to pass through three non-colinear points arranged counter-clockwise around the normal. |
void |
set(RigidTransform3d X)
Sets this plane to the x-y plane defined by a RigidTransformation. |
void |
set(Vector3d n,
double d)
Sets the plane to the indicated normal direction and offset. |
void |
set(Vector3d n,
Point3d p)
Sets this plane to pass through a particular point with a specified normal direction. |
void |
setRandom()
|
java.lang.String |
toString()
Returns a String representation of this Plane, consisting of the x, y, and z components of the normal, followed by the offset. |
java.lang.String |
toString(NumberFormat fmt)
Returns a String representation of this Plane, consisting of the x, y, and z components of the normal, followed by the offset. |
java.lang.String |
toString(java.lang.String fmtStr)
Returns a String representation of this Plane, consisting of the x, y, and z components of the normal, followed by the offset. |
void |
transform(AffineTransform3dBase X)
Applies an affine transformation to this plane, in place. |
void |
transform(AffineTransform3dBase X,
Plane plane)
Applies an affine transformation to a specified plane and places the result in this plane. |
void |
transform(RigidTransform3d X)
Applies a rigid transformation to this plane, in place. |
void |
transform(RigidTransform3d X,
Plane plane)
Applies a rigid transformation to a specified plane and places the result in this plane. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Vector3d normal
public double offset
Constructor Detail |
---|
public Plane()
public Plane(Plane p)
p
- plane to copypublic Plane(Vector3d n, Point3d p)
n
- normal directionp
- point to pass throughpublic Plane(double nx, double ny, double nz, double off)
nx
- normal x componentny
- normal y componentnz
- normal z componentoff
- offset valuepublic Plane(Vector3d n, double d)
n
- normal directiond
- offset (equal to the dot product of the normal and every point on the
plane).public Plane(Point3d p1, Point3d p2, Point3d p3) throws java.lang.IllegalArgumentException
p1
- first pointp2
- second pointp3
- third point
java.lang.IllegalArgumentException
- if the points are colinearMethod Detail |
---|
public void set(Plane p)
p
- plane to copypublic void set(Vector3d n, double d)
n
- normal directiond
- offsetpublic void set(double nx, double ny, double nz, double d)
nx
- x component of normal directionny
- y component of normal directionnz
- z component of normal directiond
- offsetpublic void set(Vector3d n, Point3d p)
n
- normal directionp
- point to pass throughpublic void set(RigidTransform3d X)
X
- transformation defining the planepublic void set(Point3d p1, Point3d p2, Point3d p3) throws java.lang.IllegalArgumentException
p1
- first pointp2
- second pointp3
- third point
java.lang.IllegalArgumentException
- if the points are colinearpublic double distance(Vector3d p)
p
- point to compute distance for
public double project(Point3d pr, Point3d p1)
pr
- projected pointp1
- point to project
public void reflect(Point3d pr, Point3d p1)
pr
- reflected pointp1
- point to reflectpublic boolean intersectRay(Point3d isect, Vector3d dir, Vector3d origin)
isect
- intersection pointdir
- direction of the rayorigin
- origin of the ray
public double intersectLine(Point3d isect, Vector3d dir, Vector3d pnt)
isect
- intersection point (optional)dir
- vector in the direction of the linepnt
- point lying on the line
public boolean intersectPlane(Point3d pnt, Vector3d dir, Plane plane)
false
and the point and direction are undefined. In
that case the offsets should be compared to see if the planes are
coincident.
pnt
- returns a point on the intersection line.dir
- returns a unit vector in the direction of the intersection line.plane
- plane to intersect
true
if the planes intersect in a line
or false
if they are parallel.public 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 specification
public 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 format
public void transform(AffineTransform3dBase X)
X
- affine transformationpublic void inverseTransform(AffineTransform3dBase X)
X
- affine transformationpublic void transform(AffineTransform3dBase X, Plane plane)
X
- affine transformationplane
- plane to transformpublic void inverseTransform(AffineTransform3dBase X, Plane plane)
X
- affine transformationplane
- plane to transformpublic void transform(RigidTransform3d X)
X
- rigid transformationpublic void inverseTransform(RigidTransform3d X)
X
- rigid transformationpublic void transform(RigidTransform3d X, Plane plane)
X
- rigid transformationplane
- plane to transformpublic void inverseTransform(RigidTransform3d X, Plane plane)
X
- rigid transformationplane
- plane to transformpublic void scale(double s)
s
- scale factor by which to scale planepublic Vector3d getNormal()
public double getOffset()
public void scan(ReaderTokenizer rtok) throws java.io.IOException
[ ]
.
rtok
- Tokenizer from which vector values are read. Number parsing should be
enabled.
java.io.IOException
- if an I/O or formatting error is encounteredpublic void fit(Point3d[] pnts, int num)
pnts
- points to fitnum
- number of pointspublic void setRandom()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |