Click here to Skip to main content
15,898,588 members
Home / Discussions / C#
   

C#

 
QuestionLine Segments [modified] Pin
Jim Warburton26-Nov-07 5:13
Jim Warburton26-Nov-07 5:13 
AnswerRe: Line Segments Pin
Skippums26-Nov-07 7:03
Skippums26-Nov-07 7:03 
GeneralRe: Line Segments Pin
Jim Warburton26-Nov-07 8:10
Jim Warburton26-Nov-07 8:10 
GeneralRe: Line Segments Pin
Skippums26-Nov-07 9:56
Skippums26-Nov-07 9:56 
GeneralRe: Line Segments Pin
Jim Warburton29-Nov-07 4:23
Jim Warburton29-Nov-07 4:23 
AnswerRe: Line Segments Pin
Luc Pattyn26-Nov-07 7:10
sitebuilderLuc Pattyn26-Nov-07 7:10 
GeneralRe: Line Segments Pin
Jim Warburton26-Nov-07 7:57
Jim Warburton26-Nov-07 7:57 
GeneralRe: Line Segments Pin
Luc Pattyn26-Nov-07 8:32
sitebuilderLuc Pattyn26-Nov-07 8:32 
Can't you live with just the square of length, skipping the sqrt all together?

Furthermore, you're looking for a zero angle, that should be inexpensive.

In two dimensions, I don't think I need any length:

the line defined by points (x1,y1) and (x2,y2)
may connect to the line defined by points (x3,y3) and (x4,y4) if:

- the two lines have the same orientation and origin
- the end points of the line segments are such that they touch or overlap

orientation and origin can easily be tested based on the line's equation:

(y - y1) * (x2 - x1) = (x - x1) * (y2 - y1)

so this equation must hold for x=x3,y=y3 as well as for x=x4,y=y4

Adding a third dimension adds one more equation (say with z and x)

Hope this helps.


Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets


GeneralRe: Line Segments Pin
Jim Warburton26-Nov-07 8:59
Jim Warburton26-Nov-07 8:59 
QuestionHow to know which tree view node on master page is clicked on the form level Pin
ss.mmm26-Nov-07 5:09
ss.mmm26-Nov-07 5:09 
AnswerRe: How to know which tree view node on master page is clicked on the form level Pin
SABhatti26-Nov-07 8:53
SABhatti26-Nov-07 8:53 
QuestionUpdating controls from non-gui thread. Pin
Rob Philpott26-Nov-07 5:09
Rob Philpott26-Nov-07 5:09 
AnswerRe: Updating controls from non-gui thread. Pin
m@u26-Nov-07 5:21
m@u26-Nov-07 5:21 
GeneralRe: Updating controls from non-gui thread. Pin
Rob Philpott26-Nov-07 5:25
Rob Philpott26-Nov-07 5:25 
GeneralRe: Updating controls from non-gui thread. Pin
m@u26-Nov-07 5:38
m@u26-Nov-07 5:38 
AnswerRe: Updating controls from non-gui thread. Pin
Luc Pattyn26-Nov-07 6:23
sitebuilderLuc Pattyn26-Nov-07 6:23 
QuestionInserting into excel from C# Pin
GreekTreat26-Nov-07 5:06
GreekTreat26-Nov-07 5:06 
AnswerRe: Inserting into excel from C# Pin
GuyThiebaut26-Nov-07 5:16
professionalGuyThiebaut26-Nov-07 5:16 
GeneralRe: Inserting into excel from C# Pin
GreekTreat26-Nov-07 5:23
GreekTreat26-Nov-07 5:23 
AnswerRe: Inserting into excel from C# Pin
Aftab Sindhi26-Nov-07 5:23
Aftab Sindhi26-Nov-07 5:23 
QuestionArray Property Pin
papy-boom26-Nov-07 4:26
papy-boom26-Nov-07 4:26 
AnswerRe: Array Property Pin
Rob Philpott26-Nov-07 4:50
Rob Philpott26-Nov-07 4:50 
AnswerRe: Array Property Pin
Ravi Bhavnani26-Nov-07 5:15
professionalRavi Bhavnani26-Nov-07 5:15 
Questionhow to read particular data from xml file Pin
sivaramireddy p26-Nov-07 4:13
sivaramireddy p26-Nov-07 4:13 
AnswerRe: how to read particular data from xml file Pin
SABhatti26-Nov-07 4:23
SABhatti26-Nov-07 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.