here my problem: i am creating an object (box cylinder,cone,hexagone), i then define a new object. how can i check if the new object is entirely inside the first one or not? I can also rotate and translate both objects. Code suggestions?

Hi,

algorithn off the top of my head:

```
- for all triangles in the first object
- define plane p=[a b c d] from the triangles' three vertices w/ plane normal pointing outside of the object
- for all verticies in your new object,
- if (p dotproduct v) > 0, then this vertex of the second object is outside the first
```

that’s an O(N^2) algorithm, though, but you could cull the number of tests with better geometry structures. There might even be a better algorithg. LIke i say, it’s just off the top of my head

chjeers

John

Boxes and spheres have very fast intersection testing algorithms and they are really easy to code. Cylinders are a bit more complicated but you can always “approximate” a cylinder with a box. David Eberly’s magicsoftware website has some useful code regarding these problems. Do check it out, and coming from dave eberly, its bound to be really well optimized.