Results 1 to 5 of 5

Math Help - Problem with line intersection with grid.

  1. #1
    Newbie
    Joined
    Feb 2011
    Posts
    3

    Problem with line intersection with grid.

    Yes, poorly named thread I'm sorry. One problem I'm having is that I have absolutely no idea what this is called, or even what area of math this falls under. To the best of my knowledge it falls under Trig because it deals with angles.

    Anyway, I'm a computer programmer working on something and I'm given a 3d grid. This space is infinite in two dimensions, but finite in the third. Then, I have a point in this space and a direction. One thing I kept in my mind while trying to solve this problem is that this line thing will only stop if the direction is not parallel to the dimension that is finite. Yes, wrong terminology. Chances are that the direction isn't parallel though.

    What I'm looing for is the first cube (that is, closest to the point I'm given) that this resulting line (it might be called a ray) occupies that matches a certain criteria that I'm given. To do that I'll need to check each cube to see if it matches my criteria. The only problem is that I can't figure out how to get which cubes this line occupies.

    My current method is to increment a certain distance (currently I'm using 1/10th of the size of a cube, it works well) away from the point and test if the occupied cube matches the criteria. If it doesn't increment again and repeat. The problem with this method is that if the line/ray just clips a corner of a cube, I may miss it. I know for certain there is a way to solve this without missing any cubes.

    Also, if at all possible, could i have the name of my method and the correct method so that I know what to call them?
    Last edited by Higgs1; February 21st 2011 at 07:38 PM. Reason: Added a side question.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Jan 2011
    Posts
    28
    If I am understanding what you are saying, I believe you are talking about "penetration depth". Which is by checking through increments or periodically, if something has collided with something else. Usually used in video games I believe for collision detection. And the amount of increments or the amount of times between checking influences the accuracy and results.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Feb 2011
    Posts
    3
    THank you. Is there any alternative that doesn't involve incrementing so that it doesn't miss?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Jan 2011
    Posts
    28
    @Higgs1:

    Basically, check if the line is parallel, check for which plane it will intersect and then use math to solve where the ray intersects the plane ( Intersection of Lines and Planes). That's what I would do.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Feb 2011
    Posts
    3
    Thank you, i had not thought of that. And thanks for the code too, I'm using Java but they're the same thing.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Grid problem
    Posted in the Algebra Forum
    Replies: 7
    Last Post: May 10th 2011, 03:39 AM
  2. Tricky grid joining problem
    Posted in the Advanced Math Topics Forum
    Replies: 1
    Last Post: April 9th 2010, 03:49 PM
  3. Intersection line of planes, vector geometry problem
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: March 31st 2010, 07:02 AM
  4. nxn grid problem.
    Posted in the Math Topics Forum
    Replies: 4
    Last Post: October 31st 2009, 07:00 AM
  5. Line intersection
    Posted in the Calculus Forum
    Replies: 2
    Last Post: January 27th 2008, 10:06 AM

Search Tags


/mathhelpforum @mathhelpforum