Go Back   AC3D Forums > Resources > AC3D Plugins and Other Resources
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 18th November 2015, 08:55 AM   #1
Geoffm
Junior Member
Member
 
Geoffm's Avatar
 
Join Date: Aug 2013
Location: London UK
Posts: 22
Default bug in ac_object_find_bound

When I call ac_object_find_bound for a real object with this code:

Point3 pmin, pmax;
if (ac_object_find_bound(pObject, &pmax, &pmin)) {
std::cout << "Ob " << ac_object_get_name(pObject) << " min " << pmin.x<<","<<pmin.y<<","<<pmin.z
<< " max " << pmax.x <<","<< pmax.y <<","<< pmax.z << std::endl;
}

A typical print out is:

"Ob sphere min -0.89,-1.#QNAN,-0.5 max 3.89176e+033,0.62,0.5"

the x & z min values, and the y, z sizes are actually correct. The object is not infinitely large!

Is this a bug or a change in the arguments from the prototype?
Geoffm is offline   Reply With Quote
Old 24th November 2015, 05:29 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,381
Default Re: bug in ac_object_find_bound

The comments in the code say that the max and min value should already be set before calling the function. The function recursively goes through the hierarchy (e.g. if the object is a group).

If you are using it just on a single (geometry) object, it might be best to set the initial values of max/min to the value of one of the vertices.
Andy is offline   Reply With Quote
Old 25th November 2015, 08:24 AM   #3
Geoffm
Junior Member
Member
 
Geoffm's Avatar
 
Join Date: Aug 2013
Location: London UK
Posts: 22
Default Re: bug in ac_object_find_bound

Quite right - this code correctly reports the min, max once hte pmin, max are initialised to extreme values. And pmin is greater than pmax.

Point3 pmin, pmax;
pmin.x = pmin.y = pmin.z = 1.e32;
pmax.x = pmax.y = pmax.z = -1.e32;
std::string on = ac_object_get_name(pObject);
ac_object_find_bound(pObject, &pmax, &pmin);

std::cout << "Ob " << on << " min " << pmin.x<<","<<pmin.y<<","<<pmin.z
<< " max " << pmax.x <<","<< pmax.y <<","<< pmax.z << std::endl;

However I do not have access to the code, only to ac_plugin.h which does not mention this.

Geoff
Geoffm is offline   Reply With Quote
Reply

Tags
ac_plugin, bug, plugins, sdk

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 12:22 AM.


AC3D Forum
(C) Inivis Limited 2020