Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Donatello 2 #773

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
cdabbb7
added nodes back in
i-make-robots Jan 7, 2025
ae08a54
updated to donatello 1.2
i-make-robots Jan 11, 2025
4c953f8
open classes for maven tasks
i-make-robots Jan 11, 2025
7f529a4
upgrade dependencies
i-make-robots Jan 13, 2025
3bf0b1b
added Texture factory to reload as needed
i-make-robots Jan 13, 2025
5fb0c38
fix docking tabs reshape issue
i-make-robots Jan 13, 2025
d899429
update parseJSON to fromJSON
i-make-robots Jan 15, 2025
b78ca70
add showTravel and travelColor
i-make-robots Jan 15, 2025
0683fb8
add try/catch for debugging
i-make-robots Jan 15, 2025
44fedf2
fixed Show travel boolean (should be input)
i-make-robots Jan 15, 2025
fbb5e60
removed done and simple for being duplicate.
i-make-robots Jan 15, 2025
6cc2915
use parallel streams to run faster
i-make-robots Jan 15, 2025
55d708b
use simpler sampling
i-make-robots Jan 15, 2025
530553a
optimize sample() for speed.
i-make-robots Jan 15, 2025
13d940b
Update LineWeightByImage.java
i-make-robots Jan 15, 2025
baad469
added option to fill circles
i-make-robots Jan 15, 2025
2670276
added comments
i-make-robots Jan 16, 2025
6362748
added GradientNoise and TruchetTiles nodes
i-make-robots Jan 16, 2025
1926959
use parallel streams for faster weighting
i-make-robots Jan 16, 2025
eb025e7
minor optimizations
i-make-robots Jan 16, 2025
91d31bf
small optimizations
i-make-robots Jan 17, 2025
32ed3e1
Merge branch 'master' into donatello-2
i-make-robots Jan 17, 2025
e98a2d3
update dependencies
i-make-robots Jan 17, 2025
956ddd8
donatello 1.2.7, nodegraphcore 1.0.28
i-make-robots Jan 21, 2025
4db3283
added line thickness
i-make-robots Jan 21, 2025
73cbb8e
Merge branch 'master' into donatello-2
i-make-robots Jan 22, 2025
610a594
switched to jitpack again
i-make-robots Jan 22, 2025
d9adec8
added missing translation in english and german
i-make-robots Jan 22, 2025
da41b4b
merge metainf-services
i-make-robots Jan 23, 2025
9b084ea
simplified node registration
i-make-robots Jan 23, 2025
ec1ac25
added "Window" menu and english/german translations
i-make-robots Jan 23, 2025
fe82c79
7.63.0
i-make-robots Jan 23, 2025
1bc8afe
use jitpack
i-make-robots Jan 23, 2025
e8f9b67
Merge branch 'master' into donatello-2
i-make-robots Jan 23, 2025
69cd50e
added descriptions
i-make-robots Jan 24, 2025
65a8740
catch path strings surrounded by quotation marks
i-make-robots Jan 25, 2025
16f1ded
added TurtlePathWalker and test
i-make-robots Jan 25, 2025
e7ba93d
better exception message
i-make-robots Jan 25, 2025
ae6137d
Spiral working the way I want
i-make-robots Jan 25, 2025
41a9a7b
Implement #774
i-make-robots Jan 26, 2025
332c114
position dropped item at cursor
i-make-robots Jan 26, 2025
d8f1b47
use donatello 1.2.9
i-make-robots Jan 26, 2025
c66b229
cleanup
i-make-robots Jan 27, 2025
02f18bb
updated translations to use Java's ResourceBundle system
i-make-robots Jan 27, 2025
4c95708
adjust all noise to range -1....1 and reset correctly
i-make-robots Jan 27, 2025
3665a9f
Create FlowField.java
i-make-robots Jan 27, 2025
5484795
use correct noise range
i-make-robots Jan 27, 2025
4b0b8b9
show progress bars and improve iterative speed
i-make-robots Jan 27, 2025
ce5d0dc
Delete DialogBadFirmwareVersion.java
i-make-robots Jan 28, 2025
7c8e429
added kinogaki inspiration
i-make-robots Jan 28, 2025
7ad225c
Create Canvas Node
i-make-robots Jan 28, 2025
95864fc
Create ShowCellularNoise.java
i-make-robots Jan 28, 2025
d44cf42
fixed seed for less "diagonal" patterns
i-make-robots Jan 28, 2025
767df30
lost of optimizing
i-make-robots Jan 28, 2025
604d680
added a FlowDrawer
i-make-robots Jan 28, 2025
e5e6e28
Polyline variables now private
i-make-robots Jan 29, 2025
790b694
fix display of metrics question
i-make-robots Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ It pairs really well with [Marlin 3D printer firmware](https://github.com/Margin

## Where to go from here
- [Join our Discord community](https://discord.gg/QtvHqAv8yp). Share your creations, make new friends! The best place to get support.
- Buy a [Makelangelo 5](https://www.marginallyclever.com/products/makelangelo-5/) hanging plotter.
- Read more of [our friendly manuals](http://mcr.dozuki.com). Pictures and arrows and everything.
- Build your own plotter and setup [Marlin 3D printer firmware](https://github.com/MarginallyClever/Marlin-polargraph/tree/2.1.x-polargraph) with the help of the [documentation](https://www.marginallyclever.com/2021/10/friday-facts-4-how-to-marlin-polargraph/).
- Buy a [Makelangelo 5](https://www.marginallyclever.com/products/makelangelo-5/) vertical plotter.

## Developers
## Developers + Translators

- [Join our Discord community](https://discord.gg/QtvHqAv8yp). Share your creations, make new friends!
- Translations are organized through https://crowdin.com/project/makelangelo and your help is very welcome.
- Please see the [developer getting started wiki page](https://github.com/MarginallyClever/Makelangelo-software/wiki/Getting-Started-for-Developers) for tips on setting up your local copy of the project, connecting to an IDE, and building from the console.
- Also check out the [contributing guide](https://github.com/MarginallyClever/Makelangelo-software/blob/master/CONTRIBUTING.md).

Expand All @@ -43,3 +43,4 @@ Makelangelo is derived from the work of Paul Fisher. It is largely inspired by [
- Icons from [Famfamfam silk icons](http://www.famfamfam.com/lab/icons/silk/), Creative Commons Attribution 3.0 License
- App icons provided by http://icons8.com.
- Ramps v1.4 drawing from [Reprap](Wikihttps://reprap.org/wiki/File:Rampsv14_wiring_psu.png), GPL v2
- Inspiration from [Kinogaki](https://app.kinogaki.com/)
1 change: 1 addition & 0 deletions graphViewSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"connectionPointColor":-4144960,"drawCursor":true,"panelGridColor":-4934476,"nodeColorTitleFont":-1,"nodeColorBackground":-1,"nodeColorInternalBorder":-12566464,"panelColorBackground":-4144960,"drawOrigin":true,"nodeColorBorder":-16777216,"cornerRadius":5,"nodeColorFontClean":-16777216,"gridSize":20,"nodeColorTitleBackground":-16777216,"drawBackground":true,"nodeColorFontDirty":-65536,"connectionColor":-16776961}
45 changes: 43 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.5.0-rc-20230523</version>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.5.0-rc-20230523</version>
<version>2.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
Expand Down Expand Up @@ -531,6 +531,12 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<artifactId>flatlaf</artifactId>
<version>3.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.weisj/jsvg -->
<dependency>
<groupId>com.github.weisj</groupId>
<artifactId>jsvg</artifactId>
<version>1.3.0</version>
</dependency>

<!-- for voronoi -->
<!-- https://mvnrepository.com/artifact/org.locationtech.jts/jts -->
Expand All @@ -550,6 +556,41 @@ It pairs really well with Marlin-polargraph, the code in the brain of the robot
<version>0.10.2</version>
<scope>compile</scope>
</dependency>

<!-- dockable windows -->
<dependency>
<groupId>io.github.andrewauclair</groupId>
<artifactId>modern-docking-api</artifactId>
<version>0.11.6</version>
</dependency>
<dependency>
<groupId>io.github.andrewauclair</groupId>
<artifactId>modern-docking-single-app</artifactId>
<version>0.11.6</version>
</dependency>
<dependency>
<groupId>io.github.andrewauclair</groupId>
<artifactId>modern-docking-ui</artifactId>
<version>0.11.6</version>
</dependency>
<dependency>
<groupId>com.github.sarxos</groupId>
<artifactId>webcam-capture</artifactId>
<version>0.3.12</version>
</dependency>

<!-- donatello -->
<dependency>
<groupId>com.github.marginallyclever</groupId>
<artifactId>nodegraphcore</artifactId>
<version>1.0.28</version>
</dependency>
<dependency>
<groupId>com.github.marginallyclever</groupId>
<artifactId>donatello</artifactId>
<version>1.2.9</version>
</dependency>

<!-- read audio files -->
<dependency>
<groupId>com.github.umjammer</groupId>
Expand Down
5 changes: 5 additions & 0 deletions src/main/assembly/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
<unpack>true</unpack>
</dependencySet>
</dependencySets>
<containerDescriptorHandlers>
<containerDescriptorHandler>
<handlerName>metaInf-services</handlerName>
</containerDescriptorHandler>
</containerDescriptorHandlers>

</assembly>
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package com.marginallyclever.convenience.helpers;

import com.jogamp.opengl.GL2;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureIO;
import com.marginallyclever.convenience.FileAccess;
import com.marginallyclever.makelangelo.texture.TextureWithMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedInputStream;
import java.io.IOException;

public class DrawingHelper {
private static final Logger logger = LoggerFactory.getLogger(DrawingHelper.class);

Expand Down Expand Up @@ -73,21 +68,6 @@ public static void drawRectangle(GL2 gl2, double top, double right, double botto
gl2.glEnd();
}

/**
* Load the given file from the classpath. Make sure the size of the picture is a power of 2
* @param name filename
* @return a texture
*/
public static Texture loadTexture(String name) {
Texture tex = null;
try (BufferedInputStream bis = FileAccess.open(name)) {
tex = TextureIO.newTexture(bis, false, name.substring(name.lastIndexOf('.') + 1));
} catch (IOException e) {
logger.warn("Can't load {}", name, e);
}
return tex;
}

/**
* Paint a quad with the given texture
* @param gl2 the render context
Expand All @@ -96,7 +76,7 @@ public static Texture loadTexture(String name) {
* @param width with of the texture
* @param height height of the texture
*/
public static void paintTexture(GL2 gl2, Texture texture, double x, double y, double width, double height) {
public static void paintTexture(GL2 gl2, TextureWithMetadata texture, double x, double y, double width, double height) {
texture.bind(gl2);
gl2.glColor4d(1, 1, 1, 1);
gl2.glEnable(GL2.GL_TEXTURE_2D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
* of SIGGRAPH 96.</pre>
*/
public class CellularNoise implements Noise {
/**
* The maximum distance that a point can be from another point.
*/
private final double MAX_DIST = Math.sqrt(3.0)/2.0;
private final Random random = new Random();

/**
* Represents a point in three dimensional space.
*
Expand Down Expand Up @@ -63,6 +69,11 @@ public double distanceSquared(Point other)
}
}

@Override
public void setSeed(int seed) {
random.setSeed(seed);
}

@Override
public double noise(double xin) {
return noise(xin,0,0);
Expand All @@ -73,6 +84,22 @@ public double noise(double xin, double yin) {
return noise(xin,yin,0);
}

/**
* Gets the noise value at the provided location.
*
* @param x
* the x coordinate.
* @param y
* the y coordinate.
* @param z
* the z coordinate.
* @return the noise value at the coordinate.
*/
public double noise(double x, double y, double z)
{
return (minimumDistance(random, new Point(x, y, z)) / MAX_DIST)*2.0-1.0;
}

private int floor(double n) {
return n > 0 ? (int) n : (int) n - 1;
}
Expand Down Expand Up @@ -182,7 +209,8 @@ private double minimumDistance(Random r, Point origin) {
*/
private double processVoxel(Random r, Point p, double s, int x, int y, int z) {
// reset random number generator for the voxel
r.setSeed(x + y + z);
long seed = x * 73856093L ^ y * 19349663L ^ z * 83492791L;
r.setSeed(seed);
// each voxel always has one point
Point created = new Point(
x + r.nextDouble(),
Expand All @@ -198,20 +226,4 @@ private double processVoxel(Random r, Point p, double s, int x, int y, int z) {
private double square(double n) {
return n * n;
}

/**
* Gets the noise value at the provided location.
*
* @param x
* the x coordinate.
* @param y
* the y coordinate.
* @param z
* the z coordinate.
* @return the noise value at the coordinate.
*/
public double noise(double x, double y, double z)
{
return minimumDistance(new Random(), new Point(x, y, z));
}
}
25 changes: 20 additions & 5 deletions src/main/java/com/marginallyclever/convenience/noise/Noise.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
package com.marginallyclever.convenience.noise;

public interface Noise {
// 1D noise
void setSeed(int seed);

/**
* 1D noise
* @param xin a double
* @return a double [-1...1]
*/
double noise(double xin);

// 2D noise
/**
* 2D noise
* @param xin a double
* @param yin a double
* @return a double [-1...1]
*/
double noise(double xin, double yin);

// 3D noise
/**
* 3D noise
* @param xin a double
* @param yin a double
* @param zin a double
* @return a double [-1...1]
*/
double noise(double xin, double yin,double zin);

//double noise(double xin, double yin,double zin,double win);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,29 @@ public PerlinNoise() {
}
}

/**
* 1D Perlin noise.
* @param x
* @return value from -1 to 1.
*/
@Override
public double noise(double x) {
return noise(x,0,0);
}

/**
* 2D Perlin noise.
* @param x
* @param y
* @return value from -1 to 1.
*/
@Override
public double noise(double x, double y) {
return noise(x,y,0);
}

/**
* 2D Perlin noise. Returns value from -1 to 1.
* 3D Perlin noise.
* @param x
* @param y
* @param z
Expand Down Expand Up @@ -90,4 +101,9 @@ private double grad(int hash, double x, double y, double z) {
v = h<4 ? y : h==12||h==14 ? x : z;
return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v);
}

@Override
public void setSeed(int seed) {
// not used
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,9 @@ public double noise(double x, double y, double z, double w) {
// Sum up and scale the result to cover the range [-1,1]
return 27.0 * (n0 + n1 + n2 + n3 + n4);
}

@Override
public void setSeed(int seed) {
// not used
}
}

This file was deleted.

42 changes: 42 additions & 0 deletions src/main/java/com/marginallyclever/makelangelo/DockingPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.marginallyclever.makelangelo;

import ModernDocking.Dockable;
import ModernDocking.app.Docking;

import javax.swing.*;
import java.awt.*;

/**
* {@link DockingPanel} is a {@link JPanel} that implements {@link Dockable}.
*/
public class DockingPanel extends JPanel implements Dockable {
private final String tabText;
private final String persistentID;

public DockingPanel(String persistentID, String tabText) {
super(new BorderLayout());
this.persistentID = persistentID;
this.tabText = tabText;
Docking.registerDockable(this);
}

@Override
public String getPersistentID() {
return persistentID;
}

@Override
public String getTabText() {
return tabText;
}

/**
* Refuse to wrap this {@link DockingPanel} in a {@link JScrollPane}. The panel is responsibile for scrolling,
* not the docking system.
* @return false
*/
@Override
public boolean isWrappableInScrollpane() {
return false;
}
}
Loading
Loading