Primitive Collision Detecting (4)

原创 2006年05月18日 01:21:00

 

Point In Cylinder

Point   :   P

Cylinder:   |(P – O) - ((P – O) • N) * N | <= R

  0 <= (P – O)• N <= L

 

Structure:  { V3d   O;

            float R;

            V3d   N;

            Float L;  }

                  

            V = P – O;

            dp = V • N;

            if ( dp < 0 || dp > L )     return Outside;

 

            T = V –dp * N;

 

            if ( T^2 > R^2 )            return Outside;

 

            return Inside;

 

Point In Cone

Point   :   P

Cone    :   |(P – O) – ((P – O) • N) * N| <= ((P – O) • N) * R / L

  0 <= (P – O)• N <= L

 

    The Data Structure of Cone is same as Cylinder.

                        

            V = P – O;

            dp = V • N;

            if ( dp < 0 || dp > L )     return Outside;

 

            T = V –dp * N;

 

            r = dp * R / L

          

            if ( T^2 > r^2 )            return Outside;

 

            return Inside;

 

 

Sphere & Cylinder

Sphere  :   | P – C | <= r

Cylinder:   |(P – O) - ((P – O) • N) * N | <= R

  0 <= (P – O)• N <= L

 

  OC = C – O;

            dp = OC • N

 

            if ( (dp > L + r) || (dp < -r) )      return No Intersection;

 

            T = OC - dp * N;

 if ( dp > L )

 {

f = sqrt( r^2 – (dp - L)^2 );

if ( T^2 > (R + f)^2 )              return No Intersection;

 

    return Intersectant;

 }

 else if ( dp >= 0 )

 {

if ( T^2 > (R + r)^2 )              return No Intersection;

 

    return Intersectant;

 }

 else

 {

f = sqrt( r^2 – dp^2 );

if ( T^2 > (R + f)^2 )              return No Intersection;

 

    return Intersectant;

 }

 

 

 

Line Segment & Cylinder

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

Cylinder:   |(P – O) - ((P – O) • N) * N | <= R

  0 <= (P – O)• N <= L

 

 OP = P – O = P0 + t * V – O = (P0 – O) + t * V;

           dp = OP • N

           

           dp0 = (P0 – O)• N          t = 0

           if ( dp0 > L )      return No Intersection;

 

           dp1 = (P0 – O + V)• N      t = 1

           if ( dp1 < 0 )      return No Intersection;

 

|(P0 – O) + t * V – (((P0 – O) + t * V) • N) * N | <= R

|(P0 – O) + t * V – ((P0 – O) • N) * N – ((t * V) • N) * N | <= R

|(P0 – O) – ((P0 – O) • N) * N + t * V - t * (V • N) * N | <= R

|((P0 – O) – ((P0 – O) • N) * N) + t * (V - (V • N) * N) | <= R

 

F = (P0 – O) – ((P0 – O) • N) * N;

G = V - (V • N) * N;

 

G^2 * t^2 + 2 * (F • G) * t + F^2 – R^2 = 0;

A = G^2;

B = 2 * (F • G);

C = F^2 – R^2;

 

if ( A > 0 )    //V is not parallel to N

{

          Δ= B^2 – 4AC;

             if ( Δ < 0 )               return No Intersection;

 

          t = (-B ± sqrt(B^2 – 4AC)) / 2A;  

 

          t1 <= t2;

 

          if ( t2 < 0 || t1 > 1 )    return No Intersection;

 

          return Intersectant;

       }

 

if ( C <= 0 )                 return Intersectant;

 

return No Intersection;

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

相关文章推荐

UE4的Collision与Physics

Collision和Physics都是各种Mesh的属性,和Unity3D很像,Collision和Physics是两个独立的Component,Collision仅仅掌管碰撞发生的检测和回调,而Ph...

Unreal Engine 4 空场景创建 并为物体添加 Collision Volumes

因为新建空场景中没有添加任何光源,为了在未添加光源之前方便查看添加到场景中的游戏物体,可以设置以下选项 调整大小做为地面 添加材质 ...

精选:深入理解 Docker 内部原理及网络配置

网络绝对是任何系统的核心,对于容器而言也是如此。Docker 作为目前最火的轻量级容器技术,有很多令人称道的功能,如 Docker 的镜像管理。然而,Docker的网络一直以来都比较薄弱,所以我们有必要深入了解Docker的网络知识,以满足更高的网络需求。

【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与重复信息识别

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

多尺度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...
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

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