Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package wwsis.javacode.examples;
- public class DrawFunction {
- private int width;
- private int height;
- private int a;
- private int b;
- private int c;
- public int getC() {
- return c;
- }
- public void setC(int c) {
- this.c = c;
- }
- public int getWidth() {
- return width;
- }
- public void setWidth(int width) {
- this.width = width;
- }
- public int getHeight() {
- return height;
- }
- public void setHeight(int height) {
- this.height = height;
- }
- public int getA() {
- return a;
- }
- public void setA(int a) {
- this.a = a;
- }
- public int getB() {
- return b;
- }
- public void setB(int b) {
- this.b = b;
- }
- public int drawFunction(int i) {
- double functionx = a * Math.pow(i, 2) + b*i + c;
- // functionx += var.getHeight() / 2;
- int y = (int) functionx;
- return y;
- }
- public int drawDelta() {
- double delta = Math.pow(b, 2) - 4 * a + c;
- //fy *= var.getHeight() / 2;
- //fy += var.getHeight() / 2;
- int deltax = (int) delta;
- return deltax;
- }
- public double[] drawZeroPoints(DrawFunction delta) {
- Variables variables = new Variables();
- int deltax = delta.drawDelta();
- double x1 = (- b - Math.sqrt(deltax))/2 * a;
- double x2 = (- variables.getB() + Math.sqrt(deltax))/2 * variables.getA();
- double[] zeropoints = {x1, x2};
- return zeropoints;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement