hoknamahn Posted February 4, 2009 Share Posted February 4, 2009 (edited) Hi guys, I need a method that returns the number of points or vertices in primitive (precisely GEO_Primitive) and also a way to get a reference to any point / vertex in a prim. I'm stuck somewhere between those Doxy HDK pages trying to figure out this stuff Thanks. Edited February 4, 2009 by hoknamahn Quote Link to comment Share on other sites More sharing options...
eloop Posted February 4, 2009 Share Posted February 4, 2009 (edited) Culled from one of my sops ... const GEO_Primitive *prim; FOR_ALL_PRIMITIVES(gdp_in,prim) { if (prim->getPrimitiveId()==GEOPRIMPOLY) { if (prim->getVertexCount() >= 3) I generally just browse the include files, quicker than loading web pages. -Drew Hi guys,I need a method that returns the number of points or vertices in primitive (precisely GEO_Primitive) and also a way to get a reference to any point / vertex in a prim. I'm stuck somewhere between those Doxy HDK pages trying to figure out this stuff Thanks. Edited February 4, 2009 by eloop Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted February 5, 2009 Author Share Posted February 5, 2009 Culled from one of my sops ... const GEO_Primitive *prim; FOR_ALL_PRIMITIVES(gdp_in,prim) { if (prim->getPrimitiveId()==GEOPRIMPOLY) { if (prim->getVertexCount() >= 3) I generally just browse the include files, quicker than loading web pages. -Drew Thanks Drew! Looks like the best way is digging of someones code Quote Link to comment Share on other sites More sharing options...
Ratman Posted October 4, 2009 Share Posted October 4, 2009 Thread resurrection! Instead of opening one I'm just gonna bump this, but I''m trying to do the same business, except I want the total number of points, since I'm not working with vertices, and I cannot seem to be able to find a way. I tried something like this but ended up getting this crazy value. FOR_ALL_GPOINTS(gdp, pt) { numpoints += pt->getNum(); } Been searching all over the docs, but can't seem to find anything that works. Quote Link to comment Share on other sites More sharing options...
edward Posted October 4, 2009 Share Posted October 4, 2009 pt->getNum() in the above code gives you the point number (ie. $PT) so you don't want to be adding those up. It would simpler if you just added 1 in your loop to numpoints to get the total number of points that the FOR_ALL_GPOINTS() loop iterated over. However, since you're looping through ALL points, you can just do numpoints = gdp->points().entries() (without looping) Quote Link to comment Share on other sites More sharing options...
Ratman Posted October 4, 2009 Share Posted October 4, 2009 pt->getNum() in the above code gives you the point number (ie. $PT) so you don't want to be adding those up. It would simpler if you just added 1 in your loop to numpoints to get the total number of points that the FOR_ALL_GPOINTS() loop iterated over. However, since you're looping through ALL points, you can just do numpoints = gdp->points().entries() (without looping) Ack, I knew I shouldn't have been coding so late. Thanks edward! 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.