|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectza.co.luma.geom.Vector3DDouble
public class Vector3DDouble
Class that represents a real 3D vector.
Field Summary | |
---|---|
double |
x
|
double |
y
|
double |
z
|
Constructor Summary | |
---|---|
Vector3DDouble(double x,
double y,
double z)
Constructs a new vector with the given coordinates. |
Method Summary | |
---|---|
static Vector3DDouble |
add(Vector3DDouble p1,
Vector3DDouble p2)
Adds two vectors, and return the result. |
static double |
distance(Vector3DDouble p1,
Vector3DDouble p2)
Returns the Euclidean distance between two points. |
static double |
getHeight(double x,
double y,
Vector3DDouble p,
Vector3DDouble q)
Returns a z-coordinate so that the vector (x, y, z) lies in the same plane as the plane which contains both p and q. |
static Vector3DDouble |
getPointBetween(Vector3DDouble p1,
Vector3DDouble p2,
double r)
Gets a point between two points. |
double |
getX()
|
double |
getY()
|
double |
getZ()
|
static boolean |
pointInTriangle(Vector3DDouble p,
Vector3DDouble a,
Vector3DDouble b,
Vector3DDouble c)
Checks whether a point lies within the triangle described by three vertices. |
static boolean |
sameSide(Vector3DDouble p1,
Vector3DDouble p2,
Vector3DDouble a,
Vector3DDouble b)
Checks whether a and b lies on the same side of line p1-p2, or not. |
static double |
scalarCross(Vector3DDouble p1,
Vector3DDouble p2)
Returns the z-coordinate of the cross product of two points projected on the plane z = 0, (embedded in 3D space). |
void |
scale(double r)
Scale this vector by a given factor. |
static Vector3DDouble |
scale(Vector3DDouble p,
double r)
Returns a new vector, in the same direction as p, but sacled by a factor r. |
void |
setLocation(double x,
double y,
double z)
Sets the new coordinates for this vector. |
double |
size()
Returns the size (Euclidean length) of this vector. |
static double |
size(Vector3DDouble p)
Returns the Euclidean length of this vector. |
static Vector3DDouble |
subtract(Vector3DDouble p1,
Vector3DDouble p2)
Subtracts p2 from p1 and returns the result as a new vector. |
java.lang.String |
toString()
|
static Vector3DDouble |
unit(Vector3DDouble p1)
Returns a new unit vector in the same direcction as the given vector. |
Vector3DDouble |
unitVector()
Returns a unit length vector in the same direction is this vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double x
public double y
public double z
Constructor Detail |
---|
public Vector3DDouble(double x, double y, double z)
x
- x-coordinatey
- y-coordinatez
- z-coordinateMethod Detail |
---|
public double getX()
public double getY()
public double getZ()
public void setLocation(double x, double y, double z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic java.lang.String toString()
toString
in class java.lang.Object
public double size()
public void scale(double r)
r
- The scaling factor.public Vector3DDouble unitVector()
public static double distance(Vector3DDouble p1, Vector3DDouble p2)
public static double scalarCross(Vector3DDouble p1, Vector3DDouble p2)
public static boolean sameSide(Vector3DDouble p1, Vector3DDouble p2, Vector3DDouble a, Vector3DDouble b)
public static boolean pointInTriangle(Vector3DDouble p, Vector3DDouble a, Vector3DDouble b, Vector3DDouble c)
p
- The point.a
- One vertice of the triangle.b
- One vertice of the triangle.c
- One vertice of the triangle.
public static Vector3DDouble add(Vector3DDouble p1, Vector3DDouble p2)
public static Vector3DDouble getPointBetween(Vector3DDouble p1, Vector3DDouble p2, double r)
p1
- p2
- r
- Controls the distance of the new point from the other points. If r is 0, the new point coincides with
p1, if r is 1, the new point coincides with p2. If r lies between 0, and 1, the new point lies between
p1 and p2. If r is smaller than 0, p1 lies between the new point and p2, and if r is greater than 1,
p2 lies between the new point and p1.
public static Vector3DDouble scale(Vector3DDouble p, double r)
p
- Direction and original size.r
- Scaling fator
public static double size(Vector3DDouble p)
p
-
public static Vector3DDouble subtract(Vector3DDouble p1, Vector3DDouble p2)
public static Vector3DDouble unit(Vector3DDouble p1)
public static double getHeight(double x, double y, Vector3DDouble p, Vector3DDouble q)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |