[Oberon] PO2013 - Simple Arc

Tomas Kral thomas.kral at email.cz
Fri Jun 26 19:41:16 CEST 2020


Better?

> Optimally, 2 condition checks will do.

either

      IF sx > 0 THEN
        IF sy > 0 THEN
          Dot(col, x0+x, y0+y, mode);
          Dot(col, x0+y, y0+x, mode)
        ELSE (*sy < 0*)
          Dot(col, x0+y, y0-x, mode);
          Dot(col, x0+x, y0-y, mode)
        END
      ELSE (*sx < 0*)
        IF sy > 0 THEN
          Dot(col, x0-y, y0+x, mode);
          Dot(col, x0-x, y0+y, mode)
        ELSE (*sy < 0*)
          Dot(col, x0-x, y0-y, mode);
          Dot(col, x0-y, y0-x, mode)
        END
      END ;

or

      IF sx > 0 THEN
        IF sy > 0 THEN
          Dot(col, x0+x, y0+y, mode);
          Dot(col, x0+y, y0+x, mode)
        ELSE (*sy < 0*)
          Dot(col, x0+y, y0-x, mode);
          Dot(col, x0+x, y0-y, mode)
        END
      ELSIF (*sx < 0*) sy > 0 THEN
        Dot(col, x0-y, y0+x, mode);
        Dot(col, x0-x, y0+y, mode)
      ELSE (*sy < 0*)
        Dot(col, x0-x, y0-y, mode);
        Dot(col, x0-y, y0-x, mode)
      END ;

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list