MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / limit_length_xy

Method limit_length_xy

libraries/AP_Math/vector3.cpp:331–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329// limit xy component vector to a given length. returns true if vector was limited
330template <typename T>
331bool Vector3<T>::limit_length_xy(T max_length)
332{
333 const T length_xy = norm(x, y);
334 if ((length_xy > max_length) && is_positive(length_xy)) {
335 x *= (max_length / length_xy);
336 y *= (max_length / length_xy);
337 return true;
338 }
339 return false;
340}
341
342template <typename T>
343Vector3<T> &Vector3<T>::operator *=(const T num)

Callers 1

TESTFunction · 0.80

Calls 2

normFunction · 0.85
is_positiveFunction · 0.85

Tested by 1

TESTFunction · 0.64