Pular para o conteúdo principal

Vetor3.dot()

Método de instância em Vector3.

Descrição

  • Retorna the dot product of this Vector3 and the specified Vector3. |
  • Retorna the dot product of this Vector3 and the specified X, Y and Z values. |
  • Retorna the dot product of this Vector3 and the specified value, used for all components. |

Method Signature

dot(Vector3)
dot(float, float, float)
dot(float)

Mathematical Definition

\mathbf{a}\cdot\mathbf{b}=a_xb_x+a_yb_y+a_zb_z

Parameters

  • Vector3: 3D vector input.
  • float: scalar numeric input.

Retorna

  • float: returned by overloads of this method.

Mutability

  • Does not modify o atual vector unless explicitly using a Local/Equal variant.

Edge Cases

  • Zero vectors can produce degenerate outputs for geometric methods.
  • NaN and Infinity inputs propagate according to IEEE-754 floating-point behavior.
  • Repeated operations may accumulate floating-point precision error.

Usage Example

Vector3 forward = myTransform.forward().normalize();
Vector3 toTarget = target.getPosition().subtract(myTransform.getPosition()).normalize();
float alignment = forward.dot(toTarget);
if (alignment > 0.7f) {
print("Target is in front cone");
}

Mathematical Example

Example input/output depends on overload; for vector arithmetic operations this is typically computed per-component.

Visualization