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


|