By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

Lines crossing

P: n/a
I'm drawing points and lines in a picturebox control in visual basic .Net,
and i need to know the point() where those lines "cross" each other. That
would be easy if the lines where only vertical and horizontal because i could
try to find the pixels that would be used between two point to draw the lines
and see if there is a common pixel for those two lines but if the line(s) is
diagonal i can't determine the point where the lines meet each other
Is there anyway in vb .net to find the point where two lines meet each other?

\
\ /
\/
/\
/ \
/ \
\
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ricardo,
Try to run a scanline down in your picturebox and check how many pixels are
used in each scanline.
If the number of pixels used in the curent scanline drops to 1 (from 2 on
the last scanline) then you know this is where the 2 lines cross. Just an
idea.
Stanav.

"Ricardo Furtado" <Ri************@discussions.microsoft.com> wrote in
message news:C9**********************************@microsof t.com...
I'm drawing points and lines in a picturebox control in visual basic .Net,
and i need to know the point() where those lines "cross" each other. That
would be easy if the lines where only vertical and horizontal because i
could
try to find the pixels that would be used between two point to draw the
lines
and see if there is a common pixel for those two lines but if the line(s)
is
diagonal i can't determine the point where the lines meet each other
Is there anyway in vb .net to find the point where two lines meet each
other?

\
\ /
\/
/\
/ \
/ \
\

Nov 21 '05 #2

P: n/a
Get a math book and look up the formula for finding the intersection of two
lines in two dimensional space. You have the start coord and end coord for
both lines since you have drawn them so it should be easy to find the
intersection of two lines.
--
Dennis in Houston
"Ricardo Furtado" wrote:
I'm drawing points and lines in a picturebox control in visual basic .Net,
and i need to know the point() where those lines "cross" each other. That
would be easy if the lines where only vertical and horizontal because i could
try to find the pixels that would be used between two point to draw the lines
and see if there is a common pixel for those two lines but if the line(s) is
diagonal i can't determine the point where the lines meet each other
Is there anyway in vb .net to find the point where two lines meet each other?

\
\ /
\/
/\
/ \
/ \
\

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.