Volume/plane intersection

It started life as a solution to this frustum culling problem. I don’t normally come up with anything this clever, so one thing lead to another and now I’ve got an efficient generalised volume/plane intersection finding utility on my hands. It handles non-convex volumes and the intersection polygon vertices are returned in order. I’ve got no use for it, so here you go:

Subclass IntersectionVolume to define a particular topography (number of vertices, edges between vertices, faces bound by edges). Have a look at Box, Tetrahedron and Dipyramid for examples of this. Betraying its genesis, Box has a method to set its vertices from view frustum planes.
Set the vertex positions as required (bear in mind that faces have to be convex polygons), and you’re ready to go. There are methods to find the intersection polygons with x, y and z planes, or you can query on an arbitrary plane at the minimal additional cost of a dot-product per vertex.

http://homepages.inf.ed.ac.uk/rmcnally/intersect/intersect0.png

http://homepages.inf.ed.ac.uk/rmcnally/intersect/intersect1.png

http://homepages.inf.ed.ac.uk/rmcnally/intersect/intersect2.png

Have a play with it with this webstart. 1-4 to change the query volume, q and w to alter the number of queries, a s and d to control the scan speed, left-button drag to rotate the view and right-button drag to rotate the query planes.

I am not as smart as oyu so I have no idea waht that was about. But the webstart looked really cool.

This sure will become handy - thank you very much for sharing this!!! :smiley:

Well, this is jolly excellent :slight_smile:

Cas :slight_smile:

You left out number 5, which is also quite entertaining to watch.

Went over my head too, show off :stuck_out_tongue: I suppose in a few more years i might understand what bleb was going on about. lol