 # Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-05-21 11:32:33

Justinas V.D. wrote:

>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).

>idea itself is borrowed from blitz++.

>template< typename T, std::size_t N >
>class tiny_vector { /**/ };

>vector operations are and should be implemented
>inlinely. there should be no inner loops in additions
>substractions, scalar multiplication/division, etc.

>i suppose it would be neat to have boostified vectors
>as we have boostified quaternions, octonions, etc.

I like it. Also, why not extend this to other geometric primitives and
related types.

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)

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

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

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

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.

Regards,
Reece

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger