[OpenWalnut-Dev] Eigen3 Transition

Sebastian Eichelbaum eichelbaum at informatik.uni-leipzig.de
Wed May 4 17:12:57 CEST 2011


I forgot to mention: the loss in precision if casted to Vec3f is not problematic as calculation is done with WVector3d in double precision. Only of this vector then is used in some OSG API which requires an Vec3f, the cast is done implicitly.

On Wed, 04 May 2011, Sebastian Eichelbaum wrote:

> 
> 
> On Wed, 04 May 2011, Christian Heine wrote:
> 
> > 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.
> Yes we already considered this and unfortunately, the OSG API mixes Vec3f and Vec3d throughout their API, but we want to comfortably use our vectors for this API. The static cast does not work by the way, since osg::Vec3d provides constrcutors for Vec3d AND Vec3f (and vice versa). So, a static_cast also produces ambiguity problems during compilation. 
> > 
> > >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/
> > _______________________________________________
> > OpenWalnut-Dev mailing list
> > OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> > http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
> > 
> 
> -- 
> Dipl.-Inf. Sebastian Eichelbaum
> Universität Leipzig
> Institut für Informatik
> Abteilung Bild- und Signalverarbeitung
> PF 100920
> D-04009 Leipzig
> _______________________________________________
> OpenWalnut-Dev mailing list
> OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
> 

-- 
Dipl.-Inf. Sebastian Eichelbaum
Universität Leipzig
Institut für Informatik
Abteilung Bild- und Signalverarbeitung
PF 100920
D-04009 Leipzig


More information about the OpenWalnut-Dev mailing list