It's ok for me.

       Luc




Robert Osfield <[email protected]> 
Envoyé par : [email protected]
14/06/2010 18:35
Veuillez répondre à
OpenSceneGraph Submissions <[email protected]>


A
OpenSceneGraph Submissions <[email protected]>
cc

Objet
Re: [osg-submissions] Bug correction in osgSim:SphereSegment






Hi Luc,

I've reviewed the changes and feel that atan2 is proably a better bet
as it leads to simpler and easier to understand code.  The code I have
gone for is:

    // Calculate the elevation range
    float xyLen = sqrtf(vec.x()*vec.x() + vec.y()*vec.y());
    float elev = atan2(vec.z(), xyLen);   // Elevation angle

    elevRange /= 2.0f;
    _elevMin = elev - elevRange;
    _elevMax = elev + elevRange;

    // Calculate the azimuth range, cater for trig ambiguities
    float az = atan2(vec.x(), vec.y());

Does this look fine by you?  It's now checked into svn/trunk.

I have also checked in your extra test case that you added to
osgspheresegment example as it'll be useful check for the future.
With the above change that behavior is corrected and the results are
identical to your fix.  I did tweak the speed of animation of the
spherement angle though, as I felt it was a bit fast.

Could you test out svn/trunk and let me know if things are fixed/not 
fixed.

Cheers,
Robert.

On Wed, Jun 9, 2010 at 8:59 AM, Luc Frauciel <[email protected]> 
wrote:
> The function setArea(const osg::Vec3& v, float azRange, float elevRange)
> is buggy, you can only turn from -PI/2 to PI/2 with it
> The reason is that it uses asin to compute azimuth.
> asin is define on a PI interval, not 2PI, hence the error
>
> You'll find attached a corrected osgSim/SphereSegment.cpp and a modified
> osgspheresegment.cpp to test the behaviour
> osgspheresegment -t 7  to see the bug/corrected behaviour
>
>
>
>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> 
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to