|
Boost : |
From: Andrew J. P. Maclean (a.maclean_at_[hidden])
Date: 2003-05-21 18:47:43
You also need the full set of homogeneous transforms.
This is essential in performing perspective transforms and also
simplifies working with affine transforms and helps to clearly
distinguish between points and vectors. A point has 1 as the forth
coordinate and a vector has 0. In fact this can be generalised to:
"A n-dimensional point has 1 as the (n+1)th coordinate and a vector has
0 as the (n+1)th coordinate."
This makes handling of affine transformations easy.
As a first cut you would need:
1. Rx,Ry,Rz - rotations about the x,y,z axes - probably better to use
either 1,2,3 for first second and third coordinate?
1a - IMPORTANT: From an arbitrary rotation matrix determine the specific
axis and angle about which the rotation occurs. It is actually
surprisingly easy to do.
2. Right-Handed<->Left-Handed coordinate system conversion.
3. Perspective projection of (x,y,z) onto the projection plane at z=d.
Only applies in the special case when the center of projection is at the
origin.
4. Perspective projection of (x,y,z) onto the projection plane at z=0,
center of projection at z=-d. Only applies in the special case when the
center of projection is at the (0,0,-d).
5. Orthographic projection of (x,y,z). Only applies in the special case
when the direction of projection is parallel to the z-axis.
6. General projection of (x,y,z). The center of projection is a distance
Q from the point (0, 0, zp), the direction to the center of projection
is given by the normalised direction vector (dx, dy, dz).
Check out:
"Computer Graphics using Open GL" F.S. Hill Prentice Hall
"Computer Graphics Principles and Practise in C", Foley et.al.
Addison Wesley
Andrew
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.cas.edu.au/
___________________________________________
-----Original Message-----
From: Reece Dunn [mailto:msclrhd_at_[hidden]]
Sent: Thursday, 22 May 2003 02:33
To: boost_at_[hidden]
Subject: Re: [boost] proposal for efficient geom. vector class
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.
>so what about this idea?
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk