Ray trace design


Picture of my whiteboard :*)


I said that many times myself Seriously what is that? God help us if you used your powers for evil


ROFL @judas

Seriously though ;), I had a question on gitter wrt the bottom-right graph:

O, D and I are in the blue plane (the rayPlane) which is parallel to the green line (axis). The blue dotted line is parallel to the green axis and ‘I’ is on it (‘I’ stands for intersomething).
I know the distance between axis and rayPlane (N is a unit vector in that direction: it’s both perpendicular to axis as well as rayPlane). ‘A’ is a unit vector along axis, O is a point in the rayPlane whose relative position to S is known. D is a unit vector pointing from O to ‘I’.

What I need is to express a vector from S to ‘I’.

I tried asking Wolfram Alpha, which resulting in me giving it 1 star in a review from hell;
then I Googled, which resulted in on-topic questions from other people, but with no useful
answer… guess I’ll give it some deeper thought myself. It’s so symmetrical that it can’t be that hard :confused:


I think I figured it out, with the help of a 3D model that I made in SL! See below :smile:

In case the names aren’t visible: S is the black dot in the middle. It’s the ‘Start’ of the capsule.
The purple dot on the upper-left is ‘O’, the ‘origin’ of the ray. The thick blue line from there
travels in the direction of the unit vector D (not shown here) and hits the cylinder in C (the brown dot)
and then I, the purple dot, which is the point where the ray is at the shortest distance from
the axis of the cylinder: the front green line.

<formulas deleted - coming to you soon in a source file near you>


I had one of those, but the wheels fell off.


I love that model. Pity that 2D doesn’t do it justice.