• Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

# help 3D space problem

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1lomateron  Members   -  Reputation: 197

Like
0Likes
Like

Posted 16 March 2013 - 05:29 PM

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"

Edited by lomateron, 16 March 2013 - 05:34 PM.

### #2DonTzzy  Members   -  Reputation: 328

Like
0Likes
Like

Posted 16 March 2013 - 06:18 PM

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

bool trueOrFalse;

### #3lomateron  Members   -  Reputation: 197

Like
0Likes
Like

Posted 16 March 2013 - 06:22 PM

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

Edited by lomateron, 16 March 2013 - 06:46 PM.

### #4Ravnock  Members   -  Reputation: 260

Like
1Likes
Like

Posted 16 March 2013 - 07:17 PM

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"

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)

### #5Álvaro  Members   -  Reputation: 5796

Like
1Likes
Like

Posted 16 March 2013 - 08:17 PM

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.

### #6EWClay  Members   -  Reputation: 651

Like
1Likes
Like

Posted 17 March 2013 - 02:42 AM

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.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS