Syntax
[P,pi]=PLminyx(PL,[maxY])
Input Parameter
PL : | | Point Liste |
maxY : | | if true; we search for maximum y and maximum x |
Output Parameter
P : | | Point with minimal y and minimal x |
pi : | | find index in PL |
Examples
CPLB=CPLspiral(10,20,8*pi);
PLminyx(CPLB)
PLminyx(CPLB,true)
[~,ci]=PLminyx(CPLB); CPLB=circshift(CPLB,-(ci-1));
Copyright 2015-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, PLminyx
, is designed to find a specific point in a list of points, PL
. The point is determined based on its y and x values, either minimal or maximal, depending on the input parameters.
Input Parameters
- PL: A list of points, where each point is represented by its x and y coordinates.
- maxY (optional): A boolean flag. If set to
true
, the function searches for the point with the maximum y and x values. If false
or not provided, it searches for the point with the minimum y and x values.
Output Results
- P: The point with the desired y and x values (either minimal or maximal).
- pi: The index of the point
P
in the original list PL
.
Algorithm Steps
- Store the original list of points
PL
in PLorg
.
- Round the coordinates in
PL
to 5 decimal places for precision.
- Extract only the first two columns of
PL
, assuming these are the x and y coordinates.
- Initialize
maxY
to false
. If a second argument is provided and is not empty, set maxY
to the value of this argument.
- Based on the value of
maxY
:
- If
maxY
is false
, find the minimum y value in PL
. Then, find the minimum x value among the points with this y value.
- If
maxY
is true
, find the maximum y value in PL
. Then, find the maximum x value among the points with this y value.
- Set
P
to the point with the determined x and y values.
- Find the index
k
of this point in the original list PLorg
.
- If no output is requested, plot the points using
SGfigure
and highlight the found point.
Algorithm explaination created using ChatGPT on 2025-08-19 00:38. (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