Not Yet Answered # Obj File Ray Intersection Class

Alex Edwards 321 Alex Edwards 321 Discussion Starter daviddoria 334 Alex Edwards 321 vijayan121 1,152 Discussion Starter daviddoria 334 Alex Edwards 321 Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

0

Anyone know where I can get an implementation of this? Some code to read in a set of vertices/triangles and then do some simple intersection tests? If you can point me in the right direction that'd be great!

Thanks,

Dave

Seems like you can easily do this by emulating a Cartesian plane and then finding out if the arc-tangent of the coordinates a triangle on its own separate axis is greater than, less than or equal to the other triangle in question.

If the initial triangle has a smaller arc-tan than the other triangle and a point of the other triangle is found within the "square" bounds of the initial triangle then an intersection has occurred, otherwise there is no intersection.

You'd have to cycle through the possible vector collisions of one triangle to the other, but the idea is pretty straightforward.

0

Actually, i just found a better solution.

If at any given time, a point from the outside of the triangle has a shorter distance than all of the shortest distances from points to their opposite sides, then there is obviously an intersection.

If even one of those points return a longer distance than the shortest distance to the opposite side when taking the difference of the point in question, then no intersection has occurred.

0

Right, but I was wondering if anyone has this implemented? I would rather spend time on my actual work instead of implementing this that has surely been implemented 1000 times before!

0

You know, the funny thing is that when you mentioned this I worked on it right away since it seemed like an interesting project.

I have a program that creates triangles on a particular location in the imaginary Cartesian plane and can detect collisions using an equals assignment, however I'm still trying to figure out the accuracy of the collision-detecting operation.

So far it seems very accurate but more testing needs to be done.

0

> but I was wondering if anyone has this implemented?

many people have. google for Moller-Trumbore algorithm.

two other implementations:

http://jgt.akpeters.com/papers/Chirkov05/C2005.cpp.html (chirkov's c2005 algorithm)

http://geometryalgorithms.com/Archive/algorithm_0105/algorithm_0105.htm#intersect_RayTriangle() (sunday)

0

ok folks, i couldn't find anything that wasn't crazy overly complicated, so I wrote it myself:

http://doriad.myrpi.org/ObjReader.cpp

The triangle intersection is a bit harder to post because it uses a big geometry library that I have written, but I'll post the main intersection function once I test it.

Dave

0

ok folks, i couldn't find anything that wasn't crazy overly complicated, so I wrote it myself:

http://doriad.myrpi.org/ObjReader.cppThe triangle intersection is a bit harder to post because it uses a big geometry library that I have written, but I'll post the main intersection function once I test it.

Dave

I've actually come up with a formula to solve for all intersections, however it's harder to implement than I thought.

**Isn't it about time forums rewarded their contributors?**

Contribute to this discussion and earn rewards points that can be cashed out for dollars.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...