bugfix for axes extent

This commit is contained in:
wyq 2022-06-10 09:26:10 +08:00
parent d542299e49
commit bcf93c34d2
6 changed files with 21 additions and 4 deletions

View File

@ -467,7 +467,7 @@ public class GraphicFactory {
if (!fixZ) {
z = zIter.getDoubleNext();
}
if (Double.isNaN(y) || Double.isNaN(x)) {
if (Double.isNaN(y) || Double.isNaN(x) || Double.isNaN(z)) {
if (points.isEmpty()) {
continue;
}

View File

@ -1074,8 +1074,8 @@ public class Plot3DGL extends Plot implements GLEventListener {
ex = ex.to3D();
}
this.graphicExtent = (Extent3D) ex;
this.setAxesExtent((Extent3D) graphicExtent.clone());
if (!fixExtent) {
this.setAxesExtent((Extent3D) graphicExtent.clone());
this.setDrawExtent((Extent3D) this.graphicExtent.clone());
}
}

View File

@ -38,6 +38,7 @@ public class Plot3D extends Plot {
// <editor-fold desc="Variables">
private final GraphicCollection3D graphics;
private Extent3D extent;
private Extent3D axesExtent;
private ChartText title;
private List<ChartLegend> legends;
private Axis xAxis;
@ -549,6 +550,22 @@ public class Plot3D extends Plot {
this.projector.setZRange(zmin, zmax);
}
/**
* Get axes extent
* @return Axes extent
*/
public Extent3D getAxesExtent() {
return this.axesExtent;
}
/**
* Set axes extent
* @param value Axes extent
*/
public void setAxesExtent(Extent3D value) {
this.axesExtent = value;
}
// </editor-fold>
// <editor-fold desc="Methods">
private void updateExtent() {

View File

@ -36,5 +36,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
<Startup MainFormLocation="-7,0" MainFormSize="1409,776"/>
</MeteoInfo>

View File

@ -303,7 +303,7 @@ class Axes3D(Axes):
zmax = limits[5]
extent = Extent3D(xmin, xmax, ymin, ymax, zmin, zmax)
self.axes.setDrawExtent(extent)
self.axes.setExtent(extent.clone())
self.axes.setAxesExtent(extent.clone())
return True
else:
print('The limits parameter must be a list with 6 elements: xmin, xmax, ymin, ymax, zmin, zmax!')