Ogre出现”…The minimum corner of the box must be less than or equal to maximum corner”错误

遇到一个bug,是值的范围的问题,下面是解释。

怎么调试也不明白原因,即使google也没发现解决方法。原来自己不小心除以了一个0(在一定情况下),╮(╯▽╰)╭,大家写程序时一定要小心!!!!!


下面是官网描述  http://www.ogre3d.org/forums/viewtopic.php?f=5&t=70549

– OgreAxisAlignedBox.h:252 – OGRE CRASHES

回答者建议:

99% of the time this is caused by the user passing in bad values to ogre’s methods that transform scene nodes. If you give ogre a NAN (Not A Number, a floating point value made by doing bad things like dividing by zero) when moving, rotating or scaling a scene node, it will corrupt the transform matrix the node generates. This is then used to transform the bounding box, which now has NANs in it and triggers the exception.

The most common causes are:
– dividing by zero
– calling acos or asin with a number bigger than 1.0 or less than -1.0 (even a fraction outside that range is fatal. 1.0000001 will cause NANs)

The acos/asin stuff can be fixed by calling Ogre’s Math::ACos or Math::ASin instead, they protect against bad values.

Often acos is used with rotations. For example, you might normalise two vectors, get their dot product, then get the acos of that. The answer is the angle between them. That can be used to rotate an object to look at something. The dot product of two normalised vectors is theoretically between -1.0 and 1.0, but due to floating point errors if might be bigger or smaller by enough to break the acos, which then breaks the rotation, which then breaks the bounding box.


 转自:点击打开链接

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值