The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » k12.ed.math

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Computing line segments
Replies: 3   Last Post: Nov 8, 2004 4:58 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 4
Registered: 1/25/05
Computing line segments
Posted: Nov 4, 2004 5:39 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 e-mail to
private e-mail to the k12.ed.math moderator:
newsgroup website: <a href=""></a>
newsgroup charter: <a href=""></a>

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.