| GTK-EXTRA - Reference Manual

| Home

## Name

### Gtkplotbar - delaunay triangulization algorithm for gtk+

## Synopsis

    GtkType

    gtk_plot_dt_get_type

    (void);

    GtkObject*

    gtk_plot_dt_new

    (gint num);

    void

    gtk_plot_dt_set_quadtrilateral

    (GtkPlotDT *data,
    gboolean set);

    gdouble

    gtk_plot_dt_set_subsampling

    (GtkPlotDT *data,
    gboolean set);

    gboolean

    gtk_plot_dt_add_node

    (GtkPlotDT *data,
    GtkPlotDTnode node);

    GtkPlotDTnode *

    gtk_plot_dt_get_node

    (GtkPlotDT *data,
    gint idx);

    gboolean

    gtk_plot_dt_triangulate

    (GtkPlotDT *data);

    void

    gtk_plot_dt_clear

    (GtkPlotDT *data);

## Object Hierarchy

##
Args

## Signal Prototypes

    gboolean (* add_node) (GtkPlotDT *data, GtkPlotDTnode node);
    GtkPlotDTnode*(* get_node) (GtkPlotDT *data,gint idx);
    gboolean (* triangulate) (GtkPlotDT *data);
    void (* clear) (GtkPlotDT *data);

## Description

#### Delaunay triangulization algorithm for gtk+

##
Details

     struct GtkPlotDTnode;
     struct GtkPlotDTtriangle;
     struct GtkPlotDT;
     typedef gint (*GtkPlotDTprogressbarFunc) (double progress);

##
Screenshot

##

### gtk_plot_dt_get_type ()

    GtkType gtk_plot_dt_get_type (void);

Returns |

### gtk_plot_dt_new ()

    GtkObject* gtk_plot_dt_new (gint num);

### gtk_plot_dt_set_quadtrilateral ()

    void gtk_plot_dt_set_quadtrilateral (GtkPlotDT *data,
                                         gboolean set);

### gtk_plot_dt_set_subsampling ()

    void gtk_plot_dt_set_subsampling (GtkPlotDT *data,
                                      gboolean set);

### gtk_plot_dt_add_node ()

    gboolean gtk_plot_dt_add_node (GtkPlotDT *data,
                                   GtkPlotDTnode node);

### gtk_plot_dt_get_node ()

    GtkPlotDTnode * gtk_plot_dt_get_node (GtkPlotDT *data,
                                          gint idx);

### gtk_plot_dt_triangulate ()

    gboolean gtk_plot_dt_triangulate (GtkPlotDT *data);

### gtk_plot_dt_clear ()

    void gtk_plot_dt_clear (GtkPlotDT *data);

##
Signals

## The "add_node" signal

    gboolean (* add_node) (GtkPlotDT *data,
                           GtkPlotDTnode node);

data |
node |
Return |

## The "get_node" signal

    GtkPlotDTnode*(* get_node) (GtkPlotDT *data,
                                gint idx);

data |
idx |
Return |

## The "triangulate" signal

    gboolean (* triangulate) (GtkPlotDT *data);

data |
Return |

## The "clear" signal

    void (* clear) (GtkPlotDT *data);

data |

## DETAILS

    struct _GtkPlotDTnode

    /* A 2D-node for the delaunay triangulation */
    {
      gdouble x, y, z;    /* actual coordinates */
      gdouble px, py, pz; /* pixel coordinates */
      gint id;            /* some kind of 'meta-data' for external use */
      gint a,b,c,d;       /* neighbour node indices in quadrilateral mode */
    };

    struct _GtkPlotDTtriangle

    {
      gint a,b,c;
      GtkPlotDTnode *na,*nb,*nc;
      double radius;         /* radius-square */
      GtkPlotDTnode ccenter; /* center of circle */
      double area;           /* twice the triangle's area */
      GtkPlotDTnode min,max; /* the bounding box */
    };

    struct _GtkPlotDT

    /* data needed for a delaunay triangulation
     *
     * the nodes are held in an expanding array (use gtk_plot_dt_expand()!)
     *
     */
    {
      GtkObject object;
      gboolean quadrilateral;
      gboolean subsampling;
      gint node_0;               /* lowest node-index (may be negative!) */
      gint node_cnt;             /* number of nodes */
      gint node_max;             /* maximum number of nodes */
      GtkPlotDTnode *nodes;     /* them nodes themselves */
      GtkPlotDTnode *tmp_nodes; /* index<0: tmpnodes[-1-index] */
      GList *triangles;
      GCompareFunc compare_func;
      GtkPlotDTprogressbarFunc pbar;
    };

    /* a progress indicator function with optional 'cancel' functionality
     *
     * returns '0' for normal operation
     * or any arbitrary code to request immediate abortion
     */
    typedef gint (*GtkPlotDTprogressbarFunc) (double progress);

| Home |  |