3d point in cone angle
Community Forums/General Help/3d point in cone angle
| ||
Hello, i'm facing a geometry problem that I can't solve. I have a missile with a radar cone and I want to check if the target is inside or outside the cone. The cone is simply defined by a radius angle from the missile. Using TFormPoint I have the coordinates of the target relative to the missile and I can calculate the true pitch and yaw differences with Atan. Here for example the circle represents the cone and is about 30° in radius. I can't find the maths from what I have... I won't use a camera so no CameraProject. |
| ||
You have the x,y,z coordinates of the target in "missile space". First do a reality check. If z <= 0 then the target is not in front of the missile so it can't be in the cone. Then calculate the distance from the cone axis to the target, d = Sqr( x*x + y*y ). d/z is the tangent of the angle the target makes with the cone axis. The target is in the cone if d/z <= Tan( cone angle ) i.e. Tan( 30 ) in your example. |
| ||
Thank you Floyd, it works perfectly ! Every time I have trouble with pythagore in 3D :/ |