[OpenWalnut-Dev] WMatrixFixed

Sebastian Eichelbaum eichelbaum at informatik.uni-leipzig.de
Mon May 23 15:32:14 CEST 2011


Hi Anne

On Mon, 23 May 2011, Anne Berres wrote:

> Hi everyone,
> 
> I'd like to add some functionality to WMatrixFixed:
> 
> - getters and setters for rows using 3d/4d vectors, e.g. (of course using templates)
> -- osg::Vec4 getRow( int index )
Ok: This is nice, but do not use osg::Vec. Write something like this:

    WMatrixFixed< ValueType, 1, Cols, ValueStoreType > getRow( size_t index ) 
    {
      ...
    }

This ensures that you can also grab a 15d vector if the matrix has 15 cols.

> -- void setRow( int index, osg::Vec4 vector )

This should be implemented in a similar fashion to this one:

    template< typename RHSValueT, ValueStoreTemplate RHSValueStoreT >
    void  setRow( size_t index, const WMatrixFixed< RHSValueT, 1, Cols, RHSValueStoreT >& vec )
    {
      ...
    }

This ensures that you can also set vectors of another value-type.

> 
> - alternatively/additionally: explicit setters, e.g.
> --- void setRow( int index, double x, double y, double z, double w )
No. Use the setRow-method:  setRow( index,  WVector3d( x, y, z ) ) to achieve this.

> - a constructor using vectors (possibly problematic/ugly if you provide it for both rows *and* columns)
Not really possible in a generic fashion. Construct the matrix and set the rows/columns afterwards
> 
> These changes would result in having
> - getRow() to get a specific row
> - getRows() to get the number of rows 
  -> already exists
> This may be confusing so I would suggest renaming getRows() to getRowCount() or getRow() to getSingleRow().
No we keep getRows and getColumns (already existing). The getRow/setRow and getColumn/setColumn can be named set/getRowVector or similar to denote that you set one row using a vector

> 
> Of course, all this includes the corresponding changes to columns.
> 
> Any objections? Is it total nonsense? Should I do it differently? Is there already a way to do this that I didn't see?
There is always another option to extending the matrix: use non-friend-non-meber functions. Examples are length or normalize in WMatrixFixed.h
> 
> Cheers,

Bye
Sebastian
> Anne
> _______________________________________________
> 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
-04009 Leipzig


More information about the OpenWalnut-Dev mailing list