Dear Group

I have finally found enough time to try to implement the Moller-Trumbore algorithm for ray-triangle intersection test into Radiance. I have a question though as to how to ascertain the real arguments for the position for each vertex for a triangle. I have gone through the function readfargs in readfargs.c and it appears to me that the arguments for type FUNARGS is stored in its member farg as an array. I have tried reading through some of the source code and it appears to me that the arguments can somehow be ascertained via a macro in face.h, which states:

#define VERTEX(f,n) ((f)->va + 3*(n))

I am unsure how this macro works. At first it seems that the values of each real argument is added to the quantity 3 multiplied times the number of vertices but that I do not think is what is happening. If so, then the arguments are being transformed into another coordinate (maybe local) system. I have not the slightest clue as to what is going on. I am wondering if anyone in this group can provide some guidance in order for me to get the vertices for a triangle.

Regards,

Marcus D. Jacobs

## ···

_________________________________________________________________

Watch the online reality show Mixed Messages with a friend and enter to win a trip to NY http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/

Hi Marcus,

It's pretty simple, really. The macro:

#define VERTEX(f,n) ((f)->va + 3*(n))

Is designed to be used where you might otherwise use an FVECT. To get the y-coordinate of the first vertex, you would use:

VERTEX(myface_pointer,0)[1]

The z-coordinate of the second vertex would be:

VERTEX(myface_pointer,1)[2]

Likewise, you can pass it to a function that takes an FVECT argument, as in:

fcross(vres, v1, VERTEX(myface_pointer,1));

Hopefully, you get the idea.

-Greg

## ···

From: "Marcus Jacobs" <marcdevon@hotmail.com>

Date: June 11, 2004 11:34:44 AM PDT

Dear Group

I have finally found enough time to try to implement the Moller-Trumbore algorithm for ray-triangle intersection test into Radiance. I have a question though as to how to ascertain the real arguments for the position for each vertex for a triangle. I have gone through the function readfargs in readfargs.c and it appears to me that the arguments for type FUNARGS is stored in its member farg as an array. I have tried reading through some of the source code and it appears to me that the arguments can somehow be ascertained via a macro in face.h, which states:

#define VERTEX(f,n) ((f)->va + 3*(n))

I am unsure how this macro works. At first it seems that the values of each real argument is added to the quantity 3 multiplied times the number of vertices but that I do not think is what is happening. If so, then the arguments are being transformed into another coordinate (maybe local) system. I have not the slightest clue as to what is going on. I am wondering if anyone in this group can provide some guidance in order for me to get the vertices for a triangle.

Regards,

Marcus D. Jacobs