2点を通る直線の角度

#include <math.h>

/**
* 2点を通る直線の角度を求める
*
* @return 座標1と座標2を通る直線とX軸に水平な直線の間の角度
*
* @param point1 座標1
* @param point2 座標2
*
* http://frog.raindrop.jp/knowledge/archives/001608.html
*/
static double getRadian( const POINT& point1, const POINT& point2 )
{
double dx = point2.x - point1.x;
double dy = point2.y - point1.y;

return atan2( dy, dx );
}
最終更新:2009年04月03日 14:22
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。