void gtk_plot_surface_recalc_nodes(GtkPlotSurface *surface) { GtkPlotData *data; GtkPlot *plot; gint i; data = GTK_PLOT_DATA(surface); if(!data->plot) return; plot = data->plot; for(i= surface->dt->node_0; i < surface->dt->node_cnt; i++){ GtkPlotDTnode *node; node = gtk_plot_dt_get_node(surface->dt,i); if(GTK_IS_PLOT3D(plot)){ gtk_plot3d_get_pixel(GTK_PLOT3D(plot), node->x, node->y, node->z, &node->px, &node->py, &node->pz); } else { gtk_plot_get_pixel(plot, node->x, node->y, &node->px, &node->py); node->pz = 0.0; } } surface->dt->triangles = g_list_sort(surface->dt->triangles, (GCompareFunc)compare_func); }
static void gtk_plot_flux_draw_symbol(GtkPlotData *dataset, gdouble x, gdouble y, gdouble z, gdouble a, gdouble dx, gdouble dy, gdouble dz, gdouble da) { GtkPlot *plot; GtkPlotFlux *flux = NULL; //GdkRectangle area; //, clip_area; gdouble m; gdouble x1 = 0.0, y1 = 0.0, x2 = 0.0, y2=0.0; gdouble factor, size, xm; GtkAllocation allocation; g_return_if_fail(GTK_IS_PLOT_FLUX(dataset)); flux = GTK_PLOT_FLUX(dataset); g_return_if_fail(dataset->plot != NULL); g_return_if_fail(gtk_widget_get_visible(GTK_WIDGET(dataset->plot))); plot = dataset->plot; m = plot->magnification; gtk_widget_get_allocation( GTK_WIDGET(plot), &allocation); //area.x = allocation.x; //area.y = allocation.y; //area.width = allocation.width; //area.height = allocation.height; /* clip_area.x = area.x + roundint(plot->x * area.width); clip_area.y = area.y + roundint(plot->y * area.height); clip_area.width = roundint(plot->width * area.width); clip_area.height = roundint(plot->height * area.height); gtk_plot_pc_clip(plot->pc, &clip_area); */ if(GTK_IS_PLOT3D(plot)){ gdouble z1; xm = sqrt(dx * dx + dy * dy + dz * dz); factor = xm / flux->scale_max; size = factor * flux->size_max; x2 = size * dx / xm; y2 = size * dy / xm; gtk_plot3d_get_pixel(GTK_PLOT3D(plot), x, y, z, &x1, &y1, &z1); }else{ if(plot->clip_data && (x < plot->xmin || x > plot->xmax || y < plot->ymin || y > plot->ymax)) return; xm = sqrt(dx * dx + dy * dy); factor = xm / flux->scale_max; size = factor * flux->size_max; gtk_plot_get_pixel(plot, x, y, &x1, &y1); if (xm > 0.0) { x2 = size * dx / xm; y2 = size * dy / xm; /* check for NaN */ if (x2 == x2 && y2 == y2) gtk_plot_flux_draw_arrow (flux, x1, y1, x1+x2*m, y1-y2*m); } gtk_plot_data_draw_symbol(dataset, x1, y1); } /* gtk_plot_pc_clip(plot->pc, NULL); */ }