Class VectorMath
java.lang.Object
tk.airshipcraft.commonlib.utils.math.VectorMath
Utility class for vector mathematical operations.
 Provides methods for vector rotation, randomization, scaling, and more.
- Since:
- 2023-10-11
- Version:
- 1.1.0
- Author:
- eerieXanthic, notzune
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic org.bukkit.util.VectorinstabilizeVector(org.bukkit.util.Vector v, double instability) Adds a random amount to each component of a vector within a specified range.static org.bukkit.util.VectornormalizeVector(org.bukkit.util.Vector v) Normalizes a vector to have a length of 1 while maintaining its direction.static org.bukkit.util.VectorrotateVectorCC(org.bukkit.util.Vector vec, org.bukkit.util.Vector axis, double theta) Rotates a vector counterclockwise around a specified axis by a specified angle.static org.bukkit.util.VectorscaleVector(org.bukkit.util.Vector v, double factor) Scales a vector by a specified factor.
- 
Constructor Details- 
VectorMathpublic VectorMath()
 
- 
- 
Method Details- 
rotateVectorCCpublic static org.bukkit.util.Vector rotateVectorCC(org.bukkit.util.Vector vec, org.bukkit.util.Vector axis, double theta) Rotates a vector counterclockwise around a specified axis by a specified angle.- Parameters:
- vec- The vector to rotate. Must not be null.
- axis- The axis of rotation. Must not be null.
- theta- The angle of rotation in radians.
- Returns:
- The rotated vector.
- Throws:
- IllegalArgumentException- if vec or axis is null.
 
- 
instabilizeVectorpublic static org.bukkit.util.Vector instabilizeVector(org.bukkit.util.Vector v, double instability) Adds a random amount to each component of a vector within a specified range.- Parameters:
- v- The vector to randomize. Must not be null.
- instability- The maximum amount of randomization.
- Returns:
- The randomized vector.
- Throws:
- IllegalArgumentException- if v is null.
 
- 
scaleVectorpublic static org.bukkit.util.Vector scaleVector(org.bukkit.util.Vector v, double factor) Scales a vector by a specified factor.- Parameters:
- v- The vector to scale.
- factor- The scaling factor.
- Returns:
- The scaled vector.
 
- 
normalizeVectorpublic static org.bukkit.util.Vector normalizeVector(org.bukkit.util.Vector v) Normalizes a vector to have a length of 1 while maintaining its direction.- Parameters:
- v- The vector to normalize.
- Returns:
- The normalized vector.
 
 
-