Working on a Processing library/program to store all my most used/fav functions

Please feel free to check it out and give me some feedback, its just a start for now, and i will be improving it as I go along, I will be making another version with PVectors too.

Things I plan to add in the future perlin noise, maze algorithm, pathfinder, and trees

https://www.openprocessing.org/sketch/792353

5 Likes

Heres the current progress,

I’ve added a menu system, which includes menus submenus and buttons, I have yet to implement sliders.

Menus are created in one line


buttons are linked to menus, and buttons can further become submenus.
Everything comes with customisability, such as border size, color, fill, highlight, etc. I have yet to make the menu drag function work correctly. You can choose between radio and checkboxes or standard text buttons. The radio and checkbox aren’t complete yet though.

I am currently working on adding textboxes and scrollable text areas, which again would follow the same pattern and have linked parents.

button functions are then called in one line like this;


the toggle2 function interacts with a hashmap inside a given class to toggle certain booleans. Each button comes with its own toggle option two for simpler operations. and I’m going to add a simple click function for when certain booleans are linked to one another.

Boundary class, allows you to add a variety of shapes and lines, ellipse rectangle and line, are ready to go, though I’ve yet to add proper collision, as this will require a matrix class to handle dot products. I will be including bezier curves, convex poligons, concave poligons, triangles, curves, and waves. Again everything will be customizable and draggable.

The pallet on the left will have quick access to the buttons and a color pallet to change the fill and stroke. I will add center of mass to each of the shapes, with a choice to set your own so that you can have interesting physics.

The grid, is really just a array of objects, which can interact with each other and the shapes, the shape and color are customizable. There positions over time are stored in an array and can be replayed through the pause rewind of forward buttons, I will add more functionality later. I have added gravity as an option to the attractors, and once the matrix class is added, will have proper collision for all shapes and their rotations.

grid is called in one line, xpos, ypos, width height, cols, rows;

and all customisations is linkable to buttons. I will add integrated genetic algorithm into the grid class, along with game of life and maze, which will be callable with one boolean, and hopefully later on machine learning.

The grid will also be able to be used to generate terrain through the perlin noise function, or movable cloth.
Also added a 2d plot, and am working on its 3d counterpart.

Finally I have added windows and scenes. Windows are essentially just boxes, and scenes will be navigate-able.

1 Like

The project is now on github.

2 Likes

2d perlin noise now added, Generate random terrain using perlin noise, next to add map travelling capabilities.

terrain, or random color;

map travelling capabilities added, along with 3d view.

ezgif-4-831571c6ea51

3 Likes

also added a simplistic zoom function

Sliders now added to control rotation, scale, and depth, again everything can be controlled with the sliders and the use of hashmaps. Next I will continue adding more shape creation begining with the poligons above four sides curves and beziers. The only thing Im struggling to find is a good way of detecting ellipse collision. I have successfully added point to ellipse collision but line to ellipse or ellipse to ellipse will be very tricky.

I have begun to add kernel convolutions

image

accessed through image menu, this shall be extended to include webcam feed and data.

image

Please note that alpha does not work with P2D, not sure why.
simply create a new grid, and load an image.

image

this will give a list of sliders for interaction, note functionality has not yet been completely implemented.
image

and a menu to choose between filters

Mouse interaction
image

line detection
image

along with alpha

image

sharpening

image

alternative line detection

image

I shall add more as I go.

2 Likes

Added webcam functionality, image filters color detection and line detection will follow;

2d perlin noise maps can now be contoured.

improved sliders,

added rgb sliders class

image

listbox class to facilitate menus

image

and sliderbox to facilitate multiple sliders

image

image

also switch to vertical sliders with a setter function

image

The code is not being syncronized on the Github project; or is it somewhere else?

1 Like

should be up to date

I can not find the filter functions.

if you are talking about the image filters, I’ve put them in the Grid class. Its called in the Buttons tab, var “g” creates the terrain, “gimg” creates the image filter, and “gcam” creates the webcam.

Webcam currently has no filters.

Please also note that I’m still very much learning programming and haven’t yet implemented reflections to simplify the sliders and buttons. This should be done over the next week but for now you have to add, the variable you are changing to the values hashmap usually found in most of the classes, you have to add it in the constructor, or the spawn() function of the class, and the event listener. Look at the Grid class if you want to see how I’ve implemented it.

Its really hacky and not ideal but works for now.

1 Like

For now I’ve added Brightness filter, sharpening, mouse mask and line detection. Some of these have slider functionality.

1 Like

Sliders have now been finished, and no longer require a hashmap table to function

simply creat the slider, then in mousedragged assign the slider min and max value and the object you are interacting with and the variable you are changing, and finally set said variable to public. Done

image

image

this example connects sliders that share a trait in a menu, for greater fluidity, but in this instance you can also call them using the sliderBox class, and name them individually later to save time.

image

I’ve now added different types of entities, Humans, animals, plants, minerals, and have added Boundaries.

Boundaries can be created individually with code or using the shape menu, simple shapes only so far, ellipse, rectangles and triangles.

All entities can interact with the boundaries and either seek or avoid them.
All entities can spawn other entities according to certain rules, no mating or genetic algorithm yet.
All entities can keep track of their family and or children, and seek or avoid them.

please note polymorphysm isnt completely implemented yet as I didnt completely understand it, shall be done next.

Gravity, rotation boundary stretching and point stretching also added to the shape class, mass and friction in progress.

menu bug fixed,

code on github

2 Likes

Added a simple file manager, some more functionality will be added and kinks ironed out, just wanted to test the difficulty of such a task.

created by calling the Window class and passing a string, its will generate a window with that location.

comes in grid

or vertical scroll.

;

also I have almost finished implementing the boids system from Dan Shiffman’s lesson 6.

These are now fully automatable with sliders. I know I had already implemented boundary travel and detection, but after reading through Dan’s example it was clear which method was better, so my implementation will be scrapped for now, and I will ad in the superior method.

code has been temporarily removed from github as for some reason updates were causing issues, I shall put it back up soon.

I know so far I am just making things which have been covered by many other libraries, but I’m learning as I go and hopefully this can help some.

please note that there is a field behind the boids that takes a total of boid density and boid velocity which allow for other interesting things too.

1 Like