normalize method

PVector normalize()

( begin auto-generated from PVector_normalize.xml )

Normalize the vector to length 1 (make it a unit vector).

( end auto-generated )

@webref pvector:method @usage web_application @brief Normalize the vector to a length of 1

Implementation

PVector normalize() {
  double m = mag();
  if (m != 0 && m != 1) {
    div(m);
  }
  return this;
}