Click here to Skip to main content
13,663,621 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have to write down a program that takes a point in 3d as input and tells if the point is inside a 3d cone ?
Posted 21-Sep-14 19:32pm
Please, where is your problem, in middle school mathematics? Just a hint: this is a simple 2D problem.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Some more of a hint:

This is a simple 2D problem. I assume this is a cone based on a circle. Dissect the cone with the plane passing through its axis. Consider the problem in this plane. You will get two symmetric rectangles formed by this axis and intersection with the cone surface, with the common vertex. Drop perpendicular from the point in question to the axis:
 / |   *?
\  |
 \ |

The location of the point relative to the cone will be determined by the angle between the axis and the straight like connecting the vertex with this point; and the angle is defined by two catheti you can easily find out. Don't forget to consider "pathological" cases when cotangents can give you NaN, or atan2, if your library has it.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180810.1 | Last Updated 22 Sep 2014
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100