Hello Christoph,

Christoph John wrote:
> Hello, 
> I am new to opensg and try to get a pointer to the vertex geometry of some 
> node. 
> Currently I am doing this in the following way. I am not shure if it is best 
> practice. Therefore my question is if there is a more convenient way to get 
> to the data.
> I need a raw float pointer to the data to setup a kdtree structure on top of 
> it. Therefore I am not using iterators. My code:
> 
> osg::NodeRefPtr m_npData;
> GeometryPtr pGeometry = GeometryPtr::dcast(m_npData->getCore());
> GeoPositions3f::StoredFieldType *pPoints;
> 
> pPoints  = GeoPositions3fPtr::
>                dcast(pGeometry->getPositions())->getFieldPtr();
> 
> float* pfData = &((*(pPoints->begin()))[0]);

that is basically the way to do it, yes.
However, this should give you the same and is a bit shorter to type 
(untested though) ;)

float *pfData = &(pPoints->front()[0]);

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to