Syntax
PL=CPLfilmhinge([L,B,R])
Input Parameter
L : | | Length |
B : | | Widht/Height must be smaller than L |
R : | | Radius at the end |
Output Parameter
Examples
CPLfilmhinge(10,0.5,1)
Copyright 2023-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, CPLfilmhinge
, generates a closed polygon list representing a simple bar contour with rounded edges. It is part of the SolidGeometry library and was introduced in version 5.3. The function has not been extensively tested, so it should be used with caution.
Input Parameters
- L: Length of the bar. Default is 10 if not specified.
- B: Width/Height of the bar, which must be smaller than L. Default is 1 if not specified.
- R: Radius at the ends of the bar. Default is equal to B if not specified.
Output
- PL: The final point list representing the bar contour.
Algorithm Steps
- Retrieve the input parameters L, B, and R using the
getfuncparams
function. Default values are used if parameters are not provided.
- Create an initial point list
PL
that defines a rectangle with rounded edges. The rectangle is defined with a length of 10 times the sum of R and B, and a width of B.
- Apply the
PLradialEdges
function to PL
to round the edges with the specified radius R.
- Create a new point list
PL1
by intersecting PL
with a square defined by PLsquare
with dimensions [10*(B+R), B+2*R].
- Create a mirrored version of
PL1
called PL2
by negating the x-coordinates.
- Create another square
PL3
with dimensions [L, B] using PLsquare
.
- Combine
PL3
and PL1
using CPLunion
with the 'alignleft' option to form a new polygon.
- Combine the result with
PL2
using CPLunion
with the 'alignright' option to complete the bar contour.
- If no output is requested, plot the resulting polygon using
SGfigure
and CPSplot
with a red line style.
Algorithm explaination created using ChatGPT on 2025-08-19 00:42. (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