Back to index

plt-scheme  4.2.1
Classes | Defines | Typedefs | Functions | Variables
DC.cc File Reference
#include "wx.h"
#include <math.h>

Go to the source code of this file.

Classes

struct  wx_spline_stack_struct

Defines

#define Uses_wxDC
#define Uses_wxList
#define half(z1, z2)   (double)((z1+z2)/2.0)
#define THRESHOLD   5
#define SPLINE_STACK_DEPTH   20

Typedefs

typedef struct
wx_spline_stack_struct 
Stack

Functions

static wxPointPointListToArray (wxList *list, int n)
static void wx_quadratic_spline (double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4)
static void wx_clear_stack (void)
static int wx_spline_pop (double *x1, double *y1, double *x2, double *y2, double *x3, double *y3, double *x4, double *y4)
static void wx_spline_push (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
static Bool wx_spline_add_point (double x, double y)
static void wx_spline_draw_point_array (wxDC *dc)

Variables

static wxListwx_spline_point_list
static Stack wx_spline_stack [SPLINE_STACK_DEPTH]
static Stackwx_stack_top
static int wx_stack_count

Class Documentation

struct wx_spline_stack_struct

Definition at line 374 of file DC.cc.

Class Members
double x1
double x2
double x3
double x4
double y1
double y2
double y3
double y4

Define Documentation

#define half (   z1,
  z2 
)    (double)((z1+z2)/2.0)

Definition at line 272 of file DC.cc.

#define SPLINE_STACK_DEPTH   20

Definition at line 378 of file DC.cc.

#define THRESHOLD   5

Definition at line 340 of file DC.cc.

#define Uses_wxDC

Definition at line 31 of file DC.cc.

#define Uses_wxList

Definition at line 32 of file DC.cc.


Typedef Documentation


Function Documentation

static wxPoint* PointListToArray ( wxList list,
int  n 
) [static]

Definition at line 148 of file DC.cc.

{
  int i = 0;
  wxPoint *points;
  wxPoint *point;
  wxNode *node;

  points = new WXGC_ATOMIC wxPoint[n];

  for (node = list->First(); node; node = node->Next()) {
    point = (wxPoint *)(node->Data());
    points[i].x = point->x;
    points[i++].y = point->y;
  }

  return points;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void wx_clear_stack ( void  ) [static]

Definition at line 383 of file DC.cc.

Here is the caller graph for this function:

static void wx_quadratic_spline ( double  a1,
double  b1,
double  a2,
double  b2,
double  a3,
double  b3,
double  a4,
double  b4 
) [static]

Definition at line 344 of file DC.cc.

{
    register double  xmid, ymid;
    double           x1, y1, x2, y2, x3, y3, x4, y4;
    int             counter = 10000; /* At most this many points */

    wx_clear_stack();
    wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);

    while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
        if (!counter--)
         break;
        xmid = half(x2, x3);
        ymid = half(y2, y3);
       if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
           fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
         wx_spline_add_point(x1, y1);
         wx_spline_add_point(xmid, ymid);
       } else {
         wx_spline_push(xmid, ymid, half(xmid, x3), half(ymid, y3),
                      half(x3, x4), half(y3, y4), x4, y4);
         wx_spline_push(x1, y1, half(x1, x2), half(y1, y2),
                      half(x2, xmid), half(y2, ymid), xmid, ymid);
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Bool wx_spline_add_point ( double  x,
double  y 
) [static]

Definition at line 419 of file DC.cc.

{
    wxPoint *point;

    if (!wx_spline_point_list) {
      wxREGGLOB(wx_spline_point_list);
      wx_spline_point_list = new wxList;
    }

    point = new wxPoint;
    point->x = x;
    point->y = y;
    wx_spline_point_list->Append((wxObject*)point);
    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void wx_spline_draw_point_array ( wxDC dc) [static]

Definition at line 435 of file DC.cc.

{
  if (wx_spline_point_list) {
    wxNode *node;
    dc->DrawLines(wx_spline_point_list, 0.0, 0.0);
    node = wx_spline_point_list->First();
    while (node) {
       wxPoint *point;
       point = (wxPoint *)node->Data();
       DELETE_OBJ point;
       wx_spline_point_list->DeleteNode(node);
       node = wx_spline_point_list->First();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wx_spline_pop ( double *  x1,
double *  y1,
double *  x2,
double *  y2,
double *  x3,
double *  y3,
double *  x4,
double *  y4 
) [static]

Definition at line 405 of file DC.cc.

{
    if (wx_stack_count == 0)
       return (0);
    wx_stack_top--;
    wx_stack_count--;
    *x1 = wx_stack_top->x1;    *y1 = wx_stack_top->y1;
    *x2 = wx_stack_top->x2;    *y2 = wx_stack_top->y2;
    *x3 = wx_stack_top->x3;    *y3 = wx_stack_top->y3;
    *x4 = wx_stack_top->x4;    *y4 = wx_stack_top->y4;
    return (1);
}

Here is the caller graph for this function:

static void wx_spline_push ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
) [static]

Definition at line 389 of file DC.cc.

{
    if (wx_stack_count >= SPLINE_STACK_DEPTH) {
      /* Just drop it. */
      return;
    }

    wx_stack_top->x1 = x1;    wx_stack_top->y1 = y1;
    wx_stack_top->x2 = x2;    wx_stack_top->y2 = y2;
    wx_stack_top->x3 = x3;    wx_stack_top->y3 = y3;
    wx_stack_top->x4 = x4;    wx_stack_top->y4 = y4;
    wx_stack_top++;
    wx_stack_count++;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 284 of file DC.cc.

Definition at line 379 of file DC.cc.

int wx_stack_count [static]

Definition at line 381 of file DC.cc.

Stack* wx_stack_top [static]

Definition at line 380 of file DC.cc.