Triangle Clipping Challenge remix
410
Published 2017-07-16
Thanks to @gtoal (and @chooper-beta) for the challenge!
# Original Text:
Clips triangles to a given rectangle
The clipped triangle is made by the division of the original triangle into smaller ones
Credit to @TheLogFather for his hybrid triangle filler I used
CHALLENGE:
Can you make a faster clipping algorithm that satisfies all the tests?
Have a go, and if you can make an algorithm faster than the one shown here, I'll give you a follow from @chooper100 (or something equivalent)
RULES:
You must provide 2 blocks:
- fill triangle (Ax) (Ay) (Bx) (By) (Cx) (Cy) res (res)
- clip and fill triangle (Ax) (Ay) (Bx) (By) (Cx) (Cy) res (res)
The testing code must not be changed
The outline of the original triangle and the clipping area must also be visible and they must be easy to distinguish from the clipped triangle
You may change the algorithm used to draw triangles if you have a more efficient algorithm
You may also remove the "Triangles Drawn" variable. The "Test Time" variable must be kept however