News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Sutherland-Hodgman Polygon Clipping

Started by HSE, June 21, 2021, 05:38:38 AM

Previous topic - Next topic

HSE

Hi All !

This is a test of the polygon clipping algorithm (translated from cpp).

Don't look so amazing, but is used for more complex thing at subpixel level (that I stil don't understand, I have to say  :biggrin:)

In white is polygon to clip, in yellow the clipper window, and in blue or red are clipped polygons:

    ; Show imputs
    invoke Poligono, addr poly_points1, poly_size1, 0FFBBBBBBh
    invoke Poligono, addr clipper_points1, clipper_size1, 0FF00BBBBh
   
    ; Calling the clipping function
    invoke SuthHodgClip, addr poly_points1, addr poly_size1, addr clipper_points1, clipper_size1

    ; Show result
    invoke Poligono, addr poly_points1, poly_size1, 0FF0000FFh


Regards, HSE.
Equations in Assembly: SmplMath

daydreamer

nice :thumbsup:
could also be used for frustrum culling?,clipping with  x-z romb shape,reduces also too far/too near polys
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Quote from: daydreamer on June 21, 2021, 10:47:19 PM
could also be used for frustrum culling?,clipping with  x-z romb shape,reduces also too far/too near polys
:thumbsup: This algorithm is included in more complex algorithms with z.
Equations in Assembly: SmplMath