diff --git a/jzy3d-api/src/api/org/jzy3d/chart/Chart.java b/jzy3d-api/src/api/org/jzy3d/chart/Chart.java
index 95e0a76c..67522086 100644
--- a/jzy3d-api/src/api/org/jzy3d/chart/Chart.java
+++ b/jzy3d-api/src/api/org/jzy3d/chart/Chart.java
@@ -85,8 +85,18 @@ public class Chart {
view.setChart(this);
}
+
+
/* HELPERS TO PRETTIFY CHARTS */
+ public Quality getQuality() {
+ return quality;
+ }
+
+ public void setQuality(Quality quality) {
+ this.quality = quality;
+ }
+
public Chart black(){
getView().setBackgroundColor(Color.BLACK);
getAxeLayout().setGridColor(Color.WHITE);
diff --git a/jzy3d-api/src/api/org/jzy3d/maths/Coord3d.java b/jzy3d-api/src/api/org/jzy3d/maths/Coord3d.java
index c9f4254a..b3288587 100644
--- a/jzy3d-api/src/api/org/jzy3d/maths/Coord3d.java
+++ b/jzy3d-api/src/api/org/jzy3d/maths/Coord3d.java
@@ -133,6 +133,14 @@ public class Coord3d implements Serializable{
return this;
}
+ public Coord3d addSelf(float x, float y, float z) {
+ this.x += x;
+ this.y += y;
+ this.z += z;
+ return this;
+ }
+
+
/**
* Add a value to all components of the current Coord and return the result
* in a new Coord3d.
@@ -251,22 +259,29 @@ public class Coord3d implements Serializable{
* Converts the current Coord3d into cartesian coordinates and return the
* result in a new Coord3d.
*
+ * Assume that
+ *
+ * - X represent azimuth
+ *
- Y represent elevation
+ *
- Z represent distance
+ *
+ *
* @return the result Coord3d
*/
public Coord3d cartesian() {
return new Coord3d(Math.cos(x) * Math.cos(y) * z, // azimuth
Math.sin(x) * Math.cos(y) * z, // elevation
Math.sin(y) * z); // range
- /*
- * return new Coord3d( Math.sin(x) * Math.cos(y) * z, // azimuth
- * Math.sin(x) * Math.sin(y) * z, // elevation Math.cos(x) * z); //
- * range*
- *
- * return new Coord3d( Math.cos(x) * Math.cos(y) * z, // azimuth
- * Math.sin(x) * Math.cos(y) * z, // elevation Math.sin(y) * z); //
- * range
- */
}
+
+ public Coord3d cartesianSelf() {
+ x = (float)(Math.cos(x) * Math.cos(y) * z); // azimuth
+ y = (float)(Math.sin(x) * Math.cos(y) * z);// elevation
+ z = (float)(Math.sin(y) * z); // range
+ return this;
+ }
+
+
/**
* Converts the current Coord3d into polar coordinates and return the result
@@ -302,11 +317,39 @@ public class Coord3d implements Serializable{
return new Coord3d(a, e, r);
}
+ }
+
+ public Coord3d polarSelf() {
+ double a;
+ double e;
+ double r = Math.sqrt(x * x + y * y + z * z);
+ double d = Math.sqrt(x * x + y * y);
- /*
- * return new Coord3d( Math.atan(y/x), // azimuth Math.acos(z/r), //
- * elevation r); // range
- */
+ // case x=0 and y=0
+ if (d == 0 && z > 0)
+ return new Coord3d(0, Math.PI / 2, r);
+ else if (d == 0 && z <= 0)
+ return new Coord3d(0, -Math.PI / 2, r);
+ // other cases
+ else {
+ // classical case for azimuth
+ if (Math.abs(x / d) < 1)
+ a = Math.acos(x / d) * (y > 0 ? 1 : -1);
+ // special on each pole for azimuth
+ else if (y == 0 && x > 0) // y==0
+ a = 0;
+ else if (y == 0 && x < 0)
+ a = Math.PI;
+ else
+ a = 0;
+
+ e = Math.atan(z / d);
+
+ x = (float)a;
+ y = (float)e;
+ z = (float)r;
+ return this;
+ }
}
/** Compute the distance between two coordinates. */
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/LineStrip.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/LineStrip.java
index 7690996a..2b692cdb 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/LineStrip.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/LineStrip.java
@@ -11,6 +11,8 @@ import org.jzy3d.plot3d.rendering.view.Camera;
import org.jzy3d.plot3d.transform.Transform;
import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2GL3;
import com.jogamp.opengl.glu.GLU;
/**
@@ -91,6 +93,13 @@ public class LineStrip extends AbstractWireframeable {
public void drawLineGL2(GL gl) {
gl.getGL2().glBegin(GL.GL_LINE_STRIP);
+
+ if(stipple){
+ gl.getGL2().glPolygonMode(GL.GL_BACK, GL2GL3.GL_LINE);
+ gl.glEnable(GL2.GL_LINE_STIPPLE);
+ gl.getGL2().glLineStipple(1, (short) 0xAAAA);
+ }
+
gl.getGL2().glLineWidth(wfwidth);
if (wfcolor == null) {
@@ -167,6 +176,10 @@ public class LineStrip extends AbstractWireframeable {
bbox.add(point);
}
+ public void add(Coord3d coord3d) {
+ add(new Point(coord3d));
+ }
+
public void addAll(List points) {
for (Point p : points)
add(p);
@@ -211,6 +224,14 @@ public class LineStrip extends AbstractWireframeable {
public void setShowPoints(boolean showPoints) {
this.showPoints = showPoints;
}
+
+ public boolean isStipple() {
+ return stipple;
+ }
+
+ public void setStipple(boolean stipple) {
+ this.stipple = stipple;
+ }
@Override
public double getDistance(Camera camera) {
@@ -277,4 +298,5 @@ public class LineStrip extends AbstractWireframeable {
protected List points;
protected float width;
protected boolean showPoints = false;
+ protected boolean stipple = false;
}
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBase.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBase.java
index e3ccadc6..63b59a3d 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBase.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBase.java
@@ -147,4 +147,9 @@ public class AxeBase implements IAxe {
// TODO Auto-generated method stub
}
+
+ @Override
+ public BoundingBox3d getWholeBounds() {
+ return bbox;
+ }
}
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBox.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBox.java
index f8fb9660..6bd90ae2 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBox.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/AxeBox.java
@@ -1128,6 +1128,7 @@ public class AxeBox implements IAxe {
* texts. This requires calling {@link draw()} before, which computes actual
* ticks position in 3d, and updates the bounds.
*/
+ @Override
public BoundingBox3d getWholeBounds() {
return wholeBounds;
}
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/IAxe.java b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/IAxe.java
index 4bd1f578..61e051d8 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/IAxe.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/primitives/axes/IAxe.java
@@ -31,4 +31,6 @@ public interface IAxe {
public SpaceTransformer getSpaceTransformer();
public void setSpaceTransformer(SpaceTransformer spaceTransformer) ;
+
+ public BoundingBox3d getWholeBounds();
}
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java
index adb33778..61ab7faf 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/rendering/view/Camera.java
@@ -331,7 +331,7 @@ public class Camera extends AbstractViewportManager {
if (failOnException)
throw new RuntimeException(message);
else
- Logger.getLogger(Camera.class).warn(message);
+ Logger.getLogger(Camera.class).debug(message);
}
boolean failOnException = false;
diff --git a/jzy3d-api/src/api/org/jzy3d/plot3d/text/renderers/TextBitmapRenderer.java b/jzy3d-api/src/api/org/jzy3d/plot3d/text/renderers/TextBitmapRenderer.java
index cf4628d9..7af6dc1a 100644
--- a/jzy3d-api/src/api/org/jzy3d/plot3d/text/renderers/TextBitmapRenderer.java
+++ b/jzy3d-api/src/api/org/jzy3d/plot3d/text/renderers/TextBitmapRenderer.java
@@ -22,6 +22,24 @@ import com.jogamp.opengl.util.gl2.GLUT;
* @author Martin
*/
public class TextBitmapRenderer extends AbstractTextRenderer implements ITextRenderer {
+ /**
+ * GL Font code and size in pixel to initialize rendeer.
+ */
+ public enum Font{
+ Helvetica_10(GLUT.BITMAP_HELVETICA_10, 10),
+ Helvetica_12(GLUT.BITMAP_HELVETICA_12, 12),
+ Helvetica_18(GLUT.BITMAP_HELVETICA_18, 18),
+ TimesRoman_10(GLUT.BITMAP_TIMES_ROMAN_10, 10),
+ TimesRoman_24(GLUT.BITMAP_TIMES_ROMAN_24, 24);
+
+ Font(int code, int height){
+ this.code = code;
+ this.height = height;
+ }
+
+ protected int code;
+ protected int height;
+ }
/**
* The TextBitmap class provides support for drawing ASCII characters Any
* non ascii caracter will be replaced by a square.
@@ -32,6 +50,16 @@ public class TextBitmapRenderer extends AbstractTextRenderer implements ITextRen
fontHeight = 10;
}
+ public TextBitmapRenderer(Font font) {
+ this(font.code, font.height);
+ }
+
+ public TextBitmapRenderer(int font, int fontSize) {
+ super();
+ this.font = font;
+ this.fontHeight = fontSize;
+ }
+
@Override
public void drawSimpleText(GL gl, GLU glu, Camera cam, String s, Coord3d position, Color color) {
if (gl.isGL2()) {
diff --git a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/AWTView.java b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/AWTView.java
index 3c5301b3..83768c8b 100644
--- a/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/AWTView.java
+++ b/jzy3d-api/src/awt/org/jzy3d/plot3d/rendering/view/AWTView.java
@@ -76,8 +76,8 @@ public class AWTView extends ChartView {
axe.draw(gl, glu, cam);
clear(gl);
- AxeBox abox = (AxeBox) axe;
- BoundingBox3d newBounds = abox.getWholeBounds().scale(scaling);
+ //AxeBox abox = (AxeBox) axe;
+ BoundingBox3d newBounds = axe.getWholeBounds().scale(scaling);
if (viewmode == ViewPositionMode.TOP) {
float radius = Math.max(newBounds.getXmax() - newBounds.getXmin(), newBounds.getYmax() - newBounds.getYmin()) / 2;