Mandelbrot set struggle with JSP

Viewed 27

I have to make jsp project painting Mandelbrot set. Now im writing in jsp for the tests. And i have struggle, ive never seen before. Instead of Mandelbrot set, my jsp shows me this: [1]: https://i.stack.imgur.com/hTdN3.png A lot of dots, which supposted to be in the square 100x100. And these dots lasts long way down. Where is the problem??? Im sorry for my english, but i only speak a little. Please help me.. I cant use java script! Examples of my code:

  1. algorithm for drawing..

     for (int row = 0; row < 100; row++) {
         for (int col = 0; col < 100; col++) {
             double c_re = (col - 100/2)*4.0/100;
             double c_im = (row - 100/2)*4.0/100;
             double x = 0, y = 0;
             int iterations = 0;
             while (x*x+y*y < 4 && iterations < max) {
                 double x_new = x*x-y*y+c_re;
                 y = 2*x*y+c_im;
                 x = x_new;
                 iterations++;
    
    
             }
             if(iterations>max)
             {
                 obrazek = Rysuj.narysuj(col, row);
                 akcja2+= obrazek;
                 akcja2+=col;
             }
    
         }
     }
    
  2. Function in Rysuj.narysuj:

    public class Rysuj {

     public static String narysuj(int x, int y) { 
         String obraz = "";
    
          obraz+= "<svg width=\"" + x +"\" height=\"" + y +"\">";
          obraz+= "<circle cx=\"" + x +"\" cy=\"" + y +"\" r=\"1\" stroke=\"green\" stroke-width=\"1\" fill=\"yellow\" />";
          obraz+= "</svg>";
         return obraz;
     }
    

    }

some html:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Rysowanie kwadratów</title>
<link href="NewSheet.css" rel="stylesheet" type="text/css" />
</head>


<body>
    
        <jsp:useBean id="item" class="lyszczewska_weronika1.Lyszczewska"
            scope="session"></jsp:useBean>
        <jsp:setProperty property="x" name="item" />
        <jsp:setProperty property="y" name="item" />

        
        <jsp:setProperty property="akcja" name="item" />
        <jsp:setProperty property="komunikat" name="item" />


        <div class="wybory">
            <form action="index1.jsp" method="post">
                <p>
                    X lewego boku <input type="text" name="x"
                        value=<jsp:getProperty property="x" name="item"/>>
                </p>
                <p>
                    Y gornego boku <input type="text" name="y"
                        value=<jsp:getProperty property="y" name="item"/>>
                </p>



                <p>
                    <input type="submit" name="akcja" value="rysuj"> <input
                        type="submit" name="akcja" value="czysc"> <input
                        type="submit" name="akcja" value="cofnij"> <input
                        type="submit" name="akcja" value="powtorz">
                </p>
            </form>
            <jsp:getProperty property="komunikat" name="item" />
        </div>



                <div style="position: absolute;     width: 900;
    height: 500px; left: 150px; top: 300px">
                <jsp:getProperty property="obrazek" name="item" />
            
</div>


    
</body>
</html>
0 Answers
Related