1
$\begingroup$

$Plane1$ is defined by a point $origin1$ and a unit normal vector $normal1$.

$Plane2$ is defined by a point $origin2$ and a unit normal vector $normal2$.

The direction vector of the line of intersection is $vector = {(normal1 \times normal2) \over ||normal1 \times normal2||}$

Let $P=(x, y, 0)$ be a point on the line of intersection.

$$d1 = -(normal1 \cdot origin1)\\ d2 = -(normal2 \cdot origin2)\\ x = {\det\begin{pmatrix}normal1_Y&d1\\normal2_Y&d2\end{pmatrix} \over vector_Z}\\ y = {\det\begin{pmatrix}d1&normal1_X\\d2&normal2_X\end{pmatrix} \over vector_Z}$$

I wrote the code for the whole thing, however, the resulting $x$ and $y$ are wrong.

e.g.:

$origin1 = (5.068435, 8.175731, 6.636723)\\ normal1 = (0.06843487, -0.02417875, -0.01889595)\\ origin2 = (5.15494, 8.304083, 6.409493)\\ normal2 = (0.003429738, -0.0473366, 0.05807309)\\ x = 0.00213990043475194\\ y = 0.00053338281461705$

Expected result (approximately):

$x = 0.3809\\ y = 0.0949$

$\endgroup$
2
  • $\begingroup$ How do you know that the line of intersection itself intersects the $x$-$y$ plane? $\endgroup$
    – amd
    Jun 4, 2017 at 19:25
  • $\begingroup$ @amd given that the result of computing $vector$ is $(-0.4091549, -0.7189537, -0.56187)$ its z component is not null, it is then possible to assume that z=0 to solve the system $\endgroup$
    – R. 久蔵
    Jun 4, 2017 at 19:28

1 Answer 1

0
$\begingroup$

It looks like you’re using a form of Cramer’s rule to find the intersection point. Your error lies in normalizing the direction vector of the line for the denominators. If you divide your result by $\|normal_1\times normal_2\|$ you’ll get the correct result, but that’s the same as not normalizing in the first place.

$\endgroup$
2
  • $\begingroup$ Thanks. The normalization step was introduced in case $vector$ was too small. $\endgroup$
    – R. 久蔵
    Jun 4, 2017 at 20:28
  • $\begingroup$ @R.久蔵 Minor update: whether or not the two plane normals are unit vectors is irrelevant, since their cross product can still have non-unit norm. The key is to use their cross product as-is. If you want to manage disparities in numerical ranges, you’ll need to scale the original plane normals to keep everything consistent. $\endgroup$
    – amd
    Jun 4, 2017 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .