Boost logo

Boost :

From: Patrick Kowalzick (patrick.kowalzick_at_[hidden])
Date: 2003-05-21 13:11:44


Hello all,

> >AFAIK, there're no vector (i mean
> >geometrical vectors) classes in boost
> >(well, there's uBLAS version of vectors but that's rather a container
> >than a geometrical primitive, correct me if i'm wrong).

I n my opinion you are wrong. For me there is no difference between a vector
in a mathematical sense and in a geometrical sense and vector calculations
are provided by uBlas which are not in a sense of a container.
For me a geometrical primitives are something else, e.g. points, lines,
planes (which could be represented by (a) vector(s)), cubics, conics (which
could have different representations, e.g. matrices) and other things.
I agree that it would be nice to have a library for calculations with
geometric entities, but I do not believe it would be a good idea to move
away from uBlas.

[snip]

> I was thinking of creating a library that supported 2D, 3D, 4D and nD
> variants of the following:
>
> boost::geometric::point - represents a location
> point = point +/- vector
> and variants
> NOTE: cannot do point * point (does not make sense mathematically)

hmm, see above: point+vector makes no sense to me, but point+point could.
point*point could make sense if you, e.g. regard complex numbers same as
like 2D-Coordinates. I do not know for quaternions nor for octanios.

> boost::geometric::vector - represents a distance between two points
> vector = point - point
> vector = vector +/-/*/div vector
> vector = vector +/-/*/div scalar
> and variants

In my opinion a distance is a scalar.

> boost::math::matrixNxN - N x N matrices and related operations
> matrix = matrix +/-/* matrix
> and variants

NxN is not enough, rectangular matrices are very useful for projective
transformations.

> There should also be the matrix-based functions:
> boost::math::transpose( matrix ) - T( i, j ) = A( j, i )
> boost::math::det( martix ) - the determinant of the matrix
> boost::math::cofactor( matrix, i, j ) - the sub-matrix of the matrix
> at the position ( i, j )
> and others

Me personally thinks that it is not a good idea to move away from uBlas. If
there is more performace needed special routines may be adopted for special
configurations.

> It should also be possible to perform geometric operations:
> matrix boost::geometric::translate( x, y, z )
> translate an object by this matrix
> matrix boost::geometric::scale( x, y, z )
> enlarge an object by this matrix
> NOTE: identity = scale( 1, 1, 1 )
> matrix boost::geometric::rotate( x, y )
> matrix boost::geometric::rotateX/Y/Z()
> rotate an object about a plane
>
> These operations can then be combined via matrix multiplication and
applied
> to a point (or vector?):
> point = point * matrix
> vector = vector * matrix
> and variants
>
> There should also be the facility to project an object from one dimension
> system to another, e.g.
> point2D boost::geometric::project( point2D )
>
> NOTE: These are not precise definitions of how the functions/interface
> should look like, it is just a basic outline.

I think the first step should be to tink about the goal which to achieve
with a lib like that. Do we want a library for geometrical algebra? Do we
want to have very fast routines and why? Which representations for
geometrical entities should we use?

Now something constructive.

Definitions for geometrical entities:

Point, Line, Plane each using a homogeneous vector represantation.
Conics, Cubics using a homogeneous matrix representation.
Functions for 2D and 3D Calculations (in overdetermined cases perhaps some
classes?).

For example:
Line is joining of two points in 3D (4-Vector). The result type would be a
6-Vector (Pluecker-Coordinate)

point<double,3D> p1,p2;
// write some data in p1,p2
line<double,3D> l=joining<line<double,3D>(p1,p2);

or an overdetermined case:

point<double,3D> p1,p2,p3;
// write some data in p1,p2,p3
// group p1,p2,p3 in a container pc
line<double,3D> l=joining<line<double,3D>(pc);

Hmm I really do not know. I will try out something the next week, because I
need something like this as well. In fact it is getting a lit more
complicated for me, because I need variances an covariances for my objects
as well.

Patrick


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk