View Question
Q: Height and Width of Similar Right Triangles ( Answered ,   4 Comments )
 Question
 Subject: Height and Width of Similar Right Triangles Category: Computers > Algorithms Asked by: bongobud-ga List Price: \$5.00 Posted: 26 Oct 2006 20:52 PDT Expires: 25 Nov 2006 19:52 PST Question ID: 777319
 ```I have an angled line from x1,y1 to x2,y2. From the x and y differences, I can derive a right triangle, and then with the pythagorean theorem, get the length of the line. Now, I have to shorten the line to a random length between 0 and it's original length, keeping the angle the same and keeping x1,y1 the same. How do I determine the coordinates of the new x2,y2. Something I can easily translate into Perl would be useful. I'm currently searching for the answer, so answer fast.```
 Subject: Re: Height and Width of Similar Right Triangles Answered By: efn-ga on 26 Oct 2006 22:04 PDT Rated:
 ```Hi bongobud, We can calculate this using the theorem that the corresponding sides of similar triangles are proportional. Let's start with a few definitions. Let e1 be the distance between (x1, y1) and (x2, y2). Let e2 be the shortened distance. Let (x3, y3) be the coordinates you seek, the other end of the shortened line from (x1, y1). The length of the horizontal side of the original triangle is (x2 - x1). The proportion of shortening is (e2 / e1). So according to the theorem, the length of the horizontal side of the reduced triangle is ((x2 - x1) * (e2 / e1)). x3 is located this length past x1, so x3 = x1 + ((x2 - x1) * (e2 / e1)). Similarly, the length of the vertical side of the original triangle is (y2 - y1), the length of the vertical side of the reduced triangle is ((y2 - y1) * (e2 / e1)), and y3 = y1 + ((y2 - y1) * (e2 / e1)). Additional Links A few pages that state that the corresponding sides of similar triangles are proportional: Euclid's Elements, Book VI, Proposition 19 http://aleph0.clarku.edu/~djoyce/java/elements/bookVI/propVI19.html Similar triangles on everything2.com http://www.everything2.com/index.pl?node=Similar%20triangles Tim's Triangular Page http://sakharov.net/triangle.html This should be reasonably easy to code in Perl. If you need any more help with this, please feel free to ask for a clarification. Regards, --efn```
 bongobud-ga rated this answer: ```Expressed in overly complex. Could have been described in a couple of quick sentences.```

 ```shame on you, efn, for wasting bongobud's valuable time like that. -cab```
 ```Well Bongobud, if the answer could have been expressed in a couple of quick sentences, perhaps you should have done so and saved yourself \$5```
 ```I count 11 sentences not including the links totalling 105 words. Two sentences (22 words) are introductory and three (25 words) are definition. So there are six sentences containing 58 words (plus math expressions) to answer your question. If we remove all instances of "the," and the one each of "so," and "similarly," meaning is not lost and the word count drops by 15 to 43 words. Is this the overly complex expressing to which you refer, Bongobud?```
 ```I'm thinking someone didn't understand the rather brilliant way the question was answered. Perhaps he should not have asked a question he was not able to comprehend the answer to. usrhlp```