Jump to content

Having Line (Curve) around Globe without clipping


distraub
 Share

Recommended Posts

I am hoping you guys can help me out.

What I am trying to accomplish is to hit a point on a planet with a curved line from space.

I would like it to wrap around the planet if the point is on the back, and not clip.

Here is a playground to give you an idea of what I am trying to do.

https://www.babylonjs-playground.com/#1NZLA9#5

Ideally I should be able to hit any point on the globe without clipping it, I am just not sure exactly what the math would look like to calculate those angles dynamically.

Link to comment
Share on other sites

Thank you, I really wasn't only looking to put the line in a different rendering group :).

I would love it to contour the planet, but am not sure the best way to go about that. I will have multiple points from space hitting multiple spots on the planet. and I wanted to make sure you could see them all individually. Initially I thought I could bring them all to a point and then have them wrap around the planet to hit their destination, but then you wouldn't be able to tell which object was connecting to the planet.

 

Link to comment
Share on other sites

Hi @distraub, welcome to the forum.

If all the starting points in space were at a different Y value, they would each encircle the planet around a different "non-equatorial" orbit.  So, the chances of orbits over-lapping each other... would be slim.  Some orbits might be elliptical, too.  Then create each in a different color, and you might have good success.  But, does distraub WANT to allow a few orbits before doing de-orbit burn (2-step process.)

Really, a 3-step process.  First, know what orbital insertion point is wanted and draw straight line to IT.  That line will smoothly intersect a circle or ellipse orbit trajectory.  THEN, finally, a curved line indicating the de-orbit burn (slowing craft, letting gravity pull it through atmosphere).  One straight line, one circle or ellipse, and one curved line from orbit to landing point.  Ow!

Orbital insertions.  Too cool, but not used by weapons/meteorites, etc.

The space shuttle used a few more curves.  While they were approaching the landing site, they were in air, so the air-plane-like control surfaces were used to do steep banking, left/right etc... to scrub-off unwanted speed.  Then, when near the landing site, they banked around a  "heading alignment circle" (HAC).  It was an invisible cylinder near the end of the runway, and no matter the approach angle, they would bank around until they were aligned with the runway, then break-away from the circle, and drop trow gear.  Computers do most of it, but in the video above, they were still "slightly low at the 180".  (180 degrees around the HAC)

I think... maybe... the need to enter an orbit FIRST, and then do a "de-orbit burn", slowing the craft to allow gravity to pull craft to the planet... is based-upon amount of fuel used to do braking thrust.  AND... are there living things on-board that wish to survive the landing?  Or is it a meteorite that cares nothing about soft landings or burning-up entering atmosphere?  :)

Thank goodness distraub is only concerned about drawing lines at this point.  The function that calculates the most fuel-efficient and SAFE flight trajectory and de-orbit maneuver... would be quite an undertaking to code.  It would need to consider spacecraft mass, planetary gravity, insertion speeds, etc.etc. erf.  :)  Still, fun!  Got some contacts at NASA or other space programs?  Would they loan us some pseudo-code/formulas?  heh.  COOOOL. 

Link to comment
Share on other sites

:) hi @Wingnut thanks for the reply!

What I am looking for isn't really a weapon, or a spacecraft, more of a broadcast point to a spot on the planet, visually showing the communication.

So ideally it would be an arc to the planet first, since it just looks cool, but then it would catch and orbit the planet and stop on a particular lat/long.
I was thinking of using a bounding sphere around the planet, catch the intersection point on the sphere from the first arc, then finish it by following the arc of the sphere with a new curve.

I am going to give that a try today, but am very new to Babylon, so am not quite sure of all the details and the math to make it happen.

Link to comment
Share on other sites

Here is an idea of what I am going for, this is a crude way to do this, and it almost works.

But I am sure there is a better way. If anyone can take a look and help, I would be very grateful.
https://www.babylonjs-playground.com/#2I0VXX#8

I am getting the arc based on using a mesh, rotating it with lookAt looking at the center of the earth, then using that angle to calculate control points for the arc.
I was using a quadraticBezier first but switched to a Cubic Bezier because I was clipping at different locations.

I am still clipping when at different places, have to figure out the right height for the control points

I am sure this can all be accomplished with a great circle formula but my trig just isn't up to par for the task.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...