home.social

#softwarerendering — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #softwarerendering, aggregated by home.social.

  1. A tiny way to compute a square / triangle wave at the same time without conditionals, only basic arithmetic and shifts.

    This can be used for or animations etc. is a variant of HAKMEM 149.

    Can also be used to draw a square. (And other shapes, see previous toot)

    Code also shows how to draw a diamond shape by rotating the square by 45°.

    There are two versions, optimized for size and optimized for speed.