Package: libcaca0
Version: 0.99.beta17-1
Severity: normal

Running the foo.c below prints an ellipse like

     *****
     *   *
    *     *
    *     *
    *     *
     *   *
     *****

where I hoped it might look like

      *** 
     *   *
    *     *
    *     *
    *     *
     *   *
      *** 

which doesn't have the square corners top and bottom, and is symmetric
vertically and horizontally.  Some other sizes have a few doubtful
looking pixels, but this is probably the most obvious.

Nosing around the code, it's possible the +3 from the computer graphics
book might be right.  I think the step is supposed to maintain

    d1 == (x+1)^2*b^2 + (y-1/2)^2*a^2 - a^2*b^2

or something like that, if chucking in a debug assertion helped.  Does
+1 or +3 depend whether the x++ increment is before or after the d1
step, maybe?

Incidentally, in the d1>=0 case is "2*x*1" meant to be "2*x+1"?


#include <stdio.h>
#include <stdlib.h>
#include "caca.h"

int
main (void)
{
  caca_canvas_t *c;
  caca_display_t *d;

  int size = 3;
  int a = size;
  int b = size;
  int x = a;
  int y = b;

  d = caca_create_display(NULL);
  if(!d) abort();
  c = caca_get_canvas(d);

  caca_draw_ellipse(c, x,y, a,b, '*');
  caca_refresh_display(d);

  caca_free_canvas(c);
  caca_free_display(d);
  return 0;
}

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-486
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages libcaca0 depends on:
ii  libc6                   2.11.1-3         Embedded GNU C Library: Shared lib
ii  libgcc1                 1:4.4.4-6        GCC support library
ii  libncursesw5            5.7+20100313-3   shared libraries for terminal hand
ii  libslang2               2.2.2-4          The S-Lang programming library - r
ii  libstdc++6              4.4.4-6          The GNU Standard C++ Library v3
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

libcaca0 recommends no packages.

libcaca0 suggests no packages.

-- no debconf information

Reply via email to