Quantcast
Channel: MATLAB Central Newsreader - tag:"arc"
Viewing all articles
Browse latest Browse all 15

Elegent 2D arc plotting given 2 points and arc angle

$
0
0
Hello,

Does anyone have an elegent method of plotting a 2D arc given two points at either end, and the angle swept out by the arc?

e.g.

p0 = [0,0];
p1 = [0,1];
theta= 2*pi;

line( [p0(1), p1(1)] , [p0(2), p1(2)] );
hold on;
plotarc(p0,p1,theta)
hold off;

would draw a semicricle, and

p0 = [0,0];
p1 = [0,1];
theta = pi;

line( [p0(1), p1(1)] , [p0(2), p1(2)] )
hold on
plotarc(p0,p1,angle)
hold off

would draw a segment of a circle the boundaries of which are a circular arc of a circle with central angle pi radians and the chord created by the line.

Hope this will pique someone's interest!

Viewing all articles
Browse latest Browse all 15

Trending Articles