Wiki

Clone wiki

GCode Editor / gen / VecUtil

Documentation

public static float[] subVecs(float[] a, float[] b)

Subtracts a vector from another vector

  • Parameters:
  • a — a vector of any length
  • b — vector of the same or longer length which will be subtracted from a
  • Returns: a vector the length of a representing a-b

public static float[] addVecs(float[] a, float[] b)

Adds two vectors

  • Parameters:
  • a — a vector of any length
  • b — a vector of greater or equal length
  • Returns: vector the length of a representing a+b

public static float[] multVec(float[] a, float scalar)

Multiplies a vector by a scalar

  • Parameters:
  • a — vector of any length
  • scalar — any non-NaN float
  • Returns: the vector times the scalar

public static float mag(float[] vec, int i)

Calculates the magnitude of a vector

  • Parameters:
  • vec — a vector of any length
  • i — the length of the vector to consider (must be <= vec.length())
  • Returns: the magnitude

public float mag(float[] vec)

Convenience method for mag(vec, vec.length)

  • Parameters: vec — A vector of any length
  • Returns: the magnitude
  • See also: VecUtil#mag(float[], int)

Updated