jhiggins Posted August 22, 2005 Share Posted August 22, 2005 I'm trying to iterate over my points in the same way that houdini would. so, i have a grid where I get the point list via GEO_PointList points = getOutputGDP()->points(); And i can get my grid resolution via GEO_Primitive* source_prim = getOutputGDP()->primitives()(0); GEO_Hull* hull_surf = (GEO_Hull*)source_prim; int resx = hull_surf->getNumRows(); int resy = hull_surf->getNumCols(); now its up to me to iterate the points via for ( int y = 0; y < resy; y++) { for ( int x = 0; x < resx; x++) { int index = x + resx *y; .... } } but this assumes that the data is ordered this way, and there are 3 other permutations to consider. which way do I access my point data? the reason why i'm accessing the array this way is so that I can easily compare data from neighbouring points. Is there a better way? jeff Quote Link to comment Share on other sites More sharing options...
George Posted August 23, 2005 Share Posted August 23, 2005 Hi Jeff, Have you considered iterating through the hull itself? Each vertex on the hull can be indexed using row/column and then from the vertex you can grab the GEO_Point that is associated with it. You never have to know the index of the point. For example: for (r = 0; r < hull->getNumRows(); r++) { for (c = 0; c < hull->getNumCols(); c++) { const GEO_Point *pt = hull->getVertex(r, c).getPt(); // ... } } This way to access neighbouring points, its easy, to just change the index of the vertices. Hope that helps, George. Quote Link to comment Share on other sites More sharing options...
jhiggins Posted August 23, 2005 Author Share Posted August 23, 2005 Hi Jeff,Have you considered iterating through the hull itself? Each vertex on the hull can be indexed using row/column and then from the vertex you can grab the GEO_Point that is associated with it. You never have to know the index of the point. For example: for (r = 0; r < hull->getNumRows(); r++) { for (c = 0; c < hull->getNumCols(); c++) { const GEO_Point *pt = hull->getVertex(r, c).getPt(); // ... } } This way to access neighbouring points, its easy, to just change the index of the vertices. Hope that helps, George. 20764[/snapback] beautifull!!! thats exactly what i needed thanks George, jeff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.