diff --git a/jzy3d-api/dependency-reduced-pom.xml b/jzy3d-api/dependency-reduced-pom.xml new file mode 100644 index 00000000..ddaff55b --- /dev/null +++ b/jzy3d-api/dependency-reduced-pom.xml @@ -0,0 +1,174 @@ + + + + jzy3d-master + org.jzy3d + 1.0.1-SNAPSHOT + + 4.0.0 + org.jzy3d + jzy3d-api + Jzy3d API + A Java API for 3d charts + + src/tests + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + src/api + src/bridge + src/awt + src/swing + src/replay + + + + + + + maven-compiler-plugin + 3.0 + + 1.7 + 1.7 + + + + maven-source-plugin + + + attach-sources + deploy + + jar + + + + + + maven-javadoc-plugin + + + attach-javadocs + deploy + + jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + src/api + src/bridge + src/awt + src/swing + src/replay + + + + + + + maven-surefire-plugin + + + org/jzy3d/junit/ChartTest.java + + + + + maven-jar-plugin + + + maths-io-jar + package + + jar + + + maths-io + + org/jzy3d/* + + + org/jzy3d/maths/** + org/jzy3d/io/* + + + + + + + maven-shade-plugin + 2.4.3 + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + classworlds:classworlds + jmock:* + *:xml-apis + org.apache.maven:lib:tests + + + + + + + + + + + + + + jzy3d-snapshots + Jzy3d Snapshots + http://maven.jzy3d.org/snapshots/ + + + jzy3d-releases + Jzy3d Snapshots + http://maven.jzy3d.org/releases/ + + + + diff --git a/jzy3d-api/pom.xml b/jzy3d-api/pom.xml index fe3dc014..3727a1de 100644 --- a/jzy3d-api/pom.xml +++ b/jzy3d-api/pom.xml @@ -136,6 +136,47 @@ + + + diff --git a/jzy3d-api/src/api/org/jzy3d/colors/Color.java b/jzy3d-api/src/api/org/jzy3d/colors/Color.java index f48cb787..dff704c2 100644 --- a/jzy3d-api/src/api/org/jzy3d/colors/Color.java +++ b/jzy3d-api/src/api/org/jzy3d/colors/Color.java @@ -83,6 +83,15 @@ public class Color { return this; } + public Color mulSelf(float ratio){ + this.r *= ratio; + this.g *= ratio; + this.b *= ratio; + return this; + } + + + /** Return the hexadecimal representation of this color.*/ public String toHex(){ String hexa = "#"; diff --git a/jzy3d-api/src/api/org/jzy3d/maths/Coord3ds.java b/jzy3d-api/src/api/org/jzy3d/maths/Coord3ds.java new file mode 100644 index 00000000..207df0a0 --- /dev/null +++ b/jzy3d-api/src/api/org/jzy3d/maths/Coord3ds.java @@ -0,0 +1,69 @@ +package org.jzy3d.maths; + +import java.util.ArrayList; +import java.util.List; + +import org.jzy3d.colors.Color; + +/** + * A set of points. + * + * @author Martin Pernollet + */ +public class Coord3ds { + public float x[]; + public float y[]; + public float z[]; + + public float r[]; + public float g[]; + public float b[]; + public float a[]; + + public Coord3ds(int size){ + x = new float[size]; + y = new float[size]; + z = new float[size]; + + r = new float[size]; + g = new float[size]; + b = new float[size]; + a = new float[size]; + } + + public void set(int id, float x, float y, float z, float r, float g, float b, float a){ + this.x[id] = x; + this.y[id] = y; + this.z[id] = z; + + this.r[id] = r; + this.g[id] = g; + this.b[id] = b; + this.a[id] = a; + } + + public List coords(){ + List coords = new ArrayList<>(); + for (int i = 0; i < x.length; i++) { + coords.add(new Coord3d(x[i], y[i], z[i])); + } + return coords; + } + + public Coord3d[] coordsArray(){ + Coord3d[] coords = new Coord3d[x.length]; + for (int i = 0; i < x.length; i++) { + coords[i] = new Coord3d(x[i], y[i], z[i]); + } + return coords; + } + + public Color[] colorsArray(){ + Color[] colors = new Color[r.length]; + for (int i = 0; i < r.length; i++) { + colors[i] = new Color(r[i], g[i], b[i], a[i]); + } + return colors; + } + +} diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/Scatter.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/Scatter.java index b062b6be..c4e86447 100644 --- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/Scatter.java +++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/Scatter.java @@ -5,6 +5,7 @@ import org.jzy3d.colors.ISingleColorable; import org.jzy3d.events.DrawableChangedEvent; import org.jzy3d.maths.BoundingBox3d; import org.jzy3d.maths.Coord3d; +import org.jzy3d.maths.Coord3ds; import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils; import org.jzy3d.plot3d.rendering.view.Camera; import org.jzy3d.plot3d.transform.Transform; @@ -41,6 +42,10 @@ public class Scatter extends AbstractDrawable implements ISingleColorable { setColor(rgb); } + public Scatter(Coord3ds coords) { + this(coords.coordsArray(), coords.colorsArray()); + } + public Scatter(Coord3d[] coordinates, Color[] colors) { this(coordinates, colors, 1.0f); } diff --git a/jzy3d-svm-mapper/src/demos/org/jzy3d/svm/demos/Abstract3dDemo.java b/jzy3d-svm-mapper/src/demos/org/jzy3d/svm/demos/Abstract3dDemo.java index b90eba32..fda1d5d8 100644 --- a/jzy3d-svm-mapper/src/demos/org/jzy3d/svm/demos/Abstract3dDemo.java +++ b/jzy3d-svm-mapper/src/demos/org/jzy3d/svm/demos/Abstract3dDemo.java @@ -58,7 +58,9 @@ public abstract class Abstract3dDemo { } protected static Chart getRegressionChart(SvmMapper mapper, Coord3d[] values) { - Chart chart = new AWTChart(Quality.Advanced); + Quality q = Quality.Advanced; + q.setSmoothPoint(true); + Chart chart = new AWTChart(q); // shape BoundingBox3d b = Conversion.getBounds(values); @@ -75,7 +77,7 @@ public abstract class Abstract3dDemo { /* 3d OBJECTS GENERATION */ public static Scatter loadScatter(Chart chart, Coord3d[] coords) { - Scatter scatter = new Scatter(coords, Color.BLACK, 5); + Scatter scatter = new Scatter(coords, Color.GREEN.mulSelf(1.2f), 20); chart.getScene().getGraph().add(scatter); return scatter; } diff --git a/jzy3d-tutorials/pom.xml b/jzy3d-tutorials/pom.xml index 3344a6cd..afed435e 100644 --- a/jzy3d-tutorials/pom.xml +++ b/jzy3d-tutorials/pom.xml @@ -16,7 +16,7 @@ jzy3d-releases - Jzy3d Snapshots + Jzy3d Releases http://maven.jzy3d.org/releases/