Vector3.sub()
Instance method on Vector3.
Description
- Subtracts the specified Vector3 from this Vector3 and returns a new Vector3. |
- Subtracts the specified X, Y and Z values from this Vector3 and returns a new Vector3. |
- Subtracts the specified value from this Vector3 and returns a new Vector3. |
- Returns the subtraction of this Vector3 and the specified object. |
Method Signature
sub(Vector3)
sub(float, float, float)
sub(float)
sub(Object)
Mathematical Definition
\mathbf{r}=\mathbf{a}-\mathbf{b}
Parameters
Vector3: 3D vector input.float: scalar numeric input.Object: polymorphic operand; runtime resolves supported numeric/vector types.
Returns
Vector3: returned by overloads of this method.T: returned by overloads of this method.
Mutability
- Does not modify the current vector unless explicitly using a
Local/Equalvariant.
Edge Cases
- Zero vectors can produce degenerate outputs for geometric methods.
NaNandInfinityinputs propagate according to IEEE-754 floating-point behavior.- Repeated operations may accumulate floating-point precision error.
Usage Example
Vector3 a = new Vector3(10f, 2f, -5f);
Vector3 b = new Vector3(1f, 0.5f, 3f);
Vector3 result = a.sub(b);
Mathematical Example
Example input/output depends on overload; for vector arithmetic operations this is typically computed per-component.