Orbiter-Forum [Request] Gateway transport system
 Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

 Addon Requests If you have a request for a new addon or want to know where to find a specific addon, ask it here!

 03-21-2017, 12:45 PM #76 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Thanks. So if we get this: Code: ```VECTOR3 rpos, rvel; oapiGetRelativePos(hvessel, GetHandle(), &rpos); double distance = length(rpos); oapiGetRelativeVel(hvessel, GetHandle(), &rvel);``` if dotp(&rvel, &rpos) < 0 so the vessel is travelling towards the center, right? No, it is "dotp(rvel, rpos)" and yes, coarsely towards the center. dotp(rvel, rpos) = 0 would mean tangential travel. in this case, "dotp(rvel, rpos)/distance" is the range rate. There are also other mathematical solutions possible, but dotp should become a name you should remember. It is really helpful mathematics. And for being annoying: "&rvel" means "a pointer/reference to the variable rvel", for doing a classic "call by reference" (An other name you should better look up in a calm moment and learn, its useful). You need when you have a variable and need a pointer to it. Last edited by Urwumpe; 03-21-2017 at 12:48 PM.
 03-21-2017, 12:59 PM #77 gattispilot Addon Developer Ok So if dotp(rvel, rpos) = 0 we are travelling toward the center? So is x, y a factor. Can we make a larger target
 03-21-2017, 01:21 PM #78 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Ok So if dotp(rvel, rpos) = 0 we are travelling toward the center? So is x, y a factor. Can we make a larger target No, tangential means your velocity vector is perpendicular to the position vector.
 Thanked by:
 03-21-2017, 01:37 PM #79 gattispilot Addon Developer So dotp(rvel, rpos) = 0 means travelling toward the center, right? But we have to be perpendicular to the gate, right? So the x and Y difference would be 0
 03-21-2017, 01:50 PM #80 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  So dotp(rvel, rpos) = 0 means travelling toward the center, right? But we have to be perpendicular to the gate, right? So the x and Y difference would be 0 Again. No. By repeating it, it does not get better. dotp(A, B) = 0 means, A is 90° to B, which means perpendicular. And why should you travel perpendicular to the gate? Its like crossing a like by walking parallel to it. It makes no sense. Read here for the mathematical background: https://en.wikipedia.org/wiki/Dot_product What we are exploiting here can be visualized as such: But instead of normalizing the position vector for accurate results, we just want the sign to show the coarse trend. Does the velocity point towards or away from the gate?
 03-21-2017, 02:04 PM #81 gattispilot Addon Developer oK. if we use the gate example. I would walk perpendicular to the opening. parallel would along the side of it. Last edited by gattispilot; 03-21-2017 at 02:12 PM.
 03-21-2017, 02:12 PM #82 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  oK. if we use the gate example. I would walk perpendicular to the opening. parallel would along the side of it. No. If you would describe the gate as plane, yes, a perpendicular would bring you to it. But now... how do you describe planes in code? The common mathematical way is using a normal vector, which already rests per definition perpendicular to this plane. for example, in your previous example, you say "The normal vector of my plane is the Z axis in relative coordinates." You might not have notice that you said so, but that is what you describe in the code in a geometrical form. (You might remember normal and anti-normal in Orbiter and KSP regarding the orbit plane) So, if you move perpendicular to the normal vector, you are moving parallel to the plane. If you move parallel to the normal vector, you are moving perpendicular to the plane. (Yes, if you have a proper normalized normal vector for the plane, the dot product dotp(normal, velocity) gives you the velocity away or towards the plane.) Last edited by Urwumpe; 03-21-2017 at 02:23 PM.
 Thanked by:
 03-21-2017, 02:35 PM #83 gattispilot Addon Developer So: the dot product dotp(normal, velocity) gives you the velocity away or towards the plane.) Code: `dotp(rpos, rvel)` gives velocity away or towards.
 03-21-2017, 02:41 PM #84 Urwumpe Certain Super User Quote: Originally Posted by gattispilot   So: the dot product dotp(normal, velocity) gives you the velocity away or towards the plane.) Code: `dotp(rpos, rvel)` gives velocity away or towards. Not that simple: Again: rpos should be normalized to length 1 for this to be correct, or you would have to divide the result by the length of rpos. The formula works for a few cases. For example, you could treat rpos as radius vector, then it is the velocity away or towards a sphere.
 Thanked by:
 03-21-2017, 02:48 PM #85 gattispilot Addon Developer I hope some one update the code. I guess it would be too easy to get the vessel position and the gateway. compare the x, y, z and if within a value execute the move?
 03-21-2017, 02:54 PM #86 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  I hope some one update the code. I guess it would be too easy to get the vessel position and the gateway. compare the x, y, z and if within a value execute the move? Why? It is easy. The problem is: You need to prevent that after jumping from Gate A to Gate B, Gate B jumps you back to Gate A, etc. For that you should have a definition that makes sure, movement away from the gate is ignored. That is all.
 Thanked by:
 03-21-2017, 03:09 PM #87 gattispilot Addon Developer Quote: Originally Posted by Urwumpe  Why? It is easy. The problem is: You need to prevent that after jumping from Gate A to Gate B, Gate B jumps you back to Gate A, etc. For that you should have a definition that makes sure, movement away from the gate is ignored. That is all. Easy for you not me But wouldn't you just look at the z difference to see if you were heading towards or away.
 03-21-2017, 03:15 PM #88 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Easy for you not me But wouldn't you just look at the z difference to see if you were heading towards or away. Which "z difference"?
 03-21-2017, 03:28 PM #89 gattispilot Addon Developer Z position of vessel and z position gateway. I guess you could store a reading and if the next reading was less then the vessel is moving closer
 03-21-2017, 03:38 PM #90 Urwumpe Certain Super User Quote: Originally Posted by gattispilot  Z position of vessel and z position gateway. I guess you could store a reading and if the next reading was less then the vessel is moving closer Why?

 Posting Rules BB code is On Smilies are On [IMG] code is On HTML code is Off You may not post new threads You may not post replies You may not post attachments You may not edit your posts
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Orbiter-Forum.com     Announcements     Meets & Greets Orbiter Space Flight Simulator     Orbiter Web Forum         OFMM         Orbiter Forum Space Station         Simpit Forum     General Questions & Help     MFD Questions & Help     Hardware & Software Help     Tutorials & Challenges     Orbiter SDK     Orbiter Visualization Project     Orbiter Beta » Orbiter Project Orbiter Addons     OrbitHangar Addons & Comments     Addons     Addon Development     Addon Requests     Addon Support & Bugs         Addon Developer Forums             Project Apollo - NASSP     Orbiter Lua Scripting Far Side of the Moon     Spaceflight News     Math & Physics     Astronomy & the Night Sky     Backyard Rocketry     Brighton Lounge     International Forum

All times are GMT. The time now is 09:57 PM.