Package com.reportmill.graphics
Class RMVector3D
- java.lang.Object
-
- com.reportmill.graphics.RMVector3D
-
public class RMVector3D extends java.lang.Object
This class represents a 3D vector.
-
-
Constructor Summary
Constructors Constructor Description RMVector3D(float x, float y, float z)
Creates a new vector from the given coords.RMVector3D(RMVector3D aVector)
Creates a new vector from the given vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RMVector3D
add(RMVector3D aVector)
Add the given vector to this.float
getAngleBetween(RMVector3D v2)
Returns the angle between the receiver and the given vector.RMVector3D
getCrossProduct(RMVector3D v2)
Returns the vector perpendicular to the receiver and the given vector.float
getDotProduct(RMVector3D v2)
Returns the dot product of the receiver and the given vector.float
getMagnitude()
Returns the magnitude of the vector.boolean
isAligned(RMVector3D aVector, boolean includePerpendiculars)
Returns whether given vector is in same general direction of this (with option to include perpendiculars).boolean
isAway(RMVector3D aVector, boolean includePerpendiculars)
Returns whether given vector is pointing away from the direction of this (with option to include perpendiculars).RMVector3D
negate()
Makes this receiver point in the opposite direction.RMVector3D
normalize()
Makes the vector unit length.java.lang.String
toString()
Returns a string representation of the vector.RMVector3D
transform(RMTransform3D aTransform)
Transforms the vector by the given transform3d.
-
-
-
Constructor Detail
-
RMVector3D
public RMVector3D(float x, float y, float z)
Creates a new vector from the given coords.
-
RMVector3D
public RMVector3D(RMVector3D aVector)
Creates a new vector from the given vector.
-
-
Method Detail
-
getMagnitude
public float getMagnitude()
Returns the magnitude of the vector.
-
normalize
public RMVector3D normalize()
Makes the vector unit length.
-
add
public RMVector3D add(RMVector3D aVector)
Add the given vector to this.
-
getCrossProduct
public RMVector3D getCrossProduct(RMVector3D v2)
Returns the vector perpendicular to the receiver and the given vector.
-
getDotProduct
public float getDotProduct(RMVector3D v2)
Returns the dot product of the receiver and the given vector.
-
isAligned
public boolean isAligned(RMVector3D aVector, boolean includePerpendiculars)
Returns whether given vector is in same general direction of this (with option to include perpendiculars).
-
isAway
public boolean isAway(RMVector3D aVector, boolean includePerpendiculars)
Returns whether given vector is pointing away from the direction of this (with option to include perpendiculars).
-
getAngleBetween
public float getAngleBetween(RMVector3D v2)
Returns the angle between the receiver and the given vector.
-
negate
public RMVector3D negate()
Makes this receiver point in the opposite direction.
-
transform
public RMVector3D transform(RMTransform3D aTransform)
Transforms the vector by the given transform3d.
-
toString
public java.lang.String toString()
Returns a string representation of the vector.- Overrides:
toString
in classjava.lang.Object
-
-