1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Intersection of two cubes.

  1. Jun 28, 2009 #1
    hi,

    I need to find the points of intersection between two cubes, and the algorithm should give the intersection points even though my cubes are rotated in any direction. i need to know, Is there any general algorithm for this and what is the current research(any method) in finding the intersection of two cubes. the application where i am using is unstructured 3d mesh generation. Kindly help me to get a clear idea in this topic.
    thanks in advance for your reply..:smile:
     
  2. jcsd
  3. Jun 28, 2009 #2
    I don't understand question.

    Two cubes could intersect along a point, line, plane, or solid.

    So you want a computer program that does this? What language? For what purpose?
     
  4. Jun 28, 2009 #3
    hey thanks for your quick reply. I mean two cubes are placed one over another, an we need to find the points of intersection. the algorithm i need is, it should be able to get the intersection points though my cubes are rotated in any direction. I will use it for unstructured 3d cartesian mesh generation. you can have you program in Fortran or C++. Thanks in advance.
     
  5. Jun 28, 2009 #4
    What are on earth are you talking about man?

    You'll need to use far more precise language than "placed one over another."

    A picture is worth a 1,000 words.
     
  6. Jun 28, 2009 #5
    Imagine there are 2 cubes of same finite dimension. Example from 0 to 1 in all three axis. place the first cube with the origin (0,0,0), and place the second cube with the origin (0.5,0.5,0.5). So now both the cubes will get intersected with each other. I need to get the points where the edges of the cubes crosses the outer surface, we get six locations. (just think in 2d to get more clear). Still find problem in my question have ur post.
     
  7. Jun 29, 2009 #6

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    A 'cube' type thing is just described by a1<=x<=a2, b1<=y<=b2, c1<=z<=c2. To intersect two of them just figure out how to intersect two segments in each of the coordinate axes.
     
    Last edited: Jun 29, 2009
  8. Jun 29, 2009 #7
    more clear plz. any one.
     
  9. Jun 29, 2009 #8

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    Cube of edge length 1 at origin (0,0,0), described by -1/2<=x<=1/2 etc. Same at origin (1/2,1/2,1/2) described by 0<=x<=1, etc. Intersection, 0<=x<=1/2, etc.
     
  10. Jun 29, 2009 #9
    hi dick & clustro

    1) I think from the attached figure you will be able to get my question.

    2) the red lines in one cube will cut the outer surface of other cube. I need to find the location where the edge(red line) cuts the outer face.(six points will occur! am i rite). Is there any algorithm used for this. and what are the ways it can be done.

    3)the algorithm should be more general way where any degree rotation should give me the intersection points. I tried a way where my algorithm fails to locate the points if other cube is rotated more than 90 degree..

    thanks in advance...........
     

    Attached Files:

  11. Jun 29, 2009 #10
    Just break it up into a finite 3-d grid, and for each cube, decide which grid cubes are filled by the larger cube. Then see which grid-cubes are filled by each of the larger cubes simultaneously, and keep these. This is the intersection.

    This method does not offer infinite precision, but it is general and will offer a (relativelty) arbitrary precision.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Intersection of two cubes.
Loading...