Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Finding the point of reflection for a ray on a plane Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
cipherx

March 01, 2005, 06:48 AM

Hi,

Can anyone help me solve this problem I have been fumbling to solve for pretty much the entire day.

Given:
1) A plane
2) The point source of a ray
3) A target point on the same side of the plane

To find:
The point the ray must hit on the plane in order to hit the target point after being reflected.

Please could someone tell me the method or refer me to a website that explains the method used to find this point accurately without using iterative methods. Both 2d / 3d explanations will do.

Any help will be appreciated.

Thank you,

- Sid

 
Crowley9

March 01, 2005, 09:17 PM

Consider the source point and target point to be p1 and p2 respectively. Let m be the point midway between p1 and p2. Let S be the unique plane that goes through m, and has normal Norm(p1-p2). Take your original plane, which we will call P and intersect it with S. This will give a line L. The reflection point is the closest point on L from p1 and p2 (should be the same point for both of these), or rather it is the orthogonal projection of p1 or p2 onto L.

Of course, this assumes that by "reflection" you are assuming that the plane is a perfect isotropic reflector. If this is not the case, the problem becomes a lot more difficult (for anisotropic surfaces) or even undefined for the case of an imperfect reflecting surface.

 
Tim Auld

March 01, 2005, 09:57 PM

Reflect the target point in the plane. Intersect the line formed from the source and the reflected target with the plane. Bingo.

 
cipherx

March 01, 2005, 10:59 PM

Thanks Crowley9,

Your solution looks interesting. I should look into it.

No, the plane is a perfect reflector, so there is the solution you have given should work. I came up with another solution myself yesterday and it seems to work on paper. Let me give you guys a step by step break down.

1. Calculate the distance of the 2 points from the plane
Take the smaller distance as fA and the larger to be fB
2. Calculate fAB = (fB/fA) + 1.0f
3. Get the 2 points that lie on the plane and are closest to the 2 points. Take these 2 points as C & D
4. fDist = DistanceBetween(C, D)
5. vNormal = Normalize(C-D)
6. fDist /= fAB
7. Result point =
D - (vNormal * fDist)
or
C - (vNormal * fDist) (Still figuring out a proper way to use each of these, but the thing is the solution works - on paper atlest)

If anyone finds any problems with this algo, let me know.

- Sid

 
Reedbeta

March 01, 2005, 11:23 PM

This assumes the source and target points are the same distance from the plane, which may not be the case.

 
Reedbeta

March 01, 2005, 11:26 PM

Something like this may work, but it sounds like Tim's solution is a lot simpler, and also more intuitive.

 
cipherx

March 02, 2005, 12:28 AM

No this will almost never be the case, and which is why I am having this problem in the first place. In that case it looks like my solution is the only one that works so far.

- Sid

 
cipherx

March 02, 2005, 12:29 AM

No I don't think this will work either specifically because I don't know the point of reflection on the plane

 
cipherx

March 02, 2005, 12:32 AM

Hmm... I don't think it's too complex. It only looks so because I have broken it down into steps and haven't really explained why I am doing each step. But hey, I'm always open to suggestions. :-)

- Sid

 
Tim Auld

March 02, 2005, 01:54 AM

Sure you do, you can calculate it. If you already have a general line/plane intersection function, you can use the plane normal to form a line, intersect that with the plane, and then double the vector to that from the original point to find the reflection point. You can do this analytically, but I leave that as an exercise to the reader :)

 
realytic

March 02, 2005, 02:24 AM

Well I also thought of Tim Auld's approach.

Ok, you have the Plane p and its normal n. You also have the points p1 and p2. Let's say p1 is the source of the ray and p2 is the target point.

  1.  
  2.                    p2
  3.         p1        x
  4.        x          
  5.      _________________
  6.     /         _      /
  7.    /         ^n     /
  8.   /          |     /
  9.  /           x    /
  10. /________________/
  11.                   p
  12.  

1) Generate a line (well not exactly a line but a Gerade, but I don't know the English term right now) l: x = p1 + τ*n and find the intersection bewtween the plane p and this line. Let's call that point i.
  1.  
  2.        |l
  3.        |
  4.        ^n           p2
  5.        |           x
  6.        xp1          
  7.      __|______________
  8.     /  |      _      /
  9.    /   |     ^n     /
  10.   /    xi    |     /
  11.  /           x    /
  12. /________________/
  13.        |          p
  14.        |
  15.  

2) Ok, now reflect p1 at i by adding the vector p1-->i to i and voila you have p1'.
  1.  
  2.        
  3.          
  4.                     p2
  5.         p1         x
  6.        x          
  7.      __|______________
  8.     /  |             /
  9.    /   v            /
  10.   /    xi          /
  11.  /                /
  12. /________________/
  13.        |          p
  14.        v
  15.        xp1'
  16.  

3) Now generate a new line m defined as m: x = p1 + φ*(p2 - p1) and find the intersection point between that line and the plane p called s. S should be the point you have to reflect p1 at to get p2.
  1.  
  2.        
  3.          
  4.                   p2
  5.                  x
  6.        xp1      /    
  7.      __________/______
  8.     /         /      /
  9.    /         /      /
  10.   /         xs     /
  11.  /                /
  12. /________________/
  13.          /        p
  14.         /
  15.        xp1'
  16.  
  17.        
  18.        
  19.                  p2
  20.                 x
  21.        xp1  n  /    
  22.     ___ __^__/_____
  23.    /     α|α/      /
  24.   /       |/      /
  25.  /         xs     /
  26. /                /
  27. /________________/
  28.                  p
  29.  


I'm open for corrections ...

 
Rui Martins

March 02, 2005, 05:29 AM

That is all very nice, but you still didn't find the solution, since you need the angle (Alfa), which is the main question in your problem.

What I would do, is project the line (P1,P2) into the plane (using it's normal), that will give you a line on the plane starting at I (the point you didn't use before), and another point E. You can find these points easilly, since they are the neares points on the surface, to each of the P1 and P2 points.

Now you can reduce your problem explanation into 2D

  1.          P2
  2.         x
  3.  P1    /
  4.  x    /
  5.     /
  6. ___/______ Plane P
  7.    S
  8. NOTE: SideWays View (parallel with the plane)


Looking down on the plane you see something like.
  1. +-----------------+
  2. |          E(P2)  |
  3. |         x       |
  4. |        /        |
  5. |       /         |
  6. |      /          |    
  7. |     /           |
  8. |    x S          |    
  9. |   /             |
  10. |  /              |
  11. | x I(P1) Plane P |
  12. +-----------------+
  13.  
  14. NOTE: Top View (prependicular to the plane)


Since we know the reflection angles are equal, (your alfas), now it should be simple to find the point, using a 2 equations system (if 3D, then 4 equations). Use Pitagoras theorem, applied to the 2 triangles, formed below the reflected ray and the plane normal, or use the upper Triangle, formed by line (P1,P2) and the reflected Ray.

Hope you get the ideia.

 
realytic

March 02, 2005, 07:02 AM

hmm your question was:

To find: The point the ray must hit on the plane in order to hit the target point after being reflected.


I don't get the problem ?
My solution shortened :
You take the first point p1 and project it down to the plane by using the planes normal to get point i. Then you can get point p1' which is p1 mirrored by the plane by adding the vector p1->i to i. When you intersect p1'->p2 with the plane you will get your point s.

The angles I draw were just illustration, you definately don't need them for the calculation of s so you can safely ignore my alfas. If you should otherwise need alfa for another problem, well it's trivial to get its value => dot(vector from i to p1, plane normal) ...

Now is s the point you are looking for or if not -> why ???

 
Rui Martins

March 02, 2005, 08:15 AM

Now this one HIT me, very simple solution Tim!

 
This thread contains 14 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.