Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- set(double, double, double)
- set(double, double)
- set(Vector3d)
- sub(Vector3d)
- clone()
- negated()
- plus(Vector3d)
- minus(Vector3d)
- times(double)
- times(Vector3d)
- dividedBy(double)
- dot(Vector3d)
- lerp(Vector3d, double)
- magnitude()
- magnitudeSq()
- normalized()
- cross(Vector3d)
- toStlString()
- toStlString(StringBuilder)
- toObjString()
- toObjString(StringBuilder)
- transform(Transform)
- transformed(Transform)
- transform(Transform, double)
- transformed(Transform, double)
- toString()
- equals(Object)
- angle(Vector3d)
- distance(Vector3d)
- hashCode()
- x(double)
- y(double)
- z(double)
- orthogonal()
- add(double, double, double)
- add(Vector3d)
- rotateX(double)
- rotateY(double)
- rotateZ(double)
- rotate(Vector3d, double)
- midpoint(Vector3d)
- theta()
- phi()
Class Vector3d
java.lang.Object
eu.mihosoft.vrl.v3d.Vector3d
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(double x, double y, double z) double
Returns the angle between this and the specified vector.clone()
Returns the cross product of this vector and the specified vector.double
dividedBy
(double a) Returns this vector devided by the specified value.double
Returns the dot product of this vector and the specified vector.boolean
int
hashCode()
Linearly interpolates between this and the specified vector.double
Returns the magnitude of this vector.double
Returns the squared magnitude of this vector (this.dot(this)
).Constructs a newPoint3D
at the geometric mean of this point and the given point.Returns the difference of this vector and the specified vector.negated()
Returns a negated copy of this vector.Returns a normalized copy of this vector with length1
.Creates a new vector which is orthogonal to this.double
phi()
Returns the sum of this vector and the specified vector.void
Rotates the given vector clockwise around the axis produced by this vector by the given angle.rotateX
(double angle) rotateY
(double angle) rotateZ
(double angle) void
set
(double x, double y) void
set
(double x, double y, double z) void
Subtracts the given vector from this vectordouble
theta()
times
(double a) Returns the product of this vector and the specified value.Returns the product of this vector and the specified vector.Returns this vector in OBJ string format.Returns this vector in OBJ string format.Returns this vector in STL string format.Returns this vector in STL string format.toString()
Applies the specified transformation to this vector.Applies the specified transformation to this vector.transformed
(Transform transform) Returns a transformed copy of this vector.transformed
(Transform transform, double amount) Returns a transformed copy of this vector.static Vector3d
x
(double x) Creates a new vector with specifiedx
static Vector3d
y
(double y) Creates a new vector with specifiedy
static Vector3d
z
(double z) Creates a new vector with specifiedz
-
Field Details
-
Constructor Details
-
Vector3d
public Vector3d(double x, double y, double z) Creates a new vector.- Parameters:
x
- x valuey
- y valuez
- z value
-
Vector3d
Creates a new vector based on provided vector (copy constructor)- Parameters:
vec
- vector for copy constructor
-
Vector3d
public Vector3d(double x, double y) Creates a new vector with specifiedx
,y
andz = 0
.- Parameters:
x
- x valuey
- y value
-
-
Method Details
-
set
public void set(double x, double y, double z) -
set
public void set(double x, double y) -
set
-
sub
-
clone
-
negated
Returns a negated copy of this vector. Note: this vector is not modified.- Returns:
- a negated copy of this vector
-
plus
-
minus
-
times
Returns the product of this vector and the specified value.- Parameters:
a
- the value Note: this vector is not modified.- Returns:
- the product of this vector and the specified value
-
times
-
dividedBy
Returns this vector devided by the specified value.- Parameters:
a
- the value Note: this vector is not modified.- Returns:
- this vector devided by the specified value
-
dot
Returns the dot product of this vector and the specified vector. Note: this vector is not modified.- Parameters:
a
- the second vector- Returns:
- the dot product of this vector and the specified vector
-
lerp
Linearly interpolates between this and the specified vector. Note: this vector is not modified.- Parameters:
a
- vectort
- interpolation value- Returns:
- copy of this vector if
t = 0
; copy of a ift = 1
; the point midway between this and the specified vector ift = 0.5
-
magnitude
public double magnitude()Returns the magnitude of this vector. Note: this vector is not modified.- Returns:
- the magnitude of this vector
-
magnitudeSq
public double magnitudeSq()Returns the squared magnitude of this vector (this.dot(this)
). Note: this vector is not modified.- Returns:
- the squared magnitude of this vector
-
normalized
Returns a normalized copy of this vector with length1
. Note: this vector is not modified.- Returns:
- a normalized copy of this vector with length
1
-
cross
-
toStlString
Returns this vector in STL string format.- Returns:
- this vector in STL string format
-
toStlString
Returns this vector in STL string format.- Parameters:
sb
- string builder- Returns:
- the specified string builder
-
toObjString
Returns this vector in OBJ string format.- Returns:
- this vector in OBJ string format
-
toObjString
Returns this vector in OBJ string format.- Parameters:
sb
- string builder- Returns:
- the specified string builder
-
transform
-
transformed
-
transform
-
transformed
-
toString
-
equals
-
angle
Returns the angle between this and the specified vector.- Parameters:
v
- vector- Returns:
- angle in radians
-
distance
-
hashCode
-
x
Creates a new vector with specifiedx
- Parameters:
x
- x value- Returns:
- a new vector
[x,0,0]
-
y
Creates a new vector with specifiedy
- Parameters:
y
- y value- Returns:
- a new vector
[0,y,0]
-
z
Creates a new vector with specifiedz
- Parameters:
z
- z value- Returns:
- a new vector
[0,0,z]
-
orthogonal
Creates a new vector which is orthogonal to this. this_i , this_j , this_k => i,j,k € {1,2,3} permutation looking for orthogonal vector o to vector this: this_i * o_i + this_j * o_j + this_k * o_k = 0- Returns:
- a new vector which is orthogonal to this
-
add
-
add
-
rotateX
-
rotateY
-
rotateZ
-
rotate
Rotates the given vector clockwise around the axis produced by this vector by the given angle.- Parameters:
vector
- the vector to rotateangle
- the angle of rotation
-
midpoint
-
theta
public double theta()- Returns:
- theta elevation (angle between vector and z axis)
-
phi
public double phi()- Returns:
- phi azimuth (angle between projection onto xy plane and x axis)
-