Syntax
[mp,do,cp,ov,dz]=mirroringatline3D(P1,ev,p)
Input Parameter
P1 : | | Point on line |
ev : | | direction vector |
p : | | point to mirror |
Output Parameter
mp : | | mirror point |
do : | | distance to straight line (wrt to ev) |
cp : | | crossing point on line |
ov : | | orthogonal vector to straight line from p to cp |
dz : | | distance of cp from P1 |
Examples
mirroringatline3D([0 0 0],[1 0 0],[2 1 3])
mirroringatline3D([0 0 0],[0 1 0],[2 1 3])
mirroringatline3D([0 0 0],[0 0 1],[2 1 3])
Copyright 2019-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)
The function mirroringatline3D
is designed to mirror a point in 3D space across a straight line. It takes three input parameters and returns five output results.
Input Parameters
- P1: A point on the line, represented as a vector [x, y, z].
- ev: The direction vector of the line, also represented as a vector [x, y, z].
- p: The point to be mirrored, represented as a vector [x, y, z].
Output Results
- mp: The mirrored point, calculated as the reflection of point
p
across the line defined by P1
and ev
.
- do: The distance from the point
p
to the straight line, measured orthogonally with respect to the direction vector ev
.
- cp: The crossing point on the line, which is the closest point on the line to the point
p
.
- ov: The orthogonal vector from the point
p
to the crossing point cp
.
- dz: The distance of the crossing point
cp
from the point P1
along the line.
Algorithm Steps
- Calculate the transformation matrix
TE
using the function Tof2P
with inputs P1
and ev
.
- Transform the point
p
using the inverse of the transformation matrix TE
with the function VLtransT
.
- Calculate the crossing point
cp
on the line by subtracting the transformed point components from p
.
- Determine the orthogonal vector
ov
as the difference between cp
and p
.
- Compute the distance
do
as the norm of the orthogonal vector ov
.
- Extract the distance
dz
from the transformed point's third component.
- Calculate the mirrored point
mp
by adding the orthogonal vector ov
to the crossing point cp
.
- If no output arguments are specified, visualize the points and line using plotting functions such as
SGfigure
, VLplot
, and lplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 07: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