cross2edges2

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 1.0, Creation date: 2012-05-12, Last change: 2025-09-14

calculates in 2D the crossing point of two straight lines

Description

This procedure is using rref of matlab for solving a equation system.

See Also: cross4P , cross2edges

Example Illustration

 missing image of cross2edges2(pa,na,pb,nb)

Syntax

[cp,ka,kb,kd]=cross2edges2(pa,na,pb,nb)

Input Parameter

pa: point a
na: direction vector a
pb: point b
nb: direction vector b

Output Parameter

cp: crossing point
ka: factor of direction vector a
kb: factor of direction vector a
kd: +1 == infinity solutions, -1; no solution; 0 there is a solution




Copyright 2012-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 calculates the crossing point of two straight lines in 2D using the reduced row echelon form (rref) of a matrix. It is part of the SolidGeometry library.

Input Parameters

Output Results

Algorithm Steps

  1. Check the dimension of pa. If it has more than one column, use the transpose of the direction vectors and the difference of points to form a matrix. Otherwise, use them as they are.
  2. Apply the rref function to the matrix to solve the system of equations.
  3. Initialize ka, kb, cp, and kd with default values.
  4. Check the conditions of the matrix K to determine the values of ka, kb, and cp:
  5. If no output arguments are specified, plot the lines and the crossing point using the SGfigure function and related plotting functions.
Algorithm explaination created using ChatGPT on 2025-08-19 07:02. (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