[goffice] Fix third axis range in 3d plots.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix third axis range in 3d plots.
- Date: Sat, 17 Aug 2013 08:26:56 +0000 (UTC)
commit a2862edea9981277436be4c41537dbe175d1e534
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Aug 17 10:25:15 2013 +0200
Fix third axis range in 3d plots.
ChangeLog | 7 +++++++
plugins/plot_surface/gog-xyz-surface.c | 26 ++++++++++++++++++++------
2 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d9017d4..1eaa996 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-08-17 Jean Brefort <jean brefort normalesup org>
+
+ * plugins/plot_surface/gog-xyz-surface.c
+ (gog_xyz_matrix_plot_build_matrix),
+ (gog_xyz_surface_plot_build_matrix): fix third axis range evaluation. See
+ bug 705913, comment 23.
+
2013-08-15 Jean Brefort <jean brefort normalesup org>
* plugins/plot_xy/gog-xy-dropbar.c (gog_xy_dropbar_plot_update): fixed x/y
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 4efd581..f06a1f7 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -99,7 +99,7 @@ gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_change
unsigned i, j, k, l, index;
GogSeries *series = GOG_SERIES (plot->base.series->data);
const double *x_vals, *y_vals, *z_vals = NULL;
- double *x_limits, *y_limits;
+ double *x_limits, *y_limits, zmin = DBL_MAX, zmax = -DBL_MAX;
double *data;
unsigned *grid, n, kmax, imax, jmax;
xyz_data raw_data;
@@ -212,8 +212,15 @@ gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_change
g_free (sort);
g_free (grid);
- go_range_min (data, n, &((GogXYZPlot *) plot)->z.minima);
- go_range_max (data, n, &((GogXYZPlot *) plot)->z.maxima);
+ for (k = 0; k < n; ++k)
+ if (go_finite (data[k])) {
+ if (zmin > data[k])
+ zmin = data[k];
+ if (zmax < data[k])
+ zmax = data[k];
+ }
+ ((GogXYZPlot *) plot)->z.minima = zmin;
+ ((GogXYZPlot *) plot)->z.maxima = zmax;
return data;
}
@@ -223,7 +230,7 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
unsigned i, j, k, l, index;
GogSeries *series = GOG_SERIES (plot->base.series->data);
const double *x_vals, *y_vals, *z_vals = NULL;
- double *x_limits, *y_limits, xmin, ymin;
+ double *x_limits, *y_limits, xmin, ymin, zmin = DBL_MAX, zmax = -DBL_MAX;
double *data;
unsigned *grid, n, kmax, imax, jmax;
xyz_data raw_data;
@@ -388,8 +395,15 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
g_free (sort);
g_free (grid);
- go_range_min (data, n, &((GogXYZPlot *) plot)->z.minima);
- go_range_max (data, n, &((GogXYZPlot *) plot)->z.maxima);
+ for (k = 0; k < n; ++k)
+ if (go_finite (data[k])) {
+ if (zmin > data[k])
+ zmin = data[k];
+ if (zmax < data[k])
+ zmax = data[k];
+ }
+ ((GogXYZPlot *) plot)->z.minima = zmin;
+ ((GogXYZPlot *) plot)->z.maxima = zmax;
if (GOG_IS_CONTOUR_PLOT (plot)) {
GogAxisMap *map;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]