简体   繁体   中英

C++ - How to write the code to find the intersection of two hyperplanes

In n-dimensional space, two non-parallel hyperplanes will intersect at a hyperplane one dimension below the current hyperplane dimension. (Two lines intersect at a point, two planes at a line, two 4D hyperplanes at a plane, etc.) I know at least 1 method to find where this intersection occurs:

v + w + x + y + z = 4
v + 2w + 3x + 4y + 5z = 7
then
v = 4 - w - x - y - z
gives
(4 - w - x - y - z) + 2w + 3x + 4y + 5z = 7
and finally
w + 2x + 3y + 4z = 3
is the hyperplane where the two higher dimensional hyperplanes intersect.

My problem is, I don't fully see how to translate this method into a C++ program. Any suggestions? Thanks!

The aim is to eliminate one of the variables. The procedure is:

  1. Pick one of the variables to eliminate (let's say it was v ).
  2. Multiply all coefficients in equation A by the coefficient of v in equation B, and vice versa.
  3. Subtract coefficients of equation A from those of equation B.
  4. Done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM