Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Drew
Posts:
4
Registered:
1/25/05


Computing line segments
Posted:
Nov 4, 2004 5:39 PM


Given a point on a cartesian coordinate plane (x1, y1), a slope (m), and a length (n), how would I go about calculating the two possible points (x2, y2) and (x3, y3) that consist of the endpoints of the line segment without using trig. functions?
I know I can do this:
if (m < 0) k = arctan(m) + PI else k = arctan(m)
q = n / 2 r = q * cos(k) s = q * sin(k) x2 = x1 + r y2 = y1 + s x3 = x1  r y3 = y1  s
That gets it down to three trig. functions, two multiplies, and one divide (addition and subtraction doesn't matter). Anyone know of a way to do this that doesn't involve trig. or Newton's method? It _can_ be an approximation, but it needs to be accurate to at least 5 decimal places and computationally simple in all circumstances.
 submissions: post to k12.ed.math or email to k12math@k12groups.org private email to the k12.ed.math moderator: kemmoderator@k12groups.org newsgroup website: <a href="http://www.thinkspot.net/k12math/">http://www.thinkspot.net/k12math/</a> newsgroup charter: <a href="http://www.thinkspot.net/k12math/charter.html">http://www.thinkspot.net/k12math/charter.html</a>



