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|

           



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

相关文章推荐

Web Service and primitive SOA

  • 2014年06月27日 21:26
  • 1.25MB
  • 下载

7series_hdl_primitive_library

  • 2014年10月27日 22:10
  • 12.64MB
  • 下载

【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...

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

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

Detecting Texts of Arbitrary Orientations in Natural Images(总结)

Detecting Common Gestures

当用户将一个或多个手指放在屏幕上时,“touch gesture“(触碰手势)就会发生,然后你的应用程序就会把你的 ”触碰“过程解释为一个特有的手势。这个过程分为两个步奏,1.收集 触碰事件的数据。 ...

Detecting and Using LTE Networks

3GPP Long Term Evolution (LTE) is a 4G wireless network technology that supports significantly highe...

COMPA: Detecting Compromised Accounts on Social Networks 论文分析

先介绍下这个篇论文的背景:这篇论文是卡内基梅隆大学的Manuel Egele于今年(2013)发表在NDSS(Network and Distributed SystemSecurity)上,NDSS...

[论文复现]Detecting Text in Natural Image with Connectionist Text Proposal Network

最近一直在复现这篇论文,除了数据外已基本完成,可是没想到昨天开源了[code],只能说我等水货赶不上开源的速度,但是又不开源数据,然后默默地发现,做深度学习这等东西,代码不重要,重要的是数据,以后说不...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Primitive Collision Detecting (6)
举报原因:
原因补充:

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