# I want to find out points whose coordinates are within the volume formed by a cone shape.

조회 수: 14(최근 30일)
Tamoor Shafique 2022년 4월 27일
편집: Matt J 2022년 4월 28일
Hello,
I have plotted few points in a 3D volume as shown in the figure below:
I want to plot a 3D righ Cone from a few specefic points as shown:
These cones are 3D volumes and I want to find out points whose coordinates are within each cone. for example which point is within yello cone and which one in red and which one in purple cone.
Can some one help?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Bruno Luong 2022년 4월 28일
편집: Bruno Luong 2022년 4월 28일
Assuming
• the cone center is C: (3 x 1)
• coneangle is the cone angle (0 to pi, pi corresponds to the extreme case where the cone takes the whole space)
• the cone axis is N: (3 x 1), oriented toward the direction you consider to be in
• Point P: (3 x 1) the point coordinates to be check
Check inside the half of the cone is
dot(P-C, N) >= cos(coneangle/2) * norm(N) * norm(P-C)
You can compute once
cos(coneangle/2) * norm(N)
if you have many points P to check.
##### 댓글 수: 3표시숨기기 이전 댓글 수: 2
Tamoor Shafique 2022년 4월 28일
I got it. sorry for being so dumb.
Thank you very much and much appreciated.
I have resolved this problem

댓글을 달려면 로그인하십시오.

### 추가 답변(1개)

Matt J 2022년 4월 27일
Draw a vector from the cone vertex to the point and compute the angle of this vector to the cone's axis. If the angle is less than the angular width of the cone, then the point is inside the cone. This assumes that the cone is not of finite length.
##### 댓글 수: 4표시숨기기 이전 댓글 수: 3
Matt J 2022년 4월 28일
What are the geometric meanings of r,h,phi,theta,offset?

댓글을 달려면 로그인하십시오.

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by