[OpenWalnut-Dev] Eigen3 Transition

Christian Heine heine at informatik.uni-leipzig.de
Wed May 4 16:53:59 CEST 2011


Hi,

no questions, just comments.

On 05/04/2011 03:32 PM, Sebastian Eichelbaum wrote:
> Its Done!
>
> I, Ich and Io done the job that was intended to be done by everyone (with help of André). We now have our own fixed size vectors and matrices. I ported all the code to the new classes. There are some things to mention:
>
>   * Default Constructor creates a zero-initialized Vector/Matrix (unlike the eigen3 types)
Very good!

>   * All the operations that are not expressable by operators are done as Non-Friend Non-Members (unlike osg::Vec)
>     * this mostly concerns things like normalize, length, dot and cross for vectors
>     * DO NOT add these functions as members
Very good!

>   * Operations with matrices/vectors of different integral type (double vec multiplied by float matrx) are possible.
>     * In these cases, the resulting matrix/vec uses the better of both types.
Good! I assume you use a fixed list of combinations, as a general 
solution is not possible in C++98.

>   * The vectors are implicitly cast-able to osg::Vec types.
>   * The matrices are implicitly cast-able to osg::Matrix types and Eigen3 Matrix Types (of same size)
>   * There might be ambiguities with these cast operator:
>     : Assume the following situation: you have an WVector3d, which is a 3D vector of type double.
>     : Additionally you have a function f with two signatures: void f( osg::Vec3d ) and f( osg::Vec3f ).
>     : If you call WVector3d v; f(v); you get a compiler error due to ambiguity, since v is implicitly
>     : cast-able to osg::Vec3f AND osg::Vec3d. If this problem occurs: use f( v.as<  osg::Vec3d>() );
I do not want to bitch about using implcit casts - I presume it was 
a pragmatic solution, but an allowing an implicit cast of WVector3d 
to osg::Vec3f losing precision *should* be reconsidered. Should the 
implicit cast be kept, the proposed workaround could be made into: 
f( static_cast<osg::Vec3d&>(v) ); removing the need for the .as() 
member template.

> Maybe I forgot something. If you have questions, ask me
>
> Bye
> Sebastian

Best Regards,
Christian

-- 
Dipl.-Inf. Christian Heine
Institut fuer Informatik | phone: +49-341-97-32311
Universitaet Leipzig     | fax:   +49-341-97-32252
PF 100920                | mailto:heine at informatik.uni-leipzig.de
D-04009 Leipzig, Germany | http://www.informatik.uni-leipzig.de/bsv/


More information about the OpenWalnut-Dev mailing list