h=patchofSG(SG,[realp])
SG : | Soldid Geometry; | |
realp : | true=real patch; default is false |
h : | handle to patch struct or patch class |
a=patchofSG(SGsample(17))
a=patchofSG(SGsample(17),true)
The function patchofSG
is designed to create a patch structure from a solid geometry (SG). It is part of the SG-Library and was developed by Tim Lueth. The function can handle both individual solid geometries and cells of solids, returning a list of patches.
The function begins by setting the default value of realp
to false. It checks if the number of input arguments is greater than or equal to 2 and if the second argument is not empty. If both conditions are met, it assigns the value of the second argument to realp
.
The function then checks if SG
is a cell array. If it is, it initializes an empty array h
and iterates over each element in the cell array. For each element, it calls patchofSG
recursively with the separated solid geometry and the visibility parameter vis
. The results are concatenated into h
.
If SG
is not a cell array, the function assigns the face list SG.FL
to h.Faces
and the vertex list SG.VL
to h.Vertices
. If realp
is true, it creates a patch using the structure h
.
There is a commented-out section that, if enabled, would create a figure and set the visibility of the patch to 'on' if no output arguments are specified.
Algorithm explaination created using ChatGPT on 2025-08-19 01:04. (Please note: No guarantee for the correctness of this explanation)