Giter Site home page Giter Site logo

fractal-bull's People

Contributors

kratok avatar

Watchers

 avatar

fractal-bull's Issues

drawProgram

Things to do:
System to color the created image, based on values inside of the algorithim/array

Basic interactive format for starting iterations, changing the system in use, and other features

Scaling the produced image without losing information

Basic cleaning and note-whatevers

drawingProgram

import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.Random;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

import javax.swing.Timer;

public class drawingProgram implements ActionListener
{
private BufferedImage buffer;
private Graphics canvas;
private Random rand = new Random();
private Timer myTimer;
private Processor objects;
private Picture myPic;
private static int WIDTH = 600;
private static int HEIGHT = 600;
private Color[] colors = new Color[10];
{
colors[0] = Color.red;
colors[1] = Color.orange;
colors[2] = Color.yellow;
colors[3] = Color.green;
colors[4] = Color.cyan;
colors[5] = Color.blue;
colors[6] = Color.magenta;
colors[7] = Color.pink;
colors[8] = Color.white;
colors[9] = Color.black;

}
private byte radius;
private int originX = WIDTH / 2;
private int originY = HEIGHT / 2;
private int lengthX;
private int lengthY;
private int objectCheck = 0;

public void fold()
{
canvas.setColor(Color.WHITE);
canvas.fillRect(0, 0, WIDTH, HEIGHT);
objects.foldLine();
objects.cycleLine();
lengthX = (int) (WIDTH/objects.height);
lengthY = (int) (HEIGHT/objects.height);
canvas.setColor(Color.BLACK);
canvas.fillRect(10, 10, 10, 10);
// for(int i = 0; i > objects.folds; i++)
// {
originX = WIDTH/2;
originY = HEIGHT/2;
for(int i = 0; i < objects.folds; i++)
{
int dummyX = originX;
int dummyY = originY;
switch (objects.lineObject[i])
{
case 0:
dummyY = originY + lengthY;
break;
case 1:
dummyX = originX + lengthX;
break;
case 2:
dummyY = originY - lengthY;
break;
case 3:
dummyX = originX - lengthX;
break;
}
canvas.setColor(Color.BLACK);
canvas.drawLine(originX, originY, dummyX, dummyY);
originX = dummyX;
originY = dummyY;
}
canvas.fillRect(200, 10, 10, 10);
if (objectCheck == objects.folds) objectCheck = 0;
myPic.repaint();
}

public drawingProgram()
{

myPic = new Picture(WIDTH, HEIGHT);
canvas = myPic.getOffScreenGraphics();
canvas.setColor(Color.WHITE);
canvas.fillRect(0, 0, WIDTH, HEIGHT);
objects = new Processor();

myPic.setTitle("WEASELS");
myTimer = new Timer(1000, this); // miliseconds
System.out.println("STARTING");
myTimer.start();

}

public static void main(String[] args)
{
drawingProgram myDraw = new drawingProgram();

}

public void actionPerformed(ActionEvent arg0)
{
fold();
myPic.repaint();
}
}

Processor

Make the array system into some dynamic form based on the values needed

Figure out a better/more accurate/more efficient algorithm for the information needed

More efficient ways to produce repetitions in information.

Processor

public class Processor
{
private static boolean run = true;
public int folds = 1; //now counts EACH crease. should make it as the power of creases made for(folds) {objects=*objects}
public byte[] lineObject = new byte[1000000]; {lineObject[0] = 2;}
byte[] buffer = new byte[1000000];
public int height; // count how many lines go up or down
public int width; // count how many lines go horizontally
void foldLine()
{
for (int i = 0; i < folds; i++) buffer[i] = lineObject[i];
for (int i = 0; i < folds; i++)
{
//if(folds > lineObject.length)break;
if (buffer[i] == 3) buffer[i] = 0;
else buffer[i]++;
}
for (int i = 0; i < folds; i++)
{
lineObject[folds+i] = buffer[folds-1-i];
}
folds = folds * 2;
}
void cycleLine()
{
height = 0;
width = 0;
for (int i = 0; i < folds; i++)
{
switch (lineObject[i])
{
case 0: height--;
break;
case 1: width++;
break;
case 2: height++;
break;
case 3: width--;
break;
}
}
if(height == 0) height = 1;
System.out.println(height);
height = Math.abs(height);
width = Math.abs(width);
}
}
//Take the whole object by its beginning, rotate it 90 to the right, and add it to the object
//for every fold create a byte that is 0 1 2 3 to lead the cardinal directions for a fold
// Starting from the bottom (red)
// 2, 2 3, 2 3 0 3, "" 0 1 0 3, "" 0 1 2 1 0 1 0 3,
// Start with last line object, flip all values, increment, insert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.