Plotting A Semi Circular Path Given Two End Points (3d)
Solution 1:
sphere-like object
you mean ellipsoid with
Zas rotation axis and planeXYas equator? If yes use spherical coordinate system likeP(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);Where:
Rpis polar radius of ellipsoid (between center and pole on Z axis)Reis equatorial radius of ellipsoid (circle on XY plane)PIis3.1415...
curve path between 2 points
now you have
P0,P13D points. Convert them into spherical coordinates so you have:P0(a0,b0,h0) P1(a1,b1,h1)I assume
h=0. Now just interpolateP(a,b,h)P0 toP1by some parametert=<0,1>a=a0+(a1-a0)*t b=b0+(b1-b0)*t h=h0+(h1-h0)*tthis will create path on the surface. To make it above just add some curve to
hlike this:h=h0+(h1-h0)*t+H*cos(PI*t)Where
His max height above surface. You can add any curve type ... Now just doforloop wheretgoes from0to1by some step (0.01) and computeP. Convert it back to Cartesian coordinates and draw the line segment. Or just draw your moving object ...
Solution 2:
If you want the same exact thing as the link, you need to find or derive (I'm not inclined to do the calculus that'll probably be required to derive the formula it right now) a 3D trajectory formula that takes into account the curvature of the Earth. You'd probably be better of trying mathematics stack and have them derive the formula. Although, they might redirect you to a more physics oriented stack exchange, which might know the formula.
However, you could also simply cheat by creating an arc, but it probably won't look as good unless you are fairly careful in picking where the middle point of the arc will be.
Post a Comment for "Plotting A Semi Circular Path Given Two End Points (3d)"