Package net.apartium.cocoabeans.space
Class Rotation
java.lang.Object
net.apartium.cocoabeans.space.Rotation
Rotation is 3D space
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd another rotation to this rotationdoubleCalculate the dot product of this rotation with anotherbooleanfloatgetPitch()Returns the pitchfloatgetYaw()Returns the yawinthashCode()doubleCalculate the magnitude (length) of this rotation vectormultiply(double scalar) Multiply this rotation by a scalarNormalize the rotation angles to be within standard ranges Yaw: [0, 360), Pitch: [-90, 90]setPitch(float pitch) Sets the pitchsetYaw(float yaw) Sets the yawSubtract another rotation from this rotationtoString()
-
Constructor Details
-
Rotation
public Rotation(float yaw, float pitch) Create a new rotation- Parameters:
yaw- yawpitch- pitch
-
Rotation
Create a new rotation- Parameters:
other- create copy of other
-
-
Method Details
-
getYaw
public float getYaw()Returns the yaw- Returns:
- yaw
-
setYaw
Sets the yaw- Parameters:
yaw- new yaw- Returns:
- this
-
getPitch
public float getPitch()Returns the pitch- Returns:
- pitch
-
setPitch
Sets the pitch- Parameters:
pitch- new pitch- Returns:
- this
-
add
Add another rotation to this rotation- Parameters:
other- rotation to add- Returns:
- this
-
subtract
Subtract another rotation from this rotation- Parameters:
other- rotation to subtract- Returns:
- this
-
multiply
Multiply this rotation by a scalar- Parameters:
scalar- value to multiply by- Returns:
- this
-
normalize
Normalize the rotation angles to be within standard ranges Yaw: [0, 360), Pitch: [-90, 90]- Returns:
- this
-
dot
Calculate the dot product of this rotation with another- Parameters:
other- rotation to calculate dot product with- Returns:
- dot product
-
magnitude
public double magnitude()Calculate the magnitude (length) of this rotation vector- Returns:
- magnitude
-
toString
-
equals
-
hashCode
public int hashCode()
-