CPLcrosslineauxpoints
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.1, Creation date: 2021-12-01, Last change: 2025-09-15
creates crossing points of a line a a contour with a grid size
Description
will be improved in future. Function is used to create base points for mechanisms design along of straigt lines within a defined contour
See Also: crossC2P
, CPLofPLcrossCPL
Example Illustration
Syntax
GPL=CPLcrosslineauxpoints(CPL,p1,p2,md)
Input Parameter
CPL: | | Contour |
p1: | | Start Point |
p2: | | End Point |
md: | | distance; default is 1mm |
Output Parameter
Examples
CPLcrosslineauxpoints(CPLsample(18),[0 -30],[0 +30],5)
Copyright 2021-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, CPLcrosslineauxpoints, is designed to create crossing points of a line with a contour, using a specified grid size. It is part of the SolidGeometry library and is used for mechanism design along straight lines within a defined contour.
Input Parameters
- CPL: The contour, which is a closed polygon list.
- p1: The start point of the line.
- p2: The end point of the line.
- md: The distance between grid points, with a default value of 1 mm.
Output
- GPL: The grid point list, which contains the crossing points of the line with the contour.
Algorithm Steps
- Calculate the direction vector
ov from p1 to p2 and normalize it.
- Use the function
crossC2P to find the crossing points cc and their associated parameters ac.
- If crossing points exist, sort them based on
ac.
- Check if the start or end points are inside the contour using
insideCPL and adjust cc accordingly.
- Calculate the distance
dd between the first and last crossing points.
- Determine the number of intervals
ni and the interval distance nd.
- Create an array
ai of distances from the first crossing point.
- Generate the grid points
GPL along the line using the calculated distances.
- Remove grid points that are not inside the contour using
insideCPL.
- If no output is requested, plot the contour, line, and grid points for visualization.
Algorithm explaination created using ChatGPT on 2025-08-19 08:15. (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