Hi there,

I'm using the OSGSurface class to render nurbs surfaces.
I started with the surface example and everything works well.
What I want to do is to acces the generated geometry (vertices).
Which should'nt be  a problem since the surface is derived from geometry.
So I check if my surface node is derived from geometry, if this is the 
case I downcast it to a geometryptr and try to get for example the 
geopositions.
Unfortunately doing it that way, the system throws an exception when I 
want to acces any member of the gepositions, for example
geopos->size()
Is this the wrong way to access the geomtery, shouldn't be the case 
cause surface is derived from geometry?
How doing it right?

Thanks  a lot

Sebastian

Here is a codesnippet, that I took from the surface example and modified.
_____
    beginEditCP(surface);
    {
        // set up dimensions and knot vectors:
        surface->setDimU( dimU );
        surface->setDimV( dimV );
        surface->getKnotsU().clear();
        for (i = 0; i < numknotsU; ++i)
        {
            surface->getKnotsU().push_back(knotsU[i]);
        }
        surface->getKnotsV().clear();
        for (i = 0; i < numknotsV; ++i)
        {
            surface->getKnotsV().push_back(knotsV[i]);
        }
        // set control points
        surface->setControlPoints(cps);
        // set error
        surface->setError(g_error);
        // and finally set the material
        surface->setMaterial(mat);

        GeometryPtr geo = NullFC;
        if ( surface != NullFC && 
surface->getType().isDerivedFrom(Geometry::getClassType()) )
        {
            geo = GeometryPtr::dcast(surface);

            GeoPositionsPtr pcl_points = geo->getPositions();

            --> exception is thrown when trying to acces a member of 
GeoPositions
            std::cerr << " points size: " << pcl_points->size() << 
std::endl;
        }

    }
    endEditCP(surface);
_____

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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