Skip to content

Instantly share code, notes, and snippets.

@ion1
Last active April 30, 2020 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ion1/3605bcb4326bbf590e46b49a6db01206 to your computer and use it in GitHub Desktop.
Save ion1/3605bcb4326bbf590e46b49a6db01206 to your computer and use it in GitHub Desktop.
Vertex distance from planes

Plane normal dot products

P = [ 1  c ]
    [ c  1 ]

Plane normals

N N^T = P
[ N1x   0 ] [ N1x N2x ] = P
[ N2x N2y ] [   0 N2y ]
N1x^2 = 1
N1x N2x = c
N2x^2 + N2y^2 = 1
N1x = 1
N2x = c
N2y = sqrt(1 - c^2)

Vertex distance from planes

d = [ d1 d2 ]^T

Vertex

N v = d
v = N^-1 d
[ N1x   0 | 1  0 ]
[ N2x N2y | 0  1 ]
[ 1  0 |          1/N1x      0 ]
[ 0  1 | -N2x/(N1x N2y)  1/N2y ]
v = [          1/N1x      0 ] [ d1 ]
    [ -N2x/(N1x N2y)  1/N2y ] [ d2 ]
v = [               1                0  ] [ d1 ]
    [ -c/sqrt(1 - c^2)  1/sqrt(1 - c^2) ] [ d2 ]
v = [                        d1  ]
    [ (-c d1 + d2)/sqrt(1 - c^2) ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment