In response to LexyBitch
LexyBitch wrote:
Out of curiousity, why in blazes are you interested in vector multiplication?

Call it a feasibility study for a very distant future project.

Picture a starship-based MUD. Ships and stations are represented as typical room arrangements, but with directions of up, down, port, starboard, fore, and aft. Each 'starship' object is also given a position and orientation in 3D space.

Now, I fire a particle beam through your ship... if we can figure out the point of impact on the "surface", which rooms will it end up passing through on its way to the other side? I'd need to compare the angle of the ship to the angle of the beam... am I wrong in thinking this would be a good place to use products?

Oi, I'm far out of practice with more complex vector mathmatics. My first instinct was to say no, but you could use a normal vector to define the plane of the starship. With the plane of the starship (probably several parallel planes, one for each deck) and the vector of the partical beam, it should be an easy matter to calculate where the vector intersects each plane in the ship.

I found a part in my old Calculus book that explains how to find where two planes intersect. (Amazingly enough, it uses a cross product ;) I can't find anything about vectors intersecting a plane though. I'd have to study up a bit to provide an answer. Perhaps Lummox JR has it handy or can figure it out quickly, since it is much fresher in his mind.
In response to Shadowdarke
Shadowdarke wrote:
I found a part in my old Calculus book that explains how to find where two planes intersect. (Amazingly enough, it uses a cross product ;) I can't find anything about vectors intersecting a plane though. I'd have to study up a bit to provide an answer. Perhaps Lummox JR has it handy or can figure it out quickly, since it is much fresher in his mind.

Basically the point P where a line AB intersects a plane (normal N, point Q on the plane) works like this:

(P-Q).N=0
P=A+x(B-A)
(A+x(B-A)-Q).N=0
x(B-A).N=(Q-A).N
x=(Q-A).N/(B-A).N
P=A+(B-A)[(Q-A).N/(B-A).N]

(Here's a catch to that: If you want to make sure only the line AB hits the plane, not that it will hit at some point further along, make sure that 0<=x<=1. Also, notice that (B-A).N may be 0; if it is, the line runs parallel to the plane and will never hit it.)

Lummox JR
In response to LexyBitch
Lexy, there are lots of resources on the net for raytracing. Check the links section of www.povray.org.

I would suggest using boxes or spheres, rather than planes for your intersection tests because the raytracing routine can assume that they are finite.

The thought of a text output raytracer... oh the irony.
Page: 1 2