如何在3D空间中检测点是否在圆锥内部? [英] How can I detect if a point is inside a cone or not, in 3D space?

查看:380
本文介绍了如何在3D空间中检测点是否在圆锥内部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测3D点是否在锥体内?

  Ross cone =(x1,y1,h1)
锥角= alpha
锥高= H
锥形半径= R
锥形点的坐标= P1(x2,y2,h2)
锥形外的坐标= P2(x3,y3,h3)

point1 = true的结果
point2的结果= false


方案

要扩展Ignacio的答案:



  x =锥体的尖端
dir =归一化轴向量,从尖端指向基础
h = height
r =基本半径

p =指向测试

所以你的项目 p dir 以找到点沿着轴的距离:

  cone_dist =点(p-x,dir)

此时,您可以拒绝<$ c $然后你计算沿着该点的那个点的圆锥半径:

  cone_radius =(cone_dist / h)* r 

最后计算点与轴相对锥体半径的正交距离:

  orth_distance = length((p-x)-conce_dist * dir)

is_point_inside_cone =(orth_distance< cone_radius)


How is possible to detect if a 3D point is inside a cone or not?

Ross cone = (x1, y1, h1)
Cone angle = alpha
Height of the cone = H
Cone radius = R
Coordinates of the point of the cone = P1 (x2, y2, h2)
Coordinates outside the cone = P2( x3, y3, h3)

Result for point1 = true
Result for point2 = false

解决方案

To expand on Ignacio's answer:

Let

x = the tip of the cone
dir = the normalized axis vector, pointing from the tip to the base
h = height
r = base radius

p = point to test

So you project p onto dir to find the point's distance along the axis:

cone_dist = dot(p - x, dir)

At this point, you can reject values outside 0 <= cone_dist <= h.

Then you calculate the cone radius at that point along the axis:

cone_radius = (cone_dist / h) * r

And finally calculate the point's orthogonal distance from the axis to compare against the cone radius:

orth_distance = length((p - x) - cone_dist * dir)

is_point_inside_cone = (orth_distance < cone_radius)

这篇关于如何在3D空间中检测点是否在圆锥内部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆