Syntax
FL=FLorder(FL)
Input Parameter
Output Parameter
Examples
FL=[10 20 30; 30 10 20; 20 30 10]
FL=[FL*1.5;FL]
FLorder(FL)
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 algorithm is designed to process a facet list (FL) by rotating and sorting it. The goal is to ensure that each row in the facet list is ordered such that the smallest vertex index is in the first column, and the entire list is sorted in ascending order based on the vertex indices.
Input Parameters
- FL: The original facet list, which is a matrix where each row represents a facet with three vertex indices.
Output Results
- FL: The final, ordered facet list.
Algorithm Steps
- For each row in the facet list, check if the first vertex index is greater than the second. If true, rotate the row so that the second index becomes the first, the third becomes the second, and the first becomes the third. This is done using the operation:
FL(FL(:,1)>FL(:,2),:)=FL(FL(:,1)>FL(:,2),[2 3 1]);
- Repeat the check for the first vertex index against the third. If the first index is greater than the third, rotate the row similarly:
FL(FL(:,1)>FL(:,3),:)=FL(FL(:,1)>FL(:,3),[3 1 2]);
- Perform the first check again to ensure all rows are correctly rotated:
FL(FL(:,1)>FL(:,2),:)=FL(FL(:,1)>FL(:,2),[2 3 1]);
- Sort the entire facet list in ascending order based on the vertex indices using the
sortrows
function: FL=sortrows(FL);
Example
Given a facet list FL = [10 20 30; 30 10 20; 20 30 10]
, the algorithm will process it to ensure each row is ordered with the smallest index first and then sort the entire list. The result will be a sorted and ordered facet list.
Algorithm explaination created using ChatGPT on 2025-08-18 23:11. (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