Author Topic: Sutherland-Hodgman Polygon Clipping  (Read 505 times)

HSE

  • Member
  • *****
  • Posts: 1766
  • <AMD>< 7-32>
Sutherland-Hodgman Polygon Clipping
« on: June 21, 2021, 05:38:38 AM »
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:
Code: [Select]
    ; 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.

daydreamer

  • Member
  • *****
  • Posts: 1762
  • building nextdoor
Re: Sutherland-Hodgman Polygon Clipping
« Reply #1 on: June 21, 2021, 10:47:19 PM »
nice :thumbsup:
could also be used for frustrum culling?,clipping with  x-z romb shape,reduces also too far/too near polys
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

HSE

  • Member
  • *****
  • Posts: 1766
  • <AMD>< 7-32>
Re: Sutherland-Hodgman Polygon Clipping
« Reply #2 on: June 22, 2021, 12:25:48 AM »
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.