# Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-03-18 05:03:10

"Geoffrey Irving" <irving_at_[hidden]> wrote in message
news:20060317182700.GG9842_at_lie.Stanford.EDU...
> On Fri, Mar 17, 2006 at 03:09:26PM -0300, rodolfo_at_[hidden] wrote:
>> 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.

In my own work on this I used two namespaces "geometry::two_d" and
"geometry::three_d".
(I shall put what I have in the vault). I or someone could create a Geometry
folder ...?

[...]

>> 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.
>
> Templatization of the float type is good, and again point_t should probably
> be a general purpose small vector type.

I would hope that types such as those in pqs library can be used as
value_types. See http://tinyurl.com/7m5l8
That would be possible using Boost.Typeof which should be in the next distro.
I have done some work on this and will put it in the vault.

I too prefer a class with x, y,z members rather than referring to them as p[0],
p[1] , p[2].

---------- Not points

IMO it is preferable to use vectors rather than points because ...
The result of addition of two vectors is a vector ,but the result of addition of
two points is not a point.

Let p1,p2, p3 be points;

p3 = p1 + p2 ; // Error!

Nevertheless math such as the following on points is valid:

p3 = ( 3 *p1 + 5 *p2) / 8 ; // OK

(It is apparently possible to resolve this by using grassmann points, but I
havent found out how to achieve addition of grassmann points in practise. The
problem goes away if vectors are used exclusively!)

------------- Other useful features:

Compatibility to OpenGL.
conversion of point-vectors to-from homogeneous coordinates.
3x3 (for 2d) and 4 x 4(for 3d) transformation matrices. (Again Ideally useable
with my pqs library!)
Simple arbitrary combination of common transforms with inverse(Undo) capability
too: Common transforms being rotate, translate, scale.
Compatibility with quaternion (Again Ideally useable with my pqs library!)

Wishlist.
Meshes, curves( bezier, NURBS) surfaces meshes(NURBS), operations on arbitrary
2D/3D region such as group ungroup and join 3D shapes.

Output as DXF,WRL, IGES , X3D etc. In fact it is well worth looking at :

and

------------- Recent musing on geometry concepts

it is important to keep the concepts of geometry and graphics separate. For
example a graphical line has thickness and colour, whereas a geometrical line
doesnt.

-------------

regards
Andy Little