PLcirclearc

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

returns an circle arc between two circle points in right hand rule



See Also: PLcircle , PLcircleoval

Example Illustration

 missing image of PLcirclearc(cp,A,B,)

Syntax

[PLR,PLL]=PLcirclearc(cp,A,B,[])

Input Parameter

cp: center point or radius (+/-)
A: point A or angle w1
B: point B or angle w2

Output Parameter

PLR: Right hand arc starting at A (red)
PLL: Left hand arc starting at B (green)

Examples


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




Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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.

Input Parameters

Output Results

Algorithm Steps

  1. If 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.
  2. The unit vector e1 is derived from eab, and o1 is the perpendicular vector to e1.
  3. The angle 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.
  4. The center point cp is recalculated using m, d, and o1.
  5. Vectors e1 and e2 are calculated from cp to A and B, respectively.
  6. The radius R is determined from the norm of e1.
  7. An error is raised if A and B are not equidistant from cp.
  8. Angles w1 and w2 are calculated using atan2 for vectors e1 and e2.
  9. Adjust w1 and w2 to ensure they are positive and w2 is greater than w1.
  10. Calculate the right-hand arc PLR using the function PLcircle with parameters R, w2-w1, and w1, then add cp.
  11. Calculate the left-hand arc PLL by flipping the result of PLcircle with parameters R, w1-w2+2*pi, and w2, then add cp.
  12. If no output is specified, plot the points and arcs using SGfigure and PLplot, with annotations for PLR and PLL.
Algorithm explaination created using ChatGPT on 2025-08-19 08:17. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21