A Flash Developer Resource Site

# Thread: How to draw the normal to line

1. ## How to draw the normal to line

I have the line that slope on some angle. How I can draw normal to the end of line?

2. Not sure what you mean. Why don't you draw a picture and post it?

3. Well. How I can calculate normal vector to line?

4. A line has two normal vectors, pointing in opposite directions.

If you know the angle of the line (theta) in radians, the angles of the normal vectors are:
theta+PI/2
theta-PI/2

Or if you know the slope of the line (m), the slope of the normal line is -1/m.

5. Is there a way avoid to calculate angles? I need just normalized normal vector (i e vector that has length 1).

6. How is your line defined? Is it a line segment formed by two points?

7. Of course yes. B/c I need to draw its with Flash draw API.

8. If you points are A and B, your normals are:
<By-Ay, Ax-Bx>
<Ay-By, Bx-Ax>

9. Great thanks!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap