Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 4,191 of 4,675    |
|    Rick C. Hodgin to Terje Mathisen    |
|    Re: Assembly contest idea    |
|    15 Oct 20 12:31:29    |
      From: rick.c.hodgin@nospicedham.gmail.com              On 10/15/20 2:40 AM, Terje Mathisen wrote:       > The idea is that we need to compare the left edge of rectangle one       > against both the left and right edge of rectangle2, and the same for the       > right edge, so this is 8 compares for the vertical lines. Add the same       > for the horizontal and you need 16 compares which would fit in a much       > more common AVX register.       >       > R2 totally inside R1 becomes       >       > (R2.l >= R1.l) AND (R2.r <= R1.r) AND       > (R2.b >= R1.b) AND (R2.a <= R1.a)       >       > i.e. relatively simple, while zero overlap is much harder, and related       > to the clipping question from last week: It requires all of R2 to be       > either to the left, right, above or below, so there are 4 different       > masks that give the same result and you have to OR those together:       >       > (R2.r < R1.l) OR (R2.a < R1.b) OR (R2.l >= R1.r) OR (R2.b >= R1.a)       >       > All that remains is to setup all those values in the correct spot so       > that these 8 compares can be done (some of them needs to be inverted       > after the fact obviously!) with a single compare_greater_or_equal()       > instruction. Seems doable by duplicating the R1 values so that each       > occur twice, then use a permute on the R2 values to put them in the       > right spots, do the compare, flip half the results and then the slowest       > part: Horizontally combine them with and AND for the inside result, with       > OR for outside, and then all partial overlaps fall out by being neither       > of these.              I'm thinking there's a relationship between the various values, such       that for an inside test we will know:               t        ___        l | | r // left, right, top, bottom        |___|               b               r2.l is between r1.l and r1.r        r2.r is between r1.l and r1.r              And the same will be true for r2.top and r2.bottom:               r2.t is between r1.t and r1.b        r2.b is between r1.t and r1.b              And if we assert that each l is less than r, and each t is less than b,       is there some mathematical formula we can conclude?               if r2.r - r1.l - r2.l > x        and r2.r - r1.r - r2.l > x        and r2.b - r1.t - r2.t > y        and r2.t - r1.t - r2.t > y              then we know the relationship is true? It would be determining x and y,       which surely are proportional to the rectangles and/or their       relationships. And once determined, we could possibly simplify the       expressions to their minimums.              Something like that? I don't know. My mind is hazy on all this.              --       Rick C. Hodgin              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca