Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Distance to Nearest Quad Edge

  1. Jan 24, 2010 #1
    From this example

    Anti-Aliasing section 22.4.1
    http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter22.html [Broken]

    what does the following equation represent and how was it derived?

    [tex]k = \frac{2}{(2r+w)\sqrt{(x_0 - x_1)^2 - (y_0 - y_1)^2}}[/tex]

    I assume the 4 sets of linear equation coefficients are slope formula derivatives but I can't quite work it out! I assume there is something of a dot product going on in there but I'm really having a hard time putting it together and I won't use something in code(home project) until I understand it completely!

    Thanks for any input,
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Jan 25, 2010 #2
    I mean just for starters [tex]\frac{2}{r+2w} = \frac{1}{w}[/tex] looks to be [tex]\frac{1}{|\vec{U}|}[/tex] and [tex]\frac{1}{\sqrt{(x_0-x_1)^2 - (y_0-y_1)^2}}[/tex] looks to be [tex]\frac{1}{|\vec{V}|}[/tex] except that there's a negative in there??? A few thoughts on that, inverted y screen coordinate <= probably not -.- ok one thought....

    So then with [tex]\vec{e}[/tex] plugging the k into the first two coefficients of each looks to be just missing the [tex]\vec{U}[/tex] or [tex]\vec{V}[/tex] from a [tex]cos\theta[/tex]! The missing is obviously filled in when [tex]d_n = (x,y,1)\cdot\vec{e}[/tex] is expanded(proper wording??)..... but what is the determinant of the major line doing being added to one and divided by the product of the magnitudes??? And why is the resultant like two rotations and a magnitude(guessing)....

    The one text I have Linear Algebra and Differential Equations says the following about a distance to a point:

    The distance to a point [tex]d(U,V) = |\vec{U}-\vec{V}|[/tex] and well I have a really hard time reading Bernsteins Matrix Mathematics but if anyone knows something I should read in there :D

    I could be on this one for a while.....
  4. Jan 25, 2010 #3
    re the negative -- that equation is going to put a negative number in the square root whenever the line changes more in y than x? So, I'm guessing it's a typo and they mean + not - ...
  5. Jan 26, 2010 #4
    'tis true.... o-o
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook