Package org.gvsig.dwg.lib.util
Class Vector3D
java.lang.Object
org.gvsig.dwg.lib.util.Vector3D
3dim double vector. A vector is transformed different than a point.
The class is now declared final to allow a more aggresive optimization.
- Version:
- 1.10, 01/13/99
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a vector.Cross product.doublelength()Calculate the length.Get difference with point.Get difference with vector.doubleScalar product.voidNormalize.Get sum of this vector and point.Get sum of vectors.voidscale(double f) Scale.voidSubstract a vector from this.toString()Output.
-
Field Details
-
x
public double x -
y
public double y -
z
public double z
-
-
Constructor Details
-
Vector3D
public Vector3D() -
Vector3D
Copy constructor.- Parameters:
v- vector to copy
-
Vector3D
Copy from a point.- Parameters:
p- point to copy
-
Vector3D
public Vector3D(double xx, double yy, double zz) - Parameters:
xx- x coordyy- y coordzz- z coord
-
-
Method Details
-
length
public double length()Calculate the length.- Returns:
- length of vector
-
scale
public void scale(double f) Scale.- Parameters:
f- scaling factor
-
normalize
public void normalize()Normalize. Scale vector so it has length 1. -
add
Add a vector.- Parameters:
v- vector to add
-
plus
Get sum of vectors.- Parameters:
v- vector to add- Returns:
- this+v
-
plus
Get sum of this vector and point.- Parameters:
p- point to add- Returns:
- this+p
-
sub
Substract a vector from this.- Parameters:
v- vector to substract
-
minus
Get difference with point.- Parameters:
p- point to substract- Returns:
- this-p = -(p-this)
-
minus
Get difference with vector.- Parameters:
v- vector to substract- Returns:
- this-v
-
mult
Scalar product.- Parameters:
v- vector to multiply- Returns:
- this*v
-
cross
Cross product.- Parameters:
v- vector to multiply- Returns:
- this x v
-
toString
Output.
-