by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - PL/Point Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-04-19, Last change: 2025-09-14
See Also: PLcircle
, PLcircleoval
[PLR,PLL]=PLcirclearc(cp,A,B,[])
cp: | center point or radius (+/-) | |
A: | point A or angle w1 | |
B: | point B or angle w2 |
PLR: | Right hand arc starting at A (red) | |
PLL: | Left hand arc starting at B (green) |
PLcirclearc([10 10],[10 11],[9 10])
[PLX,PLY]=PLcirclearc(10,[10 0],[0 0]); cla; PLplot(PLX); shg
[PLX,PLY]=PLcirclearc(-10,[10 0],[0 0]); shg; PLplot(PLY,'g-'); shg
This function, PLcirclearc, calculates two circle arcs between two points on a circle, following the right-hand rule. It is part of the SolidGeometry library.
cp is a scalar, it is treated as the radius (R). The midpoint m between A and B is calculated, and the vector eab from A to B is determined.e1 is derived from eab, and o1 is the perpendicular vector to e1.w is calculated as half the angle subtended by A and B at the circle's center, and d is the distance from m to the center point cp.cp is recalculated using m, d, and o1.e1 and e2 are calculated from cp to A and B, respectively.R is determined from the norm of e1.cp.w1 and w2 are calculated using atan2 for vectors e1 and e2.w1 and w2 to ensure they are positive and w2 is greater than w1.PLR using the function PLcircle with parameters R, w2-w1, and w1, then add cp.PLL by flipping the result of PLcircle with parameters R, w1-w2+2*pi, and w2, then add cp.SGfigure and PLplot, with annotations for PLR and PLL.