Advertisement

help 3D space problem

Started by March 16, 2013 11:29 PM
4 comments, last by EWClay 11 years, 11 months ago

given 2 points "a" and "b" in 3D space

b= center of a sphere always radius 1

I want to find vector direction "d"

The "d"s of the answer form a cone around a part of the sphere, i just need one "d"

WmoSN5w.png

http://mathworld.wolfram.com/PythagoreanTheorem.html

Advertisement

i dont think thats enought, i will really learn from a complete answer, as there are many ways of solving this each method will lead to a new root to solve new problems

given 2 points "a" and "b" in 3D space

b= center of a sphere always radius 1

I want to find vector direction "d"

The "d"s of the answer form a cone around a part of the sphere, i just need one "d"

WmoSN5w.png

If c is the intersection point, you know that distance(b,c) =1, the angle between vector(b,c) and vector(a,c) is 90, and the distance(a,c) is known, so you can apply the pythagorean theorem.

distance(a,b)^2 = distance(b,c) ^2 + distance(c,a)

You can easyly get the distance(a,c)

Then it seems to be a Circle-circle intersection problem (Circle 1: center in a, radius is distance a,c and Circle 2: center is b distance 1)

You can either intersect two spheres (basically what has been suggested already), or you can find the polar plane of the point with respect to the sphere and intersect it with the sphere.

You can expand the equation of the sphere as
Axx * x^2 + Ayy * y^2 + Azz * z^2 + Bx * x + By * y + Bz * z + C = 0
The equation of the polar plane of point (Px, Py, Pz) is then
D * x + E * y + F * z + G = 0
where
D = Axx * Px + Bx
E = Ayy * Py + By
F = Azz * Pz + Bz
G = Bx * Px + By * Py + Bz * Pz + C
I am not 100% this formula is correct, but I am working by analogy with the formula for the polar line found in Wikipedia.
If theta is the angle between d and ab and n is the vector in the plane of d and ab and perpendicular to ab, then knowing the length of d from Pythagoras,

d = (ab cos(theta) / |ab| + n sin(theta)) * sqrt(ab.ab - 1)

And since sin(theta) = 1 / ab and cos(theta) = 1 / d

d = ab (1 - 1 / ab.ab) + n sqrt(1 - 1 / ab.ab)

n can be any normalised vector perpendicular to ab, so pick any vector, cross with ab and normalise.

This topic is closed to new replies.

Advertisement