
On Fri, Mar 17, 2006 at 10:17:53AM -0700, Richard Newman wrote:
Is it reasonable to extend the logic to check for 3D shapes (i.e., spheres instead of circles, etc.)?
It certainly would be a reasonable strategy to get the 2D work you have into the library and treat 3D as a later extension.
Well, 3D is a whole different beast, and is not implemented yet :) What I have is the following (with my name convention, to be changed...): geom_t is an abstract base class with basic functions like: - center -> return the center point of the geometry - box -> return a rectangle encompassing the whole geometry - area -> returns its area then there's the primitive classes that inherits from geom_t: point_t -> a single point in the 2D space circle_t -> represented as a 2D point and a radius rectangle_t -> represented as two points, the upper left and lower right. I'm planning to add polygon and triangle soon. There are also operator>> and << to transfer from and to a stream, and free functions that returns intersections, unions, etc. All coordinates are double. Maybe each primitive should be a template, like: point_t<double> is a point with double floating point coordinates, point_t<int> is with integer coordinates, etc. More ideas are welcome :) Regards, Rodolfo Lima. _______________________________________________________ Yahoo! Acesso Gr�tis - Internet r�pida e gr�tis. Instale o discador agora! http://br.acesso.yahoo.com