Syntax
[VL,FL]=CLODofVLFL(VL,FL)
Input Parameter
VL : | | Original vertex list |
FL : | | Original facet list |
Output Parameter
VL : | | Resorted vertex list |
FL : | | Resorted facet list |
Copyright 2012-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 resort a vertex list (VL) and a facet list (FL) for a CLOD (Continuous Level of Detail) generator, ensuring compatibility with the U3D file format (ecma-363). The U3D format requires a specific order of vertices and facets, where each new facet introduces only one new vertex.
Input Parameters
- VL: Original vertex list, a matrix where each row represents a vertex with its coordinates.
- FL: Original facet list, a matrix where each row represents a facet by indexing into the vertex list.
Output Results
- VL: Resorted vertex list, reordered to meet U3D format requirements.
- FL: Resorted facet list, reordered to meet U3D format requirements.
Algorithm Steps
- Sort the facet list (FL) using the helper function
sortFL
.
- Determine the number of facets,
nFL
, using size(FL,1)
.
- Initialize a pointer
p
to 3, representing the maximum vertex index for the first row.
- Iterate over each facet in the list:
- For each facet, check if the second vertex index is greater than
p
. If so, swap the vertex indices and update the vertex list (VL) accordingly.
- Repeat the check for the third vertex index.
- Increment
p
by 1 after processing each facet.
- Sort the remaining facets starting from the current index using
sortrows
.
- Sort the facet list (FL) again using
sortFL
to ensure final order.
The algorithm ensures that the vertex and facet lists are reordered to comply with the U3D format, where each new facet introduces only one new vertex, maintaining a continuous level of detail.
Algorithm explaination created using ChatGPT on 2025-08-19 00:50. (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