Hi guys,

I am working on a conversion of the Mandelbrot Fractal from Java to C# and my programming skills are lacking quite a bit. I am desperately trying to improve but I have come across some errors that are stumping me. I have attached a txt file with the code I have so far and below is the segment of code I am getting errors with.

private void mandelbrot() // calculate all points
                {
                    int x, y;
                    float h, b, alt = 0.0f;

                    action = false;
                    setCursor(c1);}
                    public function setCursor;
                    float System.WriteLine("Mandelbrot-Set will be produced - please wait...");
                    //float showStatus("Mandelbrot-Set will be produced - please wait...");
                    for (int x = 0; x < x1; x += 2) 
                        for (int y = 0; y < y1; y++) 
                        {
                            h = pointcolour(xstart + xzoom * (double)x, ystart + yzoom * (double)y); // color value
                            if (h != alt)
                            {
                                b = 1.0f - h * h; // brightnes
                                ///djm added
                                ///HSBcol.fromHSB(h,0.8f,b); //convert hsb to rgb then make a Java Color
                                ///Color col = new Color(0,HSBcol.rChan,HSBcol.gChan,HSBcol.bChan);
                                ///g1.setColor(col);
                                //djm end
                                //djm added to convert to RGB from HSB

                                g1.setColor(Color.getHSBColor(h, 0.8f, b));
                                //djm test
                                Color col = Color.getHSBColor(h, 0.8f, b);
                                int red = col.getRed();
                                int green = col.getGreen();
                                int blue = col.getBlue();
                                //djm 
                                alt = h;
                            }
                            g1.drawLine(x, y, x + 1, y);
                        }
                    showStatus("Mandelbrot-Set ready - please select zoom area with pressed mouse.");
                    setCursor(c2);
                    action = true;
        }

If anyone can offer me some advice on how to resolve some of these issues that would be great. I know there are quite a few, but if anyone can give me some tips on the best way of tackling a conversion like this or point me in the direction to resolving this, then I would really appreciate it. Thnks a lot for your time and help.

regards

Recommended Answers

All 2 Replies

Hi, thanks very much for this, I apprciate the help, I'll take a loook at the link and see what I can do.

regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.