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

Method angle

libraries/AP_Math/vector2.cpp:145–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144template <typename T>
145T Vector2<T>::angle(const Vector2<T> &v2) const
146{
147 const T len = this->length() * v2.length();
148 if (len <= 0) {
149 return 0.0f;
150 }
151 const T cosv = ((*this)*v2) / len;
152 if (cosv >= 1) {
153 return 0.0f;
154 }
155 if (cosv <= -1) {
156 return M_PI;
157 }
158 return acosF(cosv);
159}
160
161template <typename T>
162T Vector2<T>::angle(void) const

Callers 15

send_msg_GPSMethod · 0.45
send_gps_msgMethod · 0.45
adjust_speedMethod · 0.45
updateMethod · 0.45
verify_breakoutMethod · 0.45
update_waypointMethod · 0.45
send_m_ahrsMethod · 0.45
consistentMethod · 0.45

Calls 1

lengthMethod · 0.95

Tested by 1

TESTFunction · 0.36