CPLhatchgridofCPL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.5, Creation date: 2024-12-09, Last change: 2025-09-15

creates filling meshs similar to a slicer

Description

slow function using CPL union

See Also: CPLhatch , CPLfillinside , CPLofSGprojection

Example Illustration

 missing image of CPLhatchgridofCPL(CPLOrg,dim)

Syntax

CPLF=CPLhatchgridofCPL(CPLOrg,[dim])

Input Parameter

CPLOrg: Original contour of a solid cross section/projection or a solid
dim: Wall and bar width and distance default is [2 20]

Output Parameter

CPLF: Contoor with a simple squared mesh

Examples


CPLhatchgridofCPL(CPLsample(31)*20);
CPLhatchgridofCPL(CPLsample(31)*20,'fill');
CPLhatchgridofCPL(SGsample(29),'fill',[1 5]);
CPLhatchgridofCPL(SGsample(29),[1 5]);




Copyright 2024-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, CPLhatchgridofCPL, creates a filling mesh similar to a slicer for a given contour of a solid cross-section or projection. It is part of the SolidGeometry library and was introduced in version 5.5.

Input Parameters

Output Results

Algorithm Steps

  1. Check if the 'fill' option is specified in the input parameters using getfuncparamStr.
  2. Retrieve the dim parameter using getfuncparams, defaulting to [2 20] if not provided.
  3. If CPLOrg is a solid geometry object, convert it to a contour using CPLofSGprojection.
  4. Assign CPLOrg to CPLO.
  5. If the 'fill' option is specified, fill the inside of the contour using CPLfillinside.
  6. Create a buffer around the contour with a negative offset using CPLbuffer and subtract it from the original contour using CPLsubtract.
  7. Generate a hatch pattern at 90 and 0 degrees using CPLhatch and combine them with the subtracted contour using CPLunion.
  8. If no output is requested, plot the resulting contour using SGfigure, CPSplot, and CPLplot.

Example Usage

Algorithm explaination created using ChatGPT on 2025-08-19 07:04. (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