我希望弄清楚你将如何转换以下六性类型的方向:N。00度。 23'44“E。290.40英尺,然后绘制一条基于轴承,方向和距离的线条。你基本上会有一系列这些以便绘制边界。希望这是有道理的。任何伪 - 代码,想法等将不胜感激。
答案 0 :(得分:0)
某些代码与伪代码混合:
//Using OpenGL
glLineWidth(1);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0); //starting point
// convert to degrees (i think this is right)
var angle = -23 - 44 = 63;
// maybe the '' is a decimal not NE so would be
angle = -23.44;
//then do some simple trig to find where point 2 lies
// (y2 - y1)/(x2 - x1) = m
// √[(x2 - x1)² + (y2 - y1)²] = 290.40; // (d for distance)
// to obtain:
// x2 = x1 ± d/√(m² + 1)
// y2 = y1 ± (md)/√(m² + 1) // m for slope
glLineTo(x2,y2, 0);
//or
glVertex3f(x2, y2, 0);
glEnd();
// use this if you need to move the line starting point...
glMoveTo()