Calculate z of given xy point and plane in hessian normal form

3dgeometry

I have to find the $z$ value to a given 2 dimensional point $xy$ in a plane given by the hessian normal form $ax + by + cz + d = 0$ (the values are from RANSAC returned by pointcloudlibrary)

Example point: $x = 68255.2344$ and $y = 54959.8125$
Example plane: $a = 0$, $b = 0$, $c = -1$ and $d = 47.3241692$

I tried to solve the plane equation for z and got $z = (ax + by + d) / c$

But this does not work as intended. I'm drawing the plane and points and the points are much to low in my case.

My next idea was to use some school math for line plane intersection. For this i just took my 2D point and made two new points $p1$ and $p2$ with the same $x$ and $y$ values but $-100$ and $100$ for $z$

And then calculate the $z$ like:
$u = p1 – p0$
$dot = Dot(plane, u)$
$pco = plane * (-d / Dot(plane, plane))$
$w = p0 – pco$
$fac = -Dot(plane, w) / dot$
$u = u * fac$
$intersectionPoint = p0 + u$
Take $z$ of $intersectionPoint$

But this does also not yield the correct $z$ value.

Can someone tell me what I did wrong?

Best Answer

You have forgotten a minus sign: $$z=-\frac{ax+by+d}c.$$

Related Question