18th November 2015, 08:55 AM | #1 |
Junior Member
Member
Join Date: Aug 2013
Location: London UK
Posts: 22
|
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? |
24th November 2015, 05:29 AM | #2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
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. |
25th November 2015, 08:24 AM | #3 |
Junior Member
Member
Join Date: Aug 2013
Location: London UK
Posts: 22
|
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 |
Tags |
ac_plugin, bug, plugins, sdk |
|
|