Syntax
SG=SGcopypatternXYZ(SG,[cp,dd,fuse])
Input Parameter
SG : | | Solid Geometry |
cp : | | number of copies in [x y z] |
dd : | | distance between the copies |
fuse : | | if true; SG is struct not cell; default is true |
Output Parameter
Examples
Create copies at ten random positions
SGcopypatternXYZ(SGcylinder,[1 1 3],4)
SGcopypatternXYZ(SGcylinder,[1 1 3],4,true)
Copyright 2020-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, SGcopypatternXYZ, is designed to create multiple copies of a given solid geometry (SG) in a 3D space, based on specified parameters. It can return either a cell list of these copies or a fused solid.
Input Parameters
- SG: The solid geometry to be copied.
- cp: A vector specifying the number of copies in the x, y, and z directions. Default is [3 2 1].
- dd: The distance between the copies. Default is 0.
- fuse: A boolean indicating whether the copies should be fused into a single structure (true) or returned as a cell list (false). Default is false.
Output
- SG: A cell list of the solid geometry copies or a fused solid, depending on the 'fuse' parameter.
Algorithm Steps
- Retrieve the number of copies (cp), distance (dd), and fuse option from the input parameters using the function
getfuncparams
.
- Determine the number of copies in each direction (nx, ny, nz) based on the length of the cp vector. If cp has fewer than 3 elements, default values are used.
- Calculate the bounding box size of the solid geometry using
BBofSG
and sofBB
, and add the specified distance (dd) to this size.
- Create a mesh grid of vectors (VL) for the positions of the copies using
VLmeshgrid
, based on the number of copies and the adjusted bounding box size.
- Generate the copies of the solid geometry at the specified positions using
SGcopyVL
, with the option to fuse them based on the 'fuse' parameter.
- If no output is requested, visualize the result using
SGfigure
and plot the copies with either SGplotcell
or SGplotalpha
, depending on whether the result is a cell or a fused structure.
Algorithm explaination created using ChatGPT on 2025-08-19 08:02. (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