Forum

DistancePlanePoint

Hey there,

I’m using vvvv gamma 2021.4.9 preview-0975.

I am playing around with the DistancePlanPoint node, and have been struggling understanding why a point belonging to the plane was reporting a non-zero distance.
By noodling around a bit, I found out that this is fixed if I multiply by -1 the coordinates of the point that I input to DistancePlanPoint.

Is there something I’m missing in the (rather simple) logic of how DistancePlanPoint should be used, or is it a proper bug report that here comes with an easy fix? :)

Hope this helps!
T

debug-DistancePlanePoint_20220522.vl (20.2 KB)

hey, sorry for the late reply. I’ve looked at the code for the plane distance function and there seems to be a bug in Stride. the plane is stored in the so-called normal form (normal vector n + shortest distance to origin D). when the distance is calculated, it assumes that the plane is in Hessian normal form (assumes n is normalized), but it seems someone just mixed up the order in a subtraction term.

see: Hessian Normal Form -- from Wolfram MathWorld

and (11) here: Point-Plane Distance -- from Wolfram MathWorld

it will take a PR to fix that, so it will take a little while. you can work around it for now by wrapping it in a new operation. bonus hint: to flip the sign of a number or vector, we also have the - (Negate) node.

EDIT:

this is the proper fix, flipping the sign of the point gives the wrong sign of the distance. you have to implement the whole formula correctly:

dist = dot(n, P) + D

3 Likes

Thanks for investigating!
I only needed absolute distance so I did not spot the sign error, but thanks for the snippet to get it correct!
+
T