Welcome to Blogs @ Andrew Qu
Blog Index
All blogs
Search results

Approximate an Arc by Line Segments

Summary

Given an arc with known center, start and end point, get a series of line segments to approximate the arc.

The Question

Given a 2D arc with arc center point c, start point s and end point e, find a series of line segments to approximate the arc. The arc's sweep angle < 180. The minimum number of required line segments is also given.

The Solution

  • Find mid point of line s-e. This is point m
  • Find vector v from c to m
  • Translate point c along vector v by radius to get point A1
  • The arc is approximated by line segments s-A1 and A1-e in this step.
For the 2 new arcs, repeat the same process to get point A2 and A3. This gives line segments s-A2, A2-A1, A1-A3, A3-e.

Repeat this process until the required number of segments is met.
Main Advantages
  • Arcs can be in 3D without needing to calculate angles and worry about the arc direction
  • Does not use expensive sin() and cos() functions, thus high performance.
Ads from Google
Dr Li Anchor Profi
www.anchorprofi.de
Engineering anchorage plate design system
©Andrew Qu, 2015. All rights reserved. Code snippets may be used "AS IS" without any kind of warranty. DIY tips may be followed at your own risk.