tri tri intersect with uv coordinates

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Jun 22, 2010 at 14:25

Ive been constantly lurking the site, but havent been posting much lately, but now I’ve got another important question!

Im getting geometric boolean objects working at the moment right, but then I suddenly decided I needed to preserve 2 objects with full uv intersecting with each other. :)

Ive nearly got it all done, right, but im stuck sorta at the beginning with this part I left till last, I need a tri tri intersect that describes not only the 2 intersection points, but uv coordinates for the 2 intersection points also.

At the moment, my system is using a battery of ray tri intersects to intersect the edges of triangle a with triangle b and vice versa and its working, but now I need uv coordinates for the two intersection points.

Is there some simple method for doing this, is all im asking, any help would be nice. When I figure it out I’ll close the thread with a result.

4 Replies

Please log in or register to post a reply.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Jun 22, 2010 at 14:30

Heres an example of a nice tri tri (probably faster than my implementation out of ray tri’s by a long shot) http://jgt.akpeters.com/papers/Moller97/tritri.html but it has no uv calculation, so its no good to me.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Jun 22, 2010 at 16:11

Oh that’s easy. Calculate the barycentric coordinates for the intersection points at both triangles, and then you can simply evaluate the uv’s at those positions. For example, if (a, b, c) are the barycentric coordinates for one of the intersection points of triangle A, then the u at that position is a*v[0].u + b*v[1].u + c*v[2].u. Same for the v.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Jun 22, 2010 at 17:15

Thats not the first time ive ever heard barycentric coordinates mentioned, but I unfortunately didnt learn it. :(

So off I go on the net “barycentric coordinates”… thanks .oisyn, if only I had you as a next door neighbour then you could come over and finish my project for me. hehe.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Jun 23, 2010 at 10:11

I read up baricentric coordinates but it blew my mind, went right over my head.

But ive got a solution, I rotate the triangle so its parallel to the camera then I spin it so edge 0 is totally vertical, then I do a line intersection using the edge 1 ray direction and measure the distances along the lines where it intersects.

I then have a weight for both edges then I use the uv’s of edge 0 and edge 1 to produce the uv coordinate.

I bet thats something to do with baricentrics anyway, even though I couldnt say it came from what I read at all, it just totally blew me out of the water.

Thankyou.