Jump to content

What is Vector3d.Exclude()?


Recommended Posts

Edit:

OK, this should be the answer: https://github.com/sldsmkd/vector3d/blob/master/Vector3d.cs#L325

Please correct me if I'm wrong.

------------------------------------------------------------------------------

 

I understand vector calculations such as "Cross" and "Dot", but what does "Vector3d.Exclude()" means?

public static Vector3d Exclude(Vector3d excludeThis, Vector3d fromThat);

I'm trying to understand following code from KRPC :

        /// Returns the up vector for the reference frame in world coordinates.
        /// The direction in which the y-axis points.
        /// The vector is not normalized.
        Vector3d UpNotNormalized {
            get {
                switch (type) {
                .......
                case ReferenceFrameType.VesselSurface:
                    {
                        var right = vessel.CoM - vessel.mainBody.position;
                        return Vector3d.Exclude (right, ToNorthPole (vessel).normalized);
                    }
		......
                }
            }
        }

        /// Vector from given vessel to north pole of body being orbited, in world space.
        static Vector3d ToNorthPole (global::Vessel vessel)
        {
            var parent = vessel.mainBody;
            return parent.position + ((Vector3d)parent.transform.up) * parent.Radius - (vessel.CoM);
        }

It returns a vector in UP direction in "VesselSurface" reference frame, and I don't understand what "Exclude" means in math.

Help please! Thanks!

Edited by Xavier513
Link to comment
Share on other sites

On 7/21/2019 at 3:39 AM, Xavier513 said:

Is it the same with the one in KSP?

Likely yes.

I had to use this exact function for something recently, but can't for the life of me remember what it was for (or even what project it was in).  Projection of something onto something...  IIRC I was doing orbital mechanics work at the time, so I was likely trying to find something relative to the ecliptic.

https://answers.unity.com/questions/25110/what-is-vector3exclude-for.html

https://docs.unity3d.com/ScriptReference/Vector3.ProjectOnPlane.html

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...