Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Raytracing rendering software > Re: Reflecting ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 18 of 22 Topic 555 of 588
Post > Topic >>

Re: Reflecting a ray off a line

by Dieter Hansen <dieter.hansen@[EMAIL PROTECTED] > Nov 26, 2007 at 11:41 PM

Richard schrieb:
> "Dieter Hansen" <dieter.hansen@[EMAIL PROTECTED]
> wrote in message 
> news:4749c664$1@[EMAIL PROTECTED]
>> Richard schrieb:
>>> ,,,
>>>
>>> There are two s's in the above.
>> Well I didn't really look thru all the math you did (sorry), since I 
>> already provided you with a solution (which should work, if I didn't
miss 
>> something in the hurry), so you could check it against your results.
>>
>>> Also, I presume that .x or .y just means only put an x or y coordinate

>>> into
>>> the equation where there is a .x or a .y., not an ordered pair. Rich.
>>
>> Yes .x means the x component of the vector and .y the y component.
>>
>> Dieter
> 
> Hi.
> 
> Well, I've got someone else checking the math, so that I can be sure
about 
> (6) - which is to get s. Certainly you have given everything  to be able
to 
> compute the intersection point (P(s). As long as we have Ro + t Rdir =
Po + 
> s (P1 - Po) we can begin to work things out.
> 
> The next step is to figure out the math to get Rdir in terms of x and y,
for 
> the next line segment (ray), the ray that is reflecting off the first
line. 
> I'll give it some thought.

Use the law of reflection. I think I already mentioned the equation. 
Hold on...
Here we go:

R = 2 · N ·(N dot -D)+D

So basically what you need to do is calculate N for the line segment and 
you're good to go. This is fairly simple in 3D and even more simple in 
2D. Let's see:

in 3D we would'n have a line segment but a plane which is build using 3 
points. To get its normal we use the cross product between two 
connecting vectors of those 3 points. Anyway we could do the same in 2D, 
which turns out to be just a simple swap of x and y of the normlize 
vector constructed using P0 and P1 of the line segment. We also need to 
negate one of the components while swaping and we are done. So the 
actual way of calculating N is:
     | -y |
N = | x  | where x and y are coming from the line segment's direction

normalize(P1-P0) = | x |
                    | y |

So that's all we need, just calculate the new Direction with the given 
equation. One hint, D (direction of the incoming ray) needs to be 
normalized too.

Regards
Dieter
> 
> You have already been very helpful, thanks a lot.
> 
> Richard 
> 
>
 




 22 Posts in Topic:
Reflecting a ray off a line
"Richard" <s  2007-11-17 13:16:51 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-17 16:18:38 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-17 15:40:04 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-19 16:29:23 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-19 22:31:36 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-20 19:21:59 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-20 20:46:02 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-20 19:48:28 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-20 21:11:32 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 12:21:46 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 12:43:58 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 16:41:28 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 16:54:57 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-22 20:46:53 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 20:40:26 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-25 20:00:55 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-26 17:35:46 
Re: Reflecting a ray off a line
Dieter Hansen <dieter.  2007-11-26 23:41:37 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 23:53:12 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-23 00:25:08 
Re: Reflecting a ray off a line
dontdont@[EMAIL PROTECTED  2007-11-18 10:46:23 
Re: Reflecting a ray off a line
"Richard" <s  2007-11-22 12:29:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 0:42:13 CST 2008.