Rotating/altering vector by a plane

Recommended Posts

How do you, say, given a vector in a gravitational field, reflect or alter the vector, by the vector of the gravity? Ie if the gravity vector gives a plane and you want to make the vector perpendicular to the gravity vector but as close as possible to the original? Doing this for https://github.com/dmdware/f69 as per http://gsjournal.net/Science-Journals/Essays-Relativity Theory/Download/6866 walk space generation.

Also how do you sometimes give it a little bit of an offset off the plane, eg by a 3 degree offset up above or -3 for below the plane along the original forward direction but off the perpendicular to gravity plane now.

The other thing I wanted was to make the vector follow an iso-contour line along its original path, which I can do. Also if anybody is familiar with eg ray tracing I need to also refract the vector by the gravity vector acting as the increasing-density refractive medium, with the refractive indices being the gravity magnitudes at those places, and I'm not sure if it should be a dot product that is along the vector corresponding with the gravity vector, or the whole gravity vector itself. Also I'm not sure if the best results will be obtained by keeping all the resulting vectors on the original forward path, only reflected or altered by the plane in question, but I think it is best for making a mesh surface.

Edited by polyfrag

Share this post


Link to post
Share on other sites
On 6.12.2017 at 11:41 PM, polyfrag said:

How do you, say, given a vector in a gravitational field, reflect or alter the vector, by the vector of the gravity? Ie if the gravity vector gives a plane and you want to make the vector perpendicular to the gravity vector but as close as possible to the original?

Searching the internet for "vector reflection" gives you a ton of hits. Just the first hit for me answers your question.

The closest vector on the plane (i.e. perpendicular to the plane's normal) can be found by using the cross product twice and rescaling the result, as is usual when a basis should be computed. So the first cross product is used to calculate a vector perpendicular to both the normal and the initially given vector:
    k := n x v
Then the second cross product used on the previous result and the normal gives a vector in the desired direction:
    m := k x n
The rescaled variant of the vector is what you're looking for:
    v' := m / ||m|| * ||v||
That works if and only if v and n are not collinear, of course.

On 6.12.2017 at 11:41 PM, polyfrag said:

Also how do you sometimes give it a little bit of an offset off the plane, eg by a 3 degree offset up above or -3 for below the plane along the original forward direction but off the perpendicular to gravity plane now.

This can be done simply by applying a rotation on the vector. The rotation's axis is given as cross product of the vector and the normal.

Share this post


Link to post
Share on other sites

Don't forget that, like refraction, where the material is densest, movement is slowed. There is extra time for acceleration toward the gravitating body to occur. For instance, Mercury's perihelion shifts over time due in part to this slowed movement.

Share this post


Link to post
Share on other sites

Well, you're at least halfway there... right? you've allowed for the curvature of space, and now you have to allow for the curvature of time. You should find that the deflection of light is twice the Newtonian angle. You can get the angle by getting the slope.

Edited by sjhalayka

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now