Advertisement

Quick question about Moller/Trumbore Ray-Triangle Intersection algo.

Started by December 26, 2003 05:44 PM
2 comments, last by eSCHEn 21 years, 2 months ago
This is bending my mind, any help would be great; I''ll try to reason my thinking a bit first. When they describe a ray, do they mean: a) An infinitely long line - surely this is just a direction and therefore a vector? b) A start point and end point - don''t think this is a ray, it''s a line (or are they the same thing?) c) A start point and a direction - this is what I think they mean by a ray. Oh, and for the C programmers: the ''%'' operator returns the modulus (integer remainder) of a division right? e.g. 5 % 2 would return 5 (the 0.5 from 2.5). I know this is a bit simple really, but I keep asking my brain for help and it keeps laughing at me. -- Cheers,
--
Cheers,
Darren Clark
Ray is always a point and a direction. Any other description would be inaccurate. Also, x % y returns the integer remainder of x / y. Oh and in case you were wondering, the first description is that of a line and the second is that of a line segment. Good luck in whatever you're trying to do because I don't have a friggin clue can you post a link to what ur talking about though?

[edited by - uber_n00b on December 26, 2003 7:11:18 PM]

My fellow Americans I have just signed legislation that outlaws Russia forever. Bombing will commence in five minutes.
Advertisement
Just used that code two days ago. Its really
a triangle line test but you can look at t to determine
if the ray intersected (t > 0.0 ).

0%2 = 0
1%2 = 1
2%2 = 0
3%2 = 1
etc...

Hope this helps...

Well it started a few weeks ago when I was having a smoke and writing some of the script for a game I''m making; I suddenly had the thought: "If I calculate the energy transmitted from a point light to a vertex then I could implement some spanky lighting with it!"

Having written a detailed explaination to myself on a bit of paper (so as not to forget my idea) I went to bed thinking I was a programming god and that I was as ''l33t'' as hell, and how much people were going to be impressed by my special new algorithm.

It wasn''t until the morning, when I took a look at the bit of paper, that I realised I had invented the fantatical idea of vertex lighting, and was about as clever as a spoon; I could have cried - I genuinely thought I had invented something new *sigh*.

The reason for the ''%'' confusion is that I code in Delphi and was trying out the example of ray to polygon collision by DigiBen as I couldn''t get the Moller solution to work - turned out to be a typo in my code.

I was wanting to clarify their definition of a ray as the code works well, but only in two axes (it won''t detect a collision at the start and end of the ray that I gave it, and if it''s actually a line to triangle test then this would make sense).

Anyway, thanks to you both for your help.

--
Cheers,
--
Cheers,
Darren Clark

This topic is closed to new replies.

Advertisement