Jump to content

Retrieving a GEO_Point* from GEO_PointPtrArray


Guest xionmark

Recommended Posts

Guest xionmark

Hello,

I'm confused about retrieving a point from a GEO_PointPtrArray array. The array is getting properly built, verified by a call to GEO_PointPtrArray.display, but when trying to make the assignment to a GEO_Point* variable, mantra crashes. It's got to be something obvious ... !

Code fragment:

GEO_PointTree mySRCPointTree // this actually gets set before this function is called;
GEO_Point * ppt, * inst_ppt;
GEO_PointPtrArray src_list;

GA_FOR_ALL_GPOINTS(inst_gdp, inst_ppt) {
	 UT_Vector3 inst_pos = inst_ppt->getPos();
	 fpreal inst_radius = static_cast<fpreal>(inst_ppt->getValue<fpreal>(myInstAttrRefs.pointRadius, 0));

	 int num_src_pts_found = mySRCPointTree.findAllClosePt(inst_pos, inst_radius, src_list);

	 src_list.display(); // works!

	 if(num_src_pts_found > 0)
		 for(uint i = 0; i < src_list.entries(); i++) {
			 ppt = src_list(i);										 // CRASHOLA!
// 			 fpreal radius = static_cast<fpreal>(ppt->getValue<fpreal>(myPointAttrRefs.radius, 0));
			}

}

As always, thanks in advance!

--Mark

Edited by xionmark
Link to comment
Share on other sites

Guest xionmark

Fixed!

I was using the wrong form of appendPtRadius() to build the point tree list.

For my purposes this was wrong (but valid):

mySRCPointTree.appendPtRadius(ppt->getPos(), radius);

And this is correct:

mySRCPointTree.appendPtRadius(myGdp, ppt, radius);

Never mind! :-)

--Mark

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...