**News Alert:**Experts Exchange Confirmed as Safe in Cloudbleed Leak Read More

Solved

Posted on 2011-03-02

Hi everyone,

I'm new to this forum and new to Java 3d. I've been trying to solve my problem for days but I can't find a solution! I am creating a mind map(like a graph) and I have problem with intersection. I use spheres for the nodes and cylinders as the links between them. I have a function where it calculates the position of the node(each node can have 18 children around it) and how to position the cylinder(edge). I have added boundingspheres to the nodes to check for intersections and it works fine but I'm trying to add boundingboxes to the links and get the wrong results. Can anyone tell me how to add a boundingbox around a cylinder? Oh I have to check for intersections before I add the nodes and links to the scene so I have to check the boundingbox depending on the position that the cylinder will have afterwards... I hope I make sense...

I'm new to this forum and new to Java 3d. I've been trying to solve my problem for days but I can't find a solution! I am creating a mind map(like a graph) and I have problem with intersection. I use spheres for the nodes and cylinders as the links between them. I have a function where it calculates the position of the node(each node can have 18 children around it) and how to position the cylinder(edge). I have added boundingspheres to the nodes to check for intersections and it works fine but I'm trying to add boundingboxes to the links and get the wrong results. Can anyone tell me how to add a boundingbox around a cylinder? Oh I have to check for intersections before I add the nodes and links to the scene so I have to check the boundingbox depending on the position that the cylinder will have afterwards... I hope I make sense...

2 Comments

Cylinder-sphere

------------------------

Let the cylinder start at x, be of radius r, length L, direction d.

Let the sphere be at o, radius R.

Find the shortest distance between the point o and the line x+t*d, as outlined here:

http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html

Then if the shortest distance is greater than (r+R) then they do NOT intersect.

Otherwise, if the closest point is for t<L, then they DO intersect.

Cylinder-cylinder

-------------------------

Exactly the same concept.

Suppose cylinder A begins at x_A, is of length L_A, has radius r_A, and points in the direction d_A.

Similarly for cylinder B.

Then compute the shortest distance between the axes of each cylinder, as explained here:

http://www.softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm (It's just one equation)

Is this distance greater than (r_A+r_B)? If so, then they do NOT intersect.

Otherwise, suppose the point on the axis of A which is closest to the axis of B is x_A+t*d_A, where t is a parameter. Then if t<L then the cylinders DO intersect.

Does that make sense?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

allswap challenge | 6 | 99 | |

VB Script to add site to Java Exception List | 4 | 78 | |

Is Applet the way to go for my drag and drop system? | 8 | 14 | |

Selenium docs api java index | 3 | 14 |

Join the community of 500,000 technology professionals and ask your questions.