www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2013/08/19/13:16:26

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Message-ID: <521252B5.90506@buffalo.edu>
Date: Mon, 19 Aug 2013 13:15:33 -0400
From: "Stephen R. Besch" <sbesch AT buffalo DOT edu>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8
MIME-Version: 1.0
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] Dead link in the wiki pages.
References: <520F9550 DOT 5030700 AT iae DOT nl> <CANqhZFyA7vtu_+5ZosJH5q2Y+y+rSqewfUBoxrGkhzrMqL7B5A AT mail DOT gmail DOT com> <1376774043 DOT 3434 DOT 8 DOT camel AT AMD64X2 DOT fritz DOT box> <CANqhZFzN3b8PJjgCKiRrb-f7H5xRKMw-F_5nyDqdh292m6KLcA AT mail DOT gmail DOT com> <1376861024 DOT 3598 DOT 24 DOT camel AT AMD64X2 DOT fritz DOT box>
In-Reply-To: <1376861024.3598.24.camel@AMD64X2.fritz.box>
X-PM-EL-Spam-Prob: X: 10%
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r7JHFllQ000305
Reply-To: geda-user AT delorie DOT com

On 08/18/2013 05:23 PM, Stefan Salewski wrote:
> On Sun, 2013-08-18 at 20:58 +0100, Gareth Edwards wrote:
> Yes, my statement may be a bit harsh -- but all the garbage in the
> Internet makes me really some sort of angry. Most of the time Google
> does a good job to skip all that dirt, but more and more often it fails.
> It is my impression that the volume of junk increases much faster now
> than the valuable content -- in the end the whole internet will become a
> large heap of garbage. Wikipedia may be left of the only reliable source
> of information. Recently I was looking for the formula for intersection
> of two line segments -- tried one promising google hit:
>
> http://cboard.cprogramming.com/c-programming/154196-check-if-two-line-segments-intersect.html
>
> It is wrong -- I contacted the original author, that forum thread was
> closed, so he was not able to correct it. One hour wasted of my time.
>
> I just checked the exact meaning of 'simple minded' at www.leo.org, one
> translation is the german word "einfältig", which is indeed harsh. But
> currently I have not really a more adequate term available in my head --
> guess I am too simple minded.
>
Gareth,

There's a lesson in there somewhere. If you are going to rely on the 
internet for an education in basic algebra, I suspect that you will more 
often than not get what you pay for. It is almost always better to do 
your own math and avoid both the problems with others poor math skills 
as well as their poor programming skills. By the way, for simple 
straight line segments, just write 2 linear equations with a common "x" 
and find the intersection. It is then a simple thing to ascertain if the 
intersection is bounded by the line's endpoints. To wit, take the 2 lines:

     Y1=m1x+b1 and Y2=m2x+b2.

Calculate the slopes (m) and intercepts (b) from the endpoints.  The 
value of x that gives the same value of Y for both line is by definition 
the intersection. So set these 2 equal and solve for "x". You should get 
something like:

     x=(b2-b1)/(m1-m2)

This is the "x" value of the intersection.  Then you can use either 
line's equation to calculate  the corresponding value of "y" at the 
intersection. Note that you can do exactly the same with curves that are 
defined with a quadratic. You just have to solve for x using the 
standard quadratic solution:

     x=(-b+- sqrt (b^2-4ac))/2a

Just remember that you will get 2 solutions (one may be imaginary) and 
you will need to figure out how to decide which one is relevant. Higher 
order curves - other than cubics - have no closed form solutions and 
intersection will need to be determined numerically.

-- fictio cedit veritati

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019