|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2007-10-08 09:37:50
Hi John,
> I am ready to worry about IF and how boost would accommodate the
> other semantics of a 'point' concept. As the GTL author seems to
> have pointed out in their explanation of "isotropic", a point is a
> point regardless of its coordinates, and perhaps a point concept
> should involve the coordinate-free operations that make sense on a
> point versus a vector etc., and another concept/term should be
> adopted for the set of coordinates. If the GTL authors have such
> concepts I am curious to see the interplay of point, vector, and
> coordinate_sets (or whatever they are called).
>
Exacty.
A concept is just a set of minimal requirements. It is not a class,
neither is an adapter (it seems this library somewhat mixes conepts with
adapters).
So, while we certainly would like one single point class, or at most a few
of them,
we don't need to use a monolithic super concept.
We can use a set of concepts instead, each one capturing an ortoghonal
aspect of the design.
Off the top of my head:
IndexableCartesian2 (provides indexed access: [0], [1])
IndexableHomogeneous2 (provides indexed access: [0], [1], [2])
Cartesian2 (provides named access: x(),y())
Homogeneous2 (provides named access: x(),y(),w())
Vector2 (provides coordinate-free vector-specifc operations)
Point2 (provides coordinate-free point-specifc operations)
.. and so on for 3 dimensions, for heteregeneous coordinates, etc.
Notice that a point is a point regardless of its coordinates, and so is a
vector. That is, Vector2/Point2 ARE NOT refinements of the concepts for
coordinate sets.
Best
Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk