|
Boost : |
From: rodolfo_at_[hidden]
Date: 2006-03-17 14:35:40
On Fri, Mar 17, 2006 at 10:27:00AM -0800, Geoffrey Irving wrote:
> It would be better to have a set of nonvirtual classes defining functions
> like this inline, and then have a template wrapper class to convert one of
> these into a descendant of the virtual class. This way, someone who wants
> to use a million spheres (e.g., for a sphere hierarchy), won't suffer from
> virtual function overhead.
You are right about considering inlining, I'll try to come up a way to
have two interfaces, one easily inlined and another virtual, because
sometimes is important to have some kind of polymorphism, ie, container
of base pointers.
> You should probably think carefully about which basic types to use here,
> especially in terms of small vectors types. I'm not sure if boost has a
> small vector type yet (I didn't see one in uBLAS), but if so it should
> definitely be used.
You mean to use small vector to generalize each primitive to n
dimensions, right? My only objection is that it would complicate the
(for me) basic usage, i.e., 2d (and hopefully 3d) usage. For instance:
point_t<double> pt;
pt.x = 6.0;
pt.y = 3;
or
rect_t<double> rc;
rc.bottom = rc.right = 3;
rc.topleft() = point_t<double>(4,5);
I would not like to lose that. A more generic way would be:
point_t<double, 2> pt; // 2 dimensions
pt[0] = 6.0;
pt[1] = 4;
or whatever..., but for me the first option is preferable. But
I'm open to new ideas.
------------
Rodolfo Lima
_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk