PLminangle

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 3.9, Creation date: 2017-05-31, Last change: 2025-09-14

returns the point with minimal angle value wrt to the center of the contour



See Also: PLminyx , PLminxy

Example Illustration

 missing image of PLminangle(PL,in0,C,at)

Syntax

[P,pin,AL,DL,C]=PLminangle(PL,[in0,C,at])

Input Parameter

PL: Point Liste
in0: false=[-pi..+pi]; true=[0..2*pi]; default is false
C: optional center point
at: angle threshold; default is pi/100

Output Parameter

P: Point with minimal y and minimal x
pin: find index in PL
AL: Angle list
DL: Distance from Center List
C: Center Point

Examples


PLminangle(CPLspiral(10,20,8*pi))
PLminabgle(CPLspiral(10,20,8*pi),true)
PLminangle(CPLspiral(10,20,8*pi),true,[0 0])
[~,ci]=PLminyx(CPLB); CPLB=circshift(CPLB,-(ci-1));




Copyright 2017-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)

The function PLminangle is designed to find the point in a list of points (PL) that has the minimal angle with respect to a specified center point. It also returns the index of this point, a list of angles, distances from the center, and the center point itself.

Input Parameters

Output Results

Algorithm Steps

  1. Check if the point list PL contains more than one contour using separateNaN. If it does, an error is raised.
  2. Set default values for in0, C, and at if they are not provided in the input.
  3. Calculate the difference DL between each point in PL and the center C.
  4. Compute the angle list AL using the atan2 function and round it by the angle threshold at.
  5. If in0 is true, adjust negative angles by adding 2*pi.
  6. Normalize the distances DL using PLnorm.
  7. Sort the points by angle and distance, and find the index pin of the point with the minimal angle.
  8. Return the point P at index pin from the point list PL.
  9. If no output is requested, plot the points, highlighting the point with the minimal angle.
Algorithm explaination created using ChatGPT on 2025-08-19 08:20. (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