|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectquickhull3d.Vector3d
public class Vector3d
A three-element vector. This class is actually a reduced version of the Vector3d class contained in the author's matlib package (which was partly inspired by javax.vecmath). Only a mininal number of methods which are relevant to convex hull generation are supplied here.
| Field Summary | |
|---|---|
double |
x
First element |
double |
y
Second element |
double |
z
Third element |
| Constructor Summary | |
|---|---|
Vector3d()
Creates a 3-vector and initializes its elements to 0. |
|
Vector3d(double x,
double y,
double z)
Creates a 3-vector with the supplied element values. |
|
Vector3d(Vector3d v)
Creates a 3-vector by copying an existing one. |
|
| Method Summary | |
|---|---|
void |
add(Vector3d v1)
Adds this vector to v1 and places the result in this vector. |
void |
add(Vector3d v1,
Vector3d v2)
Adds vector v1 to v2 and places the result in this vector. |
void |
cross(Vector3d v1,
Vector3d v2)
Computes the cross product of v1 and v2 and places the result in this vector. |
double |
distance(Vector3d v)
Returns the Euclidean distance between this vector and vector v. |
double |
distanceSquared(Vector3d v)
Returns the squared of the Euclidean distance between this vector and vector v. |
double |
dot(Vector3d v1)
Returns the dot product of this vector and v1. |
double |
get(int i)
Gets a single element of this vector. |
double |
norm()
Returns the 2 norm of this vector. |
void |
normalize()
Normalizes this vector in place. |
double |
normSquared()
Returns the square of the 2 norm of this vector. |
void |
scale(double s)
Scales the elements of this vector by s. |
void |
scale(double s,
Vector3d v1)
Scales the elements of vector v1 by s and places
the results in this vector. |
void |
set(double x,
double y,
double z)
Sets the elements of this vector to the prescribed values. |
void |
set(int i,
double value)
Sets a single element of this vector. |
void |
set(Vector3d v1)
Sets the values of this vector to those of v1. |
void |
setZero()
Sets the elements of this vector to zero. |
void |
sub(Vector3d v1)
Subtracts v1 from this vector and places the result in this vector. |
void |
sub(Vector3d v1,
Vector3d v2)
Subtracts vector v1 from v2 and places the result in this vector. |
java.lang.String |
toString()
Returns a string representation of this vector, consisting of the x, y, and z coordinates. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public double x
public double y
public double z
| Constructor Detail |
|---|
public Vector3d()
public Vector3d(Vector3d v)
v - vector to be copied
public Vector3d(double x,
double y,
double z)
x - first elementy - second elementz - third element| Method Detail |
|---|
public double get(int i)
i - element index
public void set(int i,
double value)
i - element indexvalue - element valuepublic void set(Vector3d v1)
v1 - vector whose values are copied
public void add(Vector3d v1,
Vector3d v2)
v1 - left-hand vectorv2 - right-hand vectorpublic void add(Vector3d v1)
v1 - right-hand vector
public void sub(Vector3d v1,
Vector3d v2)
v1 - left-hand vectorv2 - right-hand vectorpublic void sub(Vector3d v1)
v1 - right-hand vectorpublic void scale(double s)
s.
s - scaling factor
public void scale(double s,
Vector3d v1)
s and places
the results in this vector.
s - scaling factorv1 - vector to be scaledpublic double norm()
public double normSquared()
public double distance(Vector3d v)
public double distanceSquared(Vector3d v)
public double dot(Vector3d v1)
v1 - right-hand vector
public void normalize()
public void setZero()
public void set(double x,
double y,
double z)
x - value for first elementy - value for second elementz - value for third element
public void cross(Vector3d v1,
Vector3d v2)
v1 - left-hand vectorv2 - right-hand vectorpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||