diff --git a/pom.xml b/pom.xml index 04c383872..a070e73c4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.marginallyclever Makelangelo - 7.41.0 + 7.41.3 Makelangelo Makelangelo Software is a Java program that prepares art for CNC plotters. It is especially designed for the Makelangelo Robot. It pairs really well with Marlin-polargraph, the code in the brain of the robot that receives instructions and moves the motors. diff --git a/src/main/java/com/marginallyclever/makelangelo/makeart/imageconverter/Converter_IntensityToHeight.java b/src/main/java/com/marginallyclever/makelangelo/makeart/imageconverter/Converter_IntensityToHeight.java index cbfbf15ed..cc8b615ba 100644 --- a/src/main/java/com/marginallyclever/makelangelo/makeart/imageconverter/Converter_IntensityToHeight.java +++ b/src/main/java/com/marginallyclever/makelangelo/makeart/imageconverter/Converter_IntensityToHeight.java @@ -15,33 +15,36 @@ * @since 7.40.3 */ public class Converter_IntensityToHeight extends ImageConverter { + // vertical distance between lines private static int spacing = 2; - private static int maxHeight = 10; + // horizontal distance between samples. more samples = more detail. private static int sampleRate = 5; + // max height of the wave will be +/-(waveIntensity/2) + private static int waveIntensity = 30; public Converter_IntensityToHeight() { super(); SelectSlider selectSize = new SelectSlider("size",Translator.get("Converter_IntensityToHeight.spacing"), 20,1,getSpacing()); - SelectSlider selectMaxHeight = new SelectSlider("maxHeight",Translator.get("Converter_IntensityToHeight.maxHeight"),20,1,getMaxHeight()); SelectSlider selectSampleRate = new SelectSlider("sampleRate",Translator.get("Converter_IntensityToHeight.sampleRate"),20,1,getSampleRate()); + SelectSlider selectWaveIntensity = new SelectSlider("waveIntensity",Translator.get("Converter_IntensityToHeight.waveIntensity"),50,-50,getWaveIntensity()); add(selectSize); - add(selectMaxHeight); add(selectSampleRate); + add(selectWaveIntensity); selectSize.addPropertyChangeListener(evt->{ setSpacing((int) evt.getNewValue()); fireRestart(); }); - selectMaxHeight.addPropertyChangeListener(evt->{ - setMaxHeight((int) evt.getNewValue()); - fireRestart(); - }); selectSampleRate.addPropertyChangeListener(evt->{ setSampleRate((int) evt.getNewValue()); fireRestart(); }); + selectWaveIntensity.addPropertyChangeListener(evt->{ + setWaveIntensity((int) evt.getNewValue()); + fireRestart(); + }); } @Override @@ -63,11 +66,11 @@ public void setSampleRate(int value) { sampleRate = Math.max(1,value); } - public int getMaxHeight() { - return maxHeight; + public int getWaveIntensity(){ + return waveIntensity; } - public void setMaxHeight(int value) { - maxHeight = Math.max(1,value); + public void setWaveIntensity(int value){ + waveIntensity = value; } protected void convertLine(TransformedImage img, double sampleSpacing, double halfStep, Point2D a, Point2D b) { @@ -83,11 +86,10 @@ protected void convertLine(TransformedImage img, double sampleSpacing, double ha // read a block of the image and find the average intensity in this block double z = img.sample( x - sampleSpacing, y - halfStep, x + sampleSpacing, y + halfStep); // scale the intensity value - double scale_z = z / 255.0f; - scale_z = (scale_z-0.5)*2.0; + double scale_z = 1 - z / 255.0f; //scale_z *= scale_z; // quadratic curve - double pulseSize = halfStep * scale_z; - double py=y + pulseSize; + double pulseSize = waveIntensity * scale_z; + double py=y + pulseSize - waveIntensity/2.0f; if(first) { turtle.jumpTo(x, py); first = false; @@ -128,7 +130,7 @@ public void start(Paper paper, TransformedImage image) { a.set(xRight,y); b.set(xLeft,y); } - convertLine(img,sampleRate,maxHeight,a,b); + convertLine(img,sampleRate,sampleRate/2.0,a,b); } fireConversionFinished(); diff --git a/src/main/resources/languages/english.xml b/src/main/resources/languages/english.xml index b11a6b8b7..94baf863b 100644 --- a/src/main/resources/languages/english.xml +++ b/src/main/resources/languages/english.xml @@ -2,21 +2,21 @@ - - - English - Dan Royer (dan@marginallyclever.com) - - - BorderNameOutline paper + + English + Dan Royer (dan@marginallyclever.com) + + + BorderNameOutline paper Generator_TruchetTiles.NameTruchet Tiles Generator_TruchetTiles.LineSpacingSpace between lines (mm) Generator_TruchetTiles.LinesPerTileLines per tile @@ -261,9 +261,9 @@ TurtleGenerators.LearnMore.Link.TextLearn more LoadScratch3.foreverNotAllowedForever loops are forever forbidden. - SaveGCode.splitGCodeTitleMany colors detected + SaveGCode.splitGCodeTitleMany colors detected - Converter_CMYK_Circles.nameCMYK circles + Converter_CMYK_Circles.nameCMYK circles Converter_CMYK_Circles.maxCircleSizemax circle size Converter_EdgeDetection.nameEdge detection @@ -387,6 +387,6 @@ Converter_IntensityToHeight.nameIntensity to height Converter_IntensityToHeight.spacingWave spacing - Converter_IntensityToHeight.maxHeightWave height Converter_IntensityToHeight.sampleRateSample rate - + Converter_IntensityToHeight.waveIntensityWave intensity + \ No newline at end of file