How to generate and visualize two 3D planes that intersect?

580 Views Asked by At

How would I generate two planes with 3D points that are distributed on those two planes?

I would like to test two planes intersection and don't know how to generate the points of the two planes that intersect and visualize it.

1

There are 1 best solutions below

1
On BEST ANSWER

Let us start with the equation of a line in $\mathbb{R}^3$ (its the mathematical name of 3D space)

For this you will need a point $P(a,b,c)$ and a direction which you can define as a vector $\vec{v}=\langle v_1,v_2,v_3\rangle$. The point on this line, call it $l$ are described as follows $$ \{\langle x,y,z \rangle= \langle a,b,c\rangle +t\vec{v}, \ t\in\mathbb{R} \} $$ Think about this as $(a,b,c)$ giving a starting point and you shift this point in the direction of $t\cdot \vec{v}$.

We could also write this as three separate equations $$ x= a+tv_1 $$ $$ y=b+tv_2 $$ $$ z=c+tv_3 $$ for the same $t$ simultaneously.

You could define a plane as follows:

First determine a point in $\mathbb{R}^3$ space, this is a point having $3$ coordinates like $P(a,b,c)$ and then determine two (non parallel) vectors, these will be parallel to your plane $\vec{v}=\langle v_1,v_2,v_3\rangle$ and $\vec{u}=\langle u_1,u_2,u_3\rangle$. In this case the points of your plane are given by $$ \{\langle x,y,y \rangle= \langle a,b,c\rangle + t\vec{v} + s\vec{u}, \ t,s\in\mathbb{R} \} $$

as you can see here we needed two directions, this is hinting on the fact that we went up a dimension from the line (2D object) to a plane (3D object). And once again you could write this as $3$ equations We could also write this as three separate equations $$ x= a+tv_1+su_1 $$ $$ y=b+tv_2+su_2 $$ $$ z=c+tv_3+su_3 $$ for the same $s,t\in\mathbb{R}$ simultaneously.

Now, having $2$ planes defined by the above $(P,\vec{v}_1,\vec{u}_1)$ and $(Q,\vec{v}_2,\vec{u}_2)$ they are either

1) parallel in which case $\vec{v}_1\times \vec{u}_1=\pm \vec{v}_2\times \vec{u}_2$, and as such has either no points in common or all of their points are common

2) are not parrallel (this is the case you are after) they meet in a line and you can get the definition of this line in the form

$$ \{\langle x,y,z \rangle= \langle a,b,c\rangle +t\vec{v}, \ t\in\mathbb{R} \} $$

by solving their equations. You will have one for the first plane and one for the second of the form $$ x= a+tv_1+su_1 $$ $$ y=b+tv_2+su_2 $$ $$ z=c+tv_3+su_3 $$

This all may look like a lot of computation but I assume you are trying to write a python code for this.

I hope this helped