如果方位角固定
输出
程序代码:
#include <iostream> #include <format> #include <cmath> #include <numbers> using namespace std; int main( void ) { const double a = 300; const double b = 300; const double c = 300; double mag = sqrt( a*a + b*b + c*c - a*b - b*c -c*a ); double angle = atan2( (b-c)*std::numbers::sqrt3, 2*a-b-c ) / std::numbers::pi * 180; cout << format("magnitude={}, angle={}", mag, angle) << endl; }
输出
magnitude=0, angle=0