Jump to content

Point Order


Recommended Posts

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

Link to comment
Share on other sites

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 &lt; hull-&gt;getNumRows(); r++)
{
   for (c = 0; c &lt; hull-&gt;getNumCols(); c++)
   {
        const GEO_Point *pt = hull-&gt;getVertex(r, c).getPt();
       // ...
   }
}

This way to access neighbouring points, its easy, to just change the index of the vertices.

Hope that helps,

George.

Link to comment
Share on other sites

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 &lt; hull-&gt;getNumRows(); r++)
{
   for (c = 0; c &lt; hull-&gt;getNumCols(); c++)
   {
        const GEO_Point *pt = hull-&gt;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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...