Add back graphing of dots
This commit is contained in:
parent
c9817662f2
commit
6830fdd587
@ -41,7 +41,6 @@ import javax.swing.JOptionPane;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
import org.math.plot.Plot2DPanel;
|
|
||||||
import org.matheclipse.core.eval.EvalUtilities;
|
import org.matheclipse.core.eval.EvalUtilities;
|
||||||
import org.matheclipse.parser.client.math.MathException;
|
import org.matheclipse.parser.client.math.MathException;
|
||||||
|
|
||||||
@ -65,6 +64,8 @@ public class Graph extends javax.swing.JInternalFrame {
|
|||||||
// Graph min and max
|
// Graph min and max
|
||||||
private double xmin = -10;
|
private double xmin = -10;
|
||||||
private double xmax = 10;
|
private double xmax = 10;
|
||||||
|
// private double ymin = -10;
|
||||||
|
// private double ymax = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form Graph
|
* Creates new form Graph
|
||||||
@ -261,8 +262,11 @@ public class Graph extends javax.swing.JInternalFrame {
|
|||||||
for (x = xmin; x <= xmax; x += ((xmax - xmin) / 40.0)) {
|
for (x = xmin; x <= xmax; x += ((xmax - xmin) / 40.0)) {
|
||||||
try {
|
try {
|
||||||
cr.setVar("x", x);
|
cr.setVar("x", x);
|
||||||
yy += solver.evaluate("$x=" + x + ";N[" + formula + "]").toString() + " ";
|
String res = solver.evaluate("$x=" + x + ";N[" + formula + "]").toString();
|
||||||
xx += String.valueOf(x) + " ";
|
//if (Double.parseDouble(res) >= ymin && Double.parseDouble(res) <= ymax) {
|
||||||
|
yy += res + " ";
|
||||||
|
xx += String.valueOf(x) + " ";
|
||||||
|
//}
|
||||||
} catch (MathException | NumberFormatException ex) {
|
} catch (MathException | NumberFormatException ex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -335,18 +339,16 @@ public class Graph extends javax.swing.JInternalFrame {
|
|||||||
* @param zoomLevel The zoom level to calculate from.
|
* @param zoomLevel The zoom level to calculate from.
|
||||||
* @return The ratio.
|
* @return The ratio.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static double getScale(int zoomLevel) {
|
public static double getScale(int zoomLevel) {
|
||||||
double gscale = 15.0;
|
return 15.0;
|
||||||
if (zoomLevel >= 0) {
|
|
||||||
gscale = 1.0 / (zoomLevel + 1.0);
|
|
||||||
} else {
|
|
||||||
gscale = 1.0 * (abs(zoomLevel) + 1.0);
|
|
||||||
}
|
|
||||||
return gscale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawDot(double x, double y) {
|
public void drawDot(double x, double y) {
|
||||||
// TODO: implement this
|
double[] xpt = {x};
|
||||||
|
double[] ypt = {y};
|
||||||
|
|
||||||
|
plot.addScatterPlot("", xpt, ypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inBoxKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inBoxKeyTyped
|
private void inBoxKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inBoxKeyTyped
|
||||||
|
Loading…
x
Reference in New Issue
Block a user