It's far more readable :) Thanks for the changes. They are submitted to svn trunk.
Regards, On Wed, May 25, 2011 at 4:50 PM, Ryan Pavlik <rpav...@iastate.edu> wrote: > The replacement of that inline function with a macro removes the type-safety > offered by C++ and makes the code more accident prone. I did the > static-casts with the multiple parameters because the parameters to the > function aren't necessarily always the same type. Looking into it further, a > single parameter, which is manually specified when in doubt, seems to be the > smartest solution, since it makes it explicit at the point of the call what > precision is being used when it is ambiguous. I've attached files for an > updated function which combines the best of all solutions so far: template > function with a single parameter, body uses osg::absolute to simplify > expression, and one explicit specification of the template parameter in > calling code. Simpler and more explicit all around, I think - hopefully this > will be acceptable. It build cleanly here: windows, vc9, maya 2012 x64 > Ryan > > On Tue, May 24, 2011 at 5:20 PM, Javier Taibo <javier.ta...@gmail.com> > wrote: >> >> Thanks for the fixes. Changes are now committed to svn trunk. >> >> About the second issue, it seems a much complicated piece of code >> for what it's doing. I suggest this lighter and cleaner alternative >> instead of a template with three different typename parameters and the >> huge expression with four static_cast. >> >> #define inTolerance(base, match, tolerance) ( >> osg::absolute((base)-(match)) < tolerance ) >> >> However, this part of the code was written by Peter Particle, so >> I'll redirect to him both proposals. >> >> Meanwhile, can you test if it is working for you right now? >> >> >> Regards, >> >> >> On Tue, May 24, 2011 at 11:08 PM, Ryan Pavlik <rpav...@iastate.edu> wrote: >> > The changes to osgpreview.cpp are for the first issue, while the changes >> > to >> > utility.h are for the second way of solving the second issue. >> > Ryan >> > >> > On Tue, May 24, 2011 at 12:59 PM, Javier Taibo <javier.ta...@gmail.com> >> > wrote: >> >> >> >> Hi Ryan, >> >> >> >> Thank you for the patches. Can you send the whole files instead of >> >> patches, please? You can zip all files together to make it easy. >> >> >> >> Thank you! >> >> >> >> >> >> Best Regards, >> >> >> >> >> >> On Tue, May 24, 2011 at 7:28 PM, Ryan Pavlik <rpav...@iastate.edu> >> >> wrote: >> >> > Hello all, >> >> > I've attached small patches to two issues I've found with Maya2OSG. >> >> > One allows it to build successfully with the current 2.8 branch - >> >> > there >> >> > are >> >> > some manipulators not available in this branch so we just disable >> >> > them >> >> > by >> >> > checking the osg version. >> >> > The other issue was ambiguity in calling inTolerance, preventing me >> >> > from >> >> > building successfully on VC9 x64. I solved this two different ways: >> >> > take >> >> > your pick of which way you prefer. >> >> > >> >> > I've made inTolerance a template function with a single parameter >> >> > type >> >> > and >> >> > explicitly specified the template parameter in the one case. >> >> > (fix-vc9-build) >> >> > inTolerance is a template function with three parameter types, and >> >> > static_casts all arguments to the type of the tolerance parameter >> >> > before >> >> > doing math. This one doesn't require explicit template param >> >> > specification, >> >> > and seems "more correct" to me, or at least more explicit in how it >> >> > works. I >> >> > personally prefer this one. (alternate-fix-build) >> >> > >> >> > These patches were made against the latest svn trunk of maya2osg >> >> > using >> >> > tortoisesvn. >> >> > Ryan >> >> > -- >> >> > Ryan Pavlik >> >> > HCI Graduate Student >> >> > Virtual Reality Applications Center >> >> > Iowa State University >> >> > >> >> > rpav...@iastate.edu >> >> > http://academic.cleardefinition.com >> >> > >> >> > _______________________________________________ >> >> > osg-users mailing list >> >> > osg-users@lists.openscenegraph.org >> >> > >> >> > >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > >> >> > >> >> >> >> >> >> >> >> -- >> >> Javier Taibo >> >> _______________________________________________ >> >> osg-users mailing list >> >> osg-users@lists.openscenegraph.org >> >> >> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> > >> > -- >> > Ryan Pavlik >> > HCI Graduate Student >> > Virtual Reality Applications Center >> > Iowa State University >> > >> > rpav...@iastate.edu >> > http://academic.cleardefinition.com >> > >> > _______________________________________________ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> >> >> >> -- >> Javier Taibo >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > -- > Ryan Pavlik > HCI Graduate Student > Virtual Reality Applications Center > Iowa State University > > rpav...@iastate.edu > http://academic.cleardefinition.com > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Javier Taibo _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org