I'm looking to implement my own CSG classes for a Robotics project, and I'm thinking to implement each solid as a function that returns a boolean value, given a 3D point; this function will return true if the 3D point is contained within the solid. I figured by doing things this way, I can easily perform union, intersection and subtraction of solids.
This will be sufficient for performing collision detection .etc. by itself, but I'll want to actually render the solids, so my question is this; are there any methods of rendering a solid given its boolean function as described above? I'm more than happy to implement this myself as I want to ideally know exactly what's going on so I can streamline and add to the code as required. I'm also open to suggestions for representing solids in a different way if it will make things easier!
An interesting thing to note is that it would be useful if I could derive things such as the center-of-mass of a solid.
Thanks in advance! Lee.