mirroringatline

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 4.5, Creation date: 2019-02-22, Last change: 2025-09-14

mirrors a point at a straight line in 2D

Description

Should be renamed into PLmirroratline

See Also: PLcross2Lines , PLcrossCPLline , mirroringatline3D

Example Illustration

 missing image of mirroringatline(P1,ev,p)

Syntax

[mp,do,cp,ov]=mirroringatline(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

Examples


mirroringatline([0 0],+[-1 -6],[1 1])




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)

This function, mirroringatline, mirrors a point at a straight line in 2D. It is part of the SolidGeometry library and was introduced in version 4.5. The function takes three input parameters and returns four output results.

Input Parameters

Output Results

Algorithm Steps

  1. Normalize the direction vector ev to ensure it has a unit length.
  2. Calculate the orthogonal vector ov to the line using the direction vector ev. This is done by swapping the components of ev and changing the sign of the first component.
  3. Use the reduced row echelon form (RREF) to solve the linear system that finds the distance do from point p to the line.
  4. Calculate the crossing point cp by moving from point p along the orthogonal vector ov by the distance do.
  5. Determine the mirror point mp by moving from point p twice the distance do along the orthogonal vector ov.

Visualization (if no output arguments)

If the function is called without output arguments, it visualizes the line, the original point p, the crossing point cp, and the mirror point mp using a plotting function. The line is extended in both directions for better visualization, and the points are marked with different colors and labels.

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