Thread: Detecting an object is inside / intersecting a conic area with elliptical base.

  1. #16
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Quote Originally Posted by iMalc View Post
    As long as the cone is pointed along the z axis then you should just be able to divide the x and y values by their z. Where z < 1 it'll make the x & y values wider and where z > 1 (and z > -1) it'll make them narrower, result being that the cone becomes a cylinder, then you can throw away the z.
    Of course it'll fail where z = 0, which is where the two doublecones meet at a point, so you have to check for that also.
    I'm ashamed to say this but, I don't have the slightest clue.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  2. #17
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Here's is a doublecone: File:DoubleCone.png - Wikipedia, the free encyclopedia
    In this instance the up arrow is the Z-axis.
    To transform a point (x, y, z) into a clyinder, you use (x/z, y/z, z) although you can then ignore the z and just treat it as (x/z, y/z)

    However, thinking about it a little more, you're probably better off just skipping that step altogether and using the whole point in cone test. This has the advantage of not dividing by zero.
    So instead just check for x*x + y*y < z*z for each point after having applied the transformation matrix.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #18
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Seems like I will be using the circle based one from my first post because we will be pushing for other features first. Thanks alot though, guys. Maybe I'll come back again after it's less hectic here. I'll make a new thread instead of using this one though, so don't worry about pushing up old junks. :P

    Again, thank you very much.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting path to shared object
    By dev.fb0 in forum Linux Programming
    Replies: 5
    Last Post: 04-07-2011, 04:48 PM
  2. delete object from inside object
    By Drogin in forum C++ Programming
    Replies: 10
    Last Post: 01-02-2009, 08:55 PM
  3. Replies: 2
    Last Post: 05-21-2008, 10:40 PM
  4. elliptical button
    By geek@02 in forum Windows Programming
    Replies: 0
    Last Post: 11-21-2006, 02:15 AM
  5. Replies: 3
    Last Post: 02-12-2002, 10:09 PM