Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Algorithms > Re: fast algori...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 11 Topic 669 of 680
Post > Topic >>

Re: fast algorithm for detecting all Intersections of multiple

by IsaacKuo <mechdan@[EMAIL PROTECTED] > Apr 2, 2008 at 09:25 AM

On Apr 2, 10:15=A0am, Miss Elaine Eos <M...@[EMAIL PROTECTED]
>
wrote:
> In article <65h402F2fkqt...@[EMAIL PROTECTED]
>,
> =A0"Jens Hilwig" <jhil...@[EMAIL PROTECTED]
> wrote:

> > Im looking for a fast =A0algorithm for detecting all Intersections of
mu=
ltiple
> > linesegments.(only linesegments nothing else)

What do you need this for?  Assuming you're using doubles, then
generally line segments don't interesect at all (except for line
segments
which share an endpoint, or which are coplanar on a plane normal to a
coordinate axis).  The probability of exactly intersecting lines is
low.

For a typical application, what you'd really need is to determine
whether two line segments are "close enough" to each other.

> > In 2D there is a fast sweep line algorithm by Bentley-Ottmann but I
did =
not
> > found a fast alogorithm for the 3D space.
> > Can you help me ?

> Same algorithm, modify for 3 dimensions.

> Example of modifying 2D to 3D:

> =A0 =A0dist2D =3D sqrt ((dx * dx) + (dy * dy))
> =A0 =A0dist3D =3D sqrt ((dx * dx) + (dy * dy) + (dz * dz))

Does not even make sense, much less work.

However, Bentley-Ottmann is a good start.  First, you use Bentley-
Ottmann
while ignoring the Z dimension to determine candidate intersections.
Then
you calculate the distance between the lines of the candidates to
determine
whether they are "close enough".

The distance between two line segments is calculated by first
determining the unit normal.  Do this by calculating the cross
product of the line segment vectors, and normalize to a length
of one.  This gives you a unit vector which is perpendicular to
both of the line segments.  Then, take the difference between
two points of either line (i.e. take either endpoint of each line
segment), and dot product it with that unit normal.  The
absolute value of this dot product is the distance between the
two lines.  If that value is less then "epsilon", your arbitrary
value for "close enough", then the line segments intersect.

Isaac Kuo
 




 11 Posts in Topic:
fast algorithm for detecting all Intersections of multiple lines
"Jens Hilwig" &  2008-04-02 12:03:45 
Re: fast algorithm for detecting all Intersections of multiple l
Miss Elaine Eos <Misc@  2008-04-02 15:15:02 
Re: fast algorithm for detecting all Intersections of multiple
IsaacKuo <mechdan@[EMA  2008-04-02 09:25:05 
Re: fast algorithm for detecting all Intersections of multiple
Geoffrey Summerhayes <  2008-04-02 10:50:19 
Re: fast algorithm for detecting all Intersections of multiple
IsaacKuo <mechdan@[EMA  2008-04-02 11:08:11 
Re: fast algorithm for detecting all Intersections of multiple
Geoffrey Summerhayes <  2008-04-02 12:04:50 
Re: fast algorithm for detecting all Intersections of multiple l
John Nagle <nagle@[EMA  2008-04-03 23:33:11 
Re: fast algorithm for detecting all Intersections of multiple l
"Jens Hilwig" &  2008-04-04 09:25:41 
Re: fast algorithm for detecting all Intersections of multiple l
John Nagle <nagle@[EMA  2008-04-09 17:49:22 
Re: fast algorithm for detecting all Intersections of multiple
IsaacKuo <mechdan@[EMA  2008-04-04 07:14:42 
Re: fast algorithm for detecting all Intersections of multiple l
Miss Elaine Eos <Misc@  2008-04-04 14:49:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:10:45 CDT 2008.