Hi, i'm working on a point-in-polygon test. my current implementation has a list with plain pointers that hold references to the polygons' properties. (i use them to ease the calculating of an inside-result for that polygons)
Code: class FetchedPolygon { public: FetchedPolygon(osg::Geometry* geom = NULL, osg::Vec3Array* verts = NULL); osg::Geometry* geometry; osg::Vec3Array* vertices; std::vector<osg::PrimitiveSet*> primitiveSets; }; std::map<const unsigned int, FetchedPolygon> fetchedPolygons; before, i used smart-pointers to reference the polygons. (of course) it works both ways, but i can't decide what typ of referencing to use. i think if i use smart-pointers, i would be able to check if the actual polygons in the scenegraph are still valid (check the ref counter) without the need of a dirty flag. but if the polygons get changed/deleted (e.g. when i want to load a new set of polygon features) the properties i'm pointing to wouldn't be deleted as long as the smart-pointers are referencing them. i think its hard to give a rule of thumb when to use smart-pointers. in general i'm using them when objects (especially for the scenegraph) are created - as long as they won't be attached to another scenegraph-object on the next line. i don't use them to reference these already allocated objects, e.g. when they are passed to another function, i would use a local pointer inside. so what your suggestions? Thanks in advance, christian ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9282#9282 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org