Syntax
MPL=PLmirroratline(PL,[p1,p2])
Input Parameter
PL : | | PL or CPL |
p1 : | | point 1 on line |
p2 : | | point 2 on line |
Output Parameter
Examples
PLmirroratline(CPLsample(30));
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, PLmirroratline
, mirrors a polyline (PL) or closed polyline (CPL) at a line defined by two points, p1
and p2
.
Input Parameters
- PL: A polyline (PL) or closed polyline (CPL) that needs to be mirrored.
- p1: The first point on the line used for mirroring. Default is [0, 0].
- p2: The second point on the line used for mirroring. Default is [1, 0].
Output
- MPL: The mirrored polyline.
Algorithm Steps
- Retrieve the points
p1
and p2
from the input parameters or use default values if not provided.
- Initialize
MPL
as a copy of PL
.
- Calculate the unit direction vector
ez
of the line from p1
to p2
.
- Iterate over each point in
PL
:
- For each point, calculate its mirrored position using the function
mirroringatline
with p1
, ez
, and the current point.
- Store the mirrored point in
MPL
.
- If no output is requested (
nargout==0
), plot the original and mirrored polylines:
- Use
SGfigure
to set up the plot.
- Plot the original polyline
PL
in red.
- Plot the mirrored polyline
MPL
in green with a thicker line.
- Calculate the bounding box size
s
and plot the mirroring line in blue dashed style.
- Add annotations to the plot to distinguish between the original and mirrored polylines.
Algorithm explaination created using ChatGPT on 2025-08-18 23:49. (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