Primitive Collision Detecting (6)

原创 2006年06月04日 21:50:00

Sphere & AABB

Sphere:   | P – C | <= R

AABB :A  { V3d inf, sup;}

 

           //摘自Real Time Rendering

 

           d = 0;

           for each i [x, y, z]

            {

               if ( C.i < A.inf.i )

              {

              d += (C.i –A.inf.i)^2;
              }

              else

              if ( C.i > A.sup.i )

              {

              d += (C.i –A.sup.i)^2;
               }

           }

 

 if ( d > R^2 )return No Intersection;

 

           return Intersectant;

 

 

Sphere & OBB

Sphere:   | P – Q | <= R

OBB :     {  V3d C, U, V, W;

  V3d L; }      //C是中心点坐标,U、V、W是三个轴方向,L的三个分量是U、V、W是三个方向的半长,表示Box长宽高各一半大小

 

Method(1)

             做空间变换,使得变成Sphere & AABB的相交判断,这种做法是Real Time Rendering上写的

 

Method(2)

             S = Q – C;

             x = S • U;

             y = S • V;

             z = S • W;

 

      d = 0;

       for each i [x, y, z]

{

          if ( i < -L.i )

{

              d += (i + L.i)^2;

}

           else

          if (i > L.i )

{

              d += (i –L.i)^2;

}

}

 

      if ( d > R^2 )return No Intersection;

 

       return Intersectant;

 

Ellipsoid & AABB

Ellipsoid:    (x - x0)^2 / a^2 + (y - y0)^2 / b^2 + (z - z0)^2 / c^2 <= 1       (a>0, b>0, c>0)

AABB   :  A  { V3d inf, sup;}

 

Method(1)

                    做空间变换,将Ellipsoid变换成Sphere,然后做Sphere & AABB的相交判断

 

Method(2)

                    P0 = { x0, y0, z0 };

           d = 0;

           for each i [x, y, z], j ∈ [a, b, c]

           {

              if ( P0.i < A.inf.i )

               {

              d += (P0.i –A.inf.i)^2 / j^2;
              }

               else

              if ( P0.i > A.sup.i )

              {

              d += (P0.i –A.sup.i)^2 / j^2;
              }

            }

 

 if ( d > 1 )  return No Intersection;

 

           return Intersectant;

 

Ellipsoid& OBB

Ellipsoid:    (x - x0)^2 / a^2 + (y - y0)^2 / b^2 + (z - z0)^2 / c^2 <= 1       (a>0, b>0, c>0)

OBB   :  {   V3d C, U, V, W;

  V3d L; }

 

Method(1)

                    做空间变换,将Ellipsoid变换成Sphere,然后做Sphere & OBB 的相交判断

 

Method(2)

                    做空间变换,将OBB变换成AABB,然后做Ellipsoid & AABB的相交判断

 

Method(3)

                    做两次空间变换,将Ellipsoid变换成Sphere,OBB变换成AABB,然后做Sphere & AABB的相交判断

 

Method(4)

             P0 = { x0, y0, z0 };

             S = P0 – C;

             x = S • U;

             y = S • V;

             z = S • W;

 

       d = 0;

       for each i [x, y, z], j ∈ [a, b, c]

{

          if ( i < -L.i )

{

              d += (i + L.i)^2 / j^2;

}

          else

          if ( i > L.i )

{

              d += (i –L.i)^2 / j^2;

}

}

 

       if ( d > 1 )  return No Intersection;

 

return Intersectant;

 

 

Line Segment & Sphere, Optimized

Line Seg:  P = P0 + t * V         t ∈ [0, 1]

Sphere :  | P – C | <= R

 

//摘自Real Time Rendering

          L = C – P0;

s = V • L / |V|;

l2 = L^2;

if ( s < 0 && l2 > r^2 )   return No Intersection;

 

m2 = l2 – s^2;

if ( m2 > r^2 )           return No Intersection;

 

returnIntersectant;

//q = sqrt(r^2 – m^2);

//if ( l^2 > r^2 ) t = (s – q) / |V|;

//elset = (s + q) / |V|

           



版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

【ECCV2016】Detecting Text in Natural Image with Connectionist Text Proposal Network

本文的方法最大亮点在于把RNN引入检测问题(以前一般做识别)。文本检测,先用CNN得到深度特征,然后用固定宽度的anchor来检测text proposal(文本线的一部分),并把同一行anchor对...

opencv 第10天 Detecting and Matching Interest Points

Detecting Harris corners int main() { Mat cornerStrength; Mat image = imread("D:\\images\\church01...

我是如何成为一名python大咖的?

人生苦短,都说必须python,那么我分享下我是如何从小白成为Python资深开发者的吧。2014年我大学刚毕业..

Detecting Near-Duplicates for Web Crawling - simhash与重复信息识别

随着信息爆炸时代的来临,互联网上充斥着着大量的近重复信息,有效地识别它们是一个很有意义的课题。例如,对于搜索引擎的爬虫系统来说,收录重复的网页是毫无意义的,只会造成存储和计算资源的浪费;同时,展示重复...

多尺度R-CNN(2): Inside-Outside Net: Detecting Objects in Context with Skip Pooling and Recurrent Neural

CNN高层特征具有丰富的语义信息,低层特征具有较高空间分辨率,研究如何融合不同层之间的特征,是物体检测领域热门的方向。近期很多工作通过融合多层来提升检测和分割的性能,按照融合与预测的先后顺序,分类为早...

Detecting cryptographic misuse with Argus static analysis framework

In the last post I talked about Argus static analysis framework and his capabilities for analyzing...

Tutorial: Detecting When A User Blows Into The Mic

http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/   byDan Grigsbyon19. Aug...

Tutorial: Detecting When A User Blows Into The Mic(检测麦克音量)

http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/ If, a couple of yea...

【Abstract-1】Lost and Found: Detecting Small Road Hazards for Self-Driving Vehicles

Lost and Found: Detecting Small Road Hazards for Self-Driving VehiclesLost and Found:自动驾驶车辆的道路小危害检测P...
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)