# Rotating/altering vector by a plane

This topic is 367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites

Have you gotten Newtonian gravity working?

##### 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 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 on other sites
14 hours ago, sjhalayka said:

Have you gotten Newtonian gravity working?

Yeah check out all my stuff http://sites.google.com/site/3brane4bulk

I'm doing this stuff on paper so I'll figure it out

##### 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

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×