Quadrics / distance from planes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Okay, to make this simpler I'll write: | |
| p = (x, y, z)^T | |
| q_i = (x_i, y_i, z_i)^T | |
| g_i = (grad f)(q_i) | |
| And I'll also assume that f(x,y,z) = c not w (since I'll be using w for homogeneous coords!) | |
| then | |
| T_i(p) | |
| = dot(g_i, p - q_i) | |
| and | |
| (c - T_i(p))^2 | |
| = (c - dot(g_i, p - q_i))^2 | |
| Okay. We can go on in that form, but it's nicer if we go to homogeneous first: | |
| p' = (x, y, z, 1)^T | |
| q_i' = (x_i, y_i, z_i, 0)^T | |
| g_i' = [-g_i] (stack the "c" below "-g_i"). | |
| [ c ] | |
| Then | |
| (c - T_i(p))^2 | |
| = (c - dot(g_i, p - q_i))^2 | |
| = (dot(g_i', p' - q_i'))^2 | |
| = (dot(p' - q_i', g_i'))^2 | |
| = (dot(p', g_i') - dot(q_i', g_i'))^2 | |
| and that later term is just a constant offset we can bake into the constant offset term we already have in g_i', yielding: | |
| g_i'' = [ -g_i ] | |
| [ c - dot(q_i', g_i') ] | |
| which means | |
| (c - T_i(p))^2 | |
| = (dot(p', g_i''))^2 | |
| = (dot(p', g_i'')) * (dot(g_i'', p')) | |
| = (p'^T * g_i'') * (g_i''^T * p') | |
| = p'^T * (g_i'' * g_i''^T) * p' | |
| which is a quadratic form in standard form (the factor in parentheses is A). Summing over several of these just sums their entries for A. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment