绘制给定两个端点的半圆形路径(3D) [英] plotting a semi circular path given two end points (3D)

查看:30
本文介绍了绘制给定两个端点的半圆形路径(3D)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设一个球形物体,如地球.假设我有两个 3D 端点,我当前所在的位置和我想去的位置.我想在大气中构建一条路径 - 某种半圆形路径从一个点插入到另一个点.地球上的一条路径,就像 http://workshop.chromeexperiments.com/projects/armsglobe/

Assume a Spherical object like earth. Say I have two end points 3D, where I am currently and where I wanted to go. I want to construct a path in the atmosphere - some kind of a semi-circular path to interpolate from one point to another. a path on the earth like the one in http://workshop.chromeexperiments.com/projects/armsglobe/

根据当前位置计算下一个位置.之前有人为它做过数学计算吗?

The next position is computed based on current position. Has someone done the math for it before?

推荐答案

  1. 球状物体

你是说以 Z 为旋转轴,平面 XY 为赤道的椭圆体?如果是,请使用球坐标系,如 P(a,b,h) a=<0,2PI>, b=<-PI,+PI>, h=<0,+inf> ...高于表面的高度:

you mean ellipsoid with Z as rotation axis and plane XY as equator? If yes use spherical coordinate system like P(a,b,h) a=<0,2PI>, b=<-PI,+PI>, h=<0,+inf> ... height above surface:

r=(Re+h)*cos(b);
x=r*cos(a);
y=r*sin(a);
z=(Rp+h)*sin(b);

地点:

  • Rp 是椭球的极半径(Z 轴上的中心和极点之间)
  • Re 是椭球的赤道半径(XY 平面上的圆)
  • PI3.1415...
  • Rp is polar radius of ellipsoid (between center and pole on Z axis)
  • Re is equatorial radius of ellipsoid (circle on XY plane)
  • PI is 3.1415...

两点之间的曲线路径

现在你有 P0,P1 3D 点.将它们转换为球坐标,这样你就有了:

now you have P0,P1 3D points. Convert them into spherical coordinates so you have:

P0(a0,b0,h0)
P1(a1,b1,h1)

我假设 h=0.现在只需通过一些参数将 P(a,b,h) P0 插入到 P1t=<0,1>

I assume h=0. Now just interpolate P(a,b,h) P0 to P1 by some parameter t=<0,1>

a=a0+(a1-a0)*t
b=b0+(b1-b0)*t
h=h0+(h1-h0)*t

这将在表面上创建路径.为了使它在上面,只需像这样向 h 添加一些曲线:

this will create path on the surface. To make it above just add some curve to h like this:

h=h0+(h1-h0)*t+H*cos(PI*t)

其中 H 是表面上方的最大高度.您可以添加任何曲线类型...现在只需执行 for 循环,其中 t01一些步骤(0.01)并计算P.将其转换回笛卡尔坐标并绘制线段.或者只是画你的移动物体......

Where H is max height above surface. You can add any curve type ... Now just do for loop where t goes from 0 to 1 by some step (0.01) and compute P. Convert it back to Cartesian coordinates and draw the line segment. Or just draw your moving object ...

这篇关于绘制给定两个端点的半圆形路径(3D)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆