mirror of https://github.com/rusefi/jzy3d-api.git
move spacetransform to axebox : logaxebox useless
This commit is contained in:
parent
0cdc958047
commit
a7b0de3ed6
|
@ -1,58 +0,0 @@
|
||||||
package org.jzy3d.chart.factories;
|
|
||||||
|
|
||||||
import org.jzy3d.chart.Chart;
|
|
||||||
import org.jzy3d.chart.factories.IChartComponentFactory.Toolkit;
|
|
||||||
import org.jzy3d.maths.BoundingBox3d;
|
|
||||||
import org.jzy3d.maths.Coord3d;
|
|
||||||
import org.jzy3d.plot3d.primitives.axes.AxeBox;
|
|
||||||
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
|
||||||
import org.jzy3d.plot3d.primitives.axes.LogAxeBox;
|
|
||||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
|
||||||
import org.jzy3d.plot3d.rendering.view.View;
|
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransform;
|
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
|
||||||
|
|
||||||
public class AxeTransformableAWTChartComponentFactory extends AWTChartComponentFactory{
|
|
||||||
|
|
||||||
LogTransformer transformers;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AxeTransformableAWTChartComponentFactory(
|
|
||||||
LogTransformer transformers) {
|
|
||||||
this.transformers = transformers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Chart chart() {
|
|
||||||
return chart(Quality.Intermediate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Chart chart(Quality quality, LogTransformer transformers) {
|
|
||||||
AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformers);
|
|
||||||
return f.newChart(quality, Toolkit.newt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Chart chart(String toolkit, LogTransformer transformers) {
|
|
||||||
AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformers);
|
|
||||||
return f.newChart(Chart.DEFAULT_QUALITY, toolkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Chart chart(Quality quality, Toolkit toolkit, LogTransformer transformers) {
|
|
||||||
AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformers);
|
|
||||||
return f.newChart(quality, toolkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Chart chart(Quality quality, String toolkit, LogTransformer transformers) {
|
|
||||||
AxeTransformableAWTChartComponentFactory f = new AxeTransformableAWTChartComponentFactory(transformers);
|
|
||||||
return f.newChart(quality, toolkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IAxe newAxe(BoundingBox3d box, View view) {
|
|
||||||
LogAxeBox axe = new LogAxeBox(box,transformers);
|
|
||||||
axe.setScale(new Coord3d(10.0,1.0,1.0));
|
|
||||||
axe.setView(view);
|
|
||||||
return axe;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.primitives.Polygon;
|
import org.jzy3d.plot3d.primitives.Polygon;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A BoundingBox3d stores a couple of maximal and minimal limit on each
|
* A BoundingBox3d stores a couple of maximal and minimal limit on each
|
||||||
|
@ -180,7 +180,7 @@ public class BoundingBox3d {
|
||||||
return new Coord3d((xmin + xmax) / 2, (ymin + ymax) / 2, (zmin + zmax) / 2);
|
return new Coord3d((xmin + xmax) / 2, (ymin + ymax) / 2, (zmin + zmax) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Coord3d getTransformedCenter(LogTransformer transformers) {
|
public Coord3d getTransformedCenter(SpaceTransformer transformers) {
|
||||||
return new Coord3d((transformers.getX().compute(xmin) + transformers.getX().compute(xmax)) / 2, (transformers.getY().compute(ymin) + transformers.getY().compute(ymax)) / 2, (transformers.getZ().compute(zmin) + transformers.getZ().compute(zmax)) / 2);
|
return new Coord3d((transformers.getX().compute(xmin) + transformers.getX().compute(xmax)) / 2, (transformers.getY().compute(ymin) + transformers.getY().compute(ymax)) / 2, (transformers.getZ().compute(zmin) + transformers.getZ().compute(zmax)) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class BoundingBox3d {
|
||||||
return getCenter().distance(new Coord3d(xmin, ymin, zmin));
|
return getCenter().distance(new Coord3d(xmin, ymin, zmin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getTransformedRadius(LogTransformer transformers) {
|
public double getTransformedRadius(SpaceTransformer transformers) {
|
||||||
return getTransformedCenter(transformers).distance(transformers.compute(new Coord3d(xmin, ymin, zmin)));
|
return getTransformedCenter(transformers).distance(transformers.compute(new Coord3d(xmin, ymin, zmin)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.jzy3d.plot3d.builder.concrete.RingTessellator;
|
||||||
import org.jzy3d.plot3d.builder.delaunay.DelaunayTessellator;
|
import org.jzy3d.plot3d.builder.delaunay.DelaunayTessellator;
|
||||||
import org.jzy3d.plot3d.primitives.CompileableComposite;
|
import org.jzy3d.plot3d.primitives.CompileableComposite;
|
||||||
import org.jzy3d.plot3d.primitives.Shape;
|
import org.jzy3d.plot3d.primitives.Shape;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
|
|
||||||
public class Builder {
|
public class Builder {
|
||||||
|
@ -71,12 +71,12 @@ public class Builder {
|
||||||
|
|
||||||
/* LOG */
|
/* LOG */
|
||||||
|
|
||||||
public static Shape buildOrthonormalLog(OrthonormalGrid grid, Mapper mapper, LogTransformer transformers) {
|
public static Shape buildOrthonormalLog(OrthonormalGrid grid, Mapper mapper, SpaceTransformer transformers) {
|
||||||
OrthonormalTessellatorLog tesselator = new OrthonormalTessellatorLog(transformers);
|
OrthonormalTessellatorLog tesselator = new OrthonormalTessellatorLog(transformers);
|
||||||
return (Shape) tesselator.build(grid.apply(mapper));
|
return (Shape) tesselator.build(grid.apply(mapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompileableComposite buildOrthonormalBigLog(OrthonormalGrid grid, Mapper mapper, LogTransformer transformers) {
|
public static CompileableComposite buildOrthonormalBigLog(OrthonormalGrid grid, Mapper mapper, SpaceTransformer transformers) {
|
||||||
Tessellator tesselator = new OrthonormalTessellatorLog(transformers);
|
Tessellator tesselator = new OrthonormalTessellatorLog(transformers);
|
||||||
Shape s1 = (Shape) tesselator.build(grid.apply(mapper));
|
Shape s1 = (Shape) tesselator.build(grid.apply(mapper));
|
||||||
return buildComposite(applyStyling(s1));
|
return buildComposite(applyStyling(s1));
|
||||||
|
|
|
@ -3,12 +3,12 @@ package org.jzy3d.plot3d.builder.concrete;
|
||||||
import org.jzy3d.plot3d.primitives.AbstractDrawable;
|
import org.jzy3d.plot3d.primitives.AbstractDrawable;
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.primitives.log.AxeTransformablePolygon;
|
import org.jzy3d.plot3d.primitives.log.AxeTransformablePolygon;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class OrthonormalTessellatorLog extends OrthonormalTessellator {
|
public class OrthonormalTessellatorLog extends OrthonormalTessellator {
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
public OrthonormalTessellatorLog(LogTransformer transformers) {
|
public OrthonormalTessellatorLog(SpaceTransformer transformers) {
|
||||||
super();
|
super();
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.legends.ILegend;
|
import org.jzy3d.plot3d.rendering.legends.ILegend;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.transform.Transform;
|
import org.jzy3d.plot3d.transform.Transform;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link AbstractDrawable} defines objects that may be rendered into an
|
* A {@link AbstractDrawable} defines objects that may be rendered into an
|
||||||
|
@ -98,10 +98,10 @@ public abstract class AbstractDrawable implements IGLRenderer, ISortableDraw {
|
||||||
* If logTransform is non null, then each dimension transform is processed before calling glVertex3d.
|
* If logTransform is non null, then each dimension transform is processed before calling glVertex3d.
|
||||||
*/
|
*/
|
||||||
protected void vertexGL2(GL gl, Coord3d c) {
|
protected void vertexGL2(GL gl, Coord3d c) {
|
||||||
if (logTransformer != null) {
|
if (spaceTransformer == null) {
|
||||||
gl.getGL2().glVertex3f(c.x, c.y, c.z);
|
gl.getGL2().glVertex3f(c.x, c.y, c.z);
|
||||||
} else {
|
} else {
|
||||||
gl.getGL2().glVertex3f(logTransformer.getX().compute(c.x), logTransformer.getY().compute(c.y), logTransformer.getZ().compute(c.z));
|
gl.getGL2().glVertex3f(spaceTransformer.getX().compute(c.x), spaceTransformer.getY().compute(c.y), spaceTransformer.getZ().compute(c.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,11 +110,11 @@ public abstract class AbstractDrawable implements IGLRenderer, ISortableDraw {
|
||||||
* If logTransform is non null, then each dimension transform is processed before calling glVertex3d.
|
* If logTransform is non null, then each dimension transform is processed before calling glVertex3d.
|
||||||
*/
|
*/
|
||||||
protected void vertexGLES2(Coord3d c) {
|
protected void vertexGLES2(Coord3d c) {
|
||||||
if(logTransformer==null){
|
if(spaceTransformer==null){
|
||||||
GLES2CompatUtils.glVertex3f(c.x, c.y, c.z);
|
GLES2CompatUtils.glVertex3f(c.x, c.y, c.z);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
GLES2CompatUtils.glVertex3f(logTransformer.getX().compute(c.x), logTransformer.getY().compute(c.y),logTransformer.getZ().compute(c.z));
|
GLES2CompatUtils.glVertex3f(spaceTransformer.getX().compute(c.x), spaceTransformer.getY().compute(c.y),spaceTransformer.getZ().compute(c.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,12 +283,12 @@ public abstract class AbstractDrawable implements IGLRenderer, ISortableDraw {
|
||||||
this.boundingBoxColor = boundingBoxColor;
|
this.boundingBoxColor = boundingBoxColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogTransformer getLogTransformer() {
|
public SpaceTransformer getSpaceTransformer() {
|
||||||
return logTransformer;
|
return spaceTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogTransformer(LogTransformer logTransformer) {
|
public void setSpaceTransformer(SpaceTransformer spaceTransformer) {
|
||||||
this.logTransformer = logTransformer;
|
this.spaceTransformer = spaceTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -343,6 +343,6 @@ public abstract class AbstractDrawable implements IGLRenderer, ISortableDraw {
|
||||||
protected boolean boundingBoxDisplayed = false;
|
protected boolean boundingBoxDisplayed = false;
|
||||||
protected Color boundingBoxColor = Color.BLACK.clone();
|
protected Color boundingBoxColor = Color.BLACK.clone();
|
||||||
|
|
||||||
protected LogTransformer logTransformer = null;
|
protected SpaceTransformer spaceTransformer = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AxeBase provide a simple 3-segment object which is configured by a
|
* An AxeBase provide a simple 3-segment object which is configured by a
|
||||||
|
@ -109,8 +110,21 @@ public class AxeBase implements IAxe {
|
||||||
public IAxeLayout getLayout() {
|
public IAxeLayout getLayout() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpaceTransformer getSpaceTransformer() {
|
||||||
|
return spaceTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSpaceTransformer(SpaceTransformer spaceTransformer) {
|
||||||
|
this.spaceTransformer = spaceTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
protected Coord3d scale;
|
protected Coord3d scale;
|
||||||
protected BoundingBox3d bbox;
|
protected BoundingBox3d bbox;
|
||||||
protected IAxeLayout layout;
|
protected IAxeLayout layout;
|
||||||
|
|
||||||
|
protected SpaceTransformer spaceTransformer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.maths.Vector3d;
|
import org.jzy3d.maths.Vector3d;
|
||||||
import org.jzy3d.plot3d.primitives.axes.layout.AxeBoxLayout;
|
import org.jzy3d.plot3d.primitives.axes.layout.AxeBoxLayout;
|
||||||
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
||||||
|
import org.jzy3d.plot3d.primitives.log.GlVertexExecutor;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.rendering.view.View;
|
import org.jzy3d.plot3d.rendering.view.View;
|
||||||
|
@ -22,6 +23,7 @@ import org.jzy3d.plot3d.text.ITextRenderer;
|
||||||
import org.jzy3d.plot3d.text.align.Halign;
|
import org.jzy3d.plot3d.text.align.Halign;
|
||||||
import org.jzy3d.plot3d.text.align.Valign;
|
import org.jzy3d.plot3d.text.align.Valign;
|
||||||
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
|
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
|
||||||
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AxeBox displays a box with front face invisible and ticks labels.
|
* The AxeBox displays a box with front face invisible and ticks labels.
|
||||||
|
@ -42,7 +44,7 @@ public class AxeBox implements IAxe {
|
||||||
wholeBounds = new BoundingBox3d();
|
wholeBounds = new BoundingBox3d();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AxeAnnotation> getAnnotations() {
|
public List<AxeAnnotation> getAnnotations() {
|
||||||
return annotations;
|
return annotations;
|
||||||
}
|
}
|
||||||
|
@ -67,16 +69,15 @@ public class AxeBox implements IAxe {
|
||||||
doTransform(gl);
|
doTransform(gl);
|
||||||
drawGrid(gl);
|
drawGrid(gl);
|
||||||
|
|
||||||
for(AxeAnnotation a: annotations){
|
for (AxeAnnotation a : annotations) {
|
||||||
a.draw(gl, this);
|
a.draw(gl, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
doTransform(gl);
|
doTransform(gl);
|
||||||
drawTicksAndLabels(gl, glu, camera);
|
drawTicksAndLabels(gl, glu, camera);
|
||||||
|
|
||||||
|
|
||||||
cullingDisable(gl);
|
cullingDisable(gl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** reset to identity and apply scaling */
|
/** reset to identity and apply scaling */
|
||||||
|
@ -239,7 +240,12 @@ public class AxeBox implements IAxe {
|
||||||
gl.getGL2().glPassThrough(q);
|
gl.getGL2().glPassThrough(q);
|
||||||
gl.getGL2().glBegin(GL2GL3.GL_QUADS);
|
gl.getGL2().glBegin(GL2GL3.GL_QUADS);
|
||||||
for (int v = 0; v < 4; v++) {
|
for (int v = 0; v < 4; v++) {
|
||||||
gl.getGL2().glVertex3f(quadx[q][v], quady[q][v], quadz[q][v]);
|
// gl.getGL2().glVertex3f(quadx[q][v], quady[q][v],
|
||||||
|
// quadz[q][v]);
|
||||||
|
Coord3d quadCoord = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]); // era
|
||||||
|
// qua
|
||||||
|
vertexGL2(gl, quadCoord);
|
||||||
|
|
||||||
}
|
}
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +253,10 @@ public class AxeBox implements IAxe {
|
||||||
GLES2CompatUtils.glPassThrough(q);
|
GLES2CompatUtils.glPassThrough(q);
|
||||||
GLES2CompatUtils.glBegin(GL2GL3.GL_QUADS);
|
GLES2CompatUtils.glBegin(GL2GL3.GL_QUADS);
|
||||||
for (int v = 0; v < 4; v++) {
|
for (int v = 0; v < 4; v++) {
|
||||||
GLES2CompatUtils.glVertex3f(quadx[q][v], quady[q][v], quadz[q][v]);
|
// GLES2CompatUtils.glVertex3f(quadx[q][v], quady[q][v],
|
||||||
|
// quadz[q][v]);
|
||||||
|
Coord3d quadCoord = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]);
|
||||||
|
vertexGLES2(quadCoord);
|
||||||
}
|
}
|
||||||
GLES2CompatUtils.glEnd();
|
GLES2CompatUtils.glEnd();
|
||||||
}
|
}
|
||||||
|
@ -265,8 +274,15 @@ public class AxeBox implements IAxe {
|
||||||
for (int t = 0; t < xticks.length; t++) {
|
for (int t = 0; t < xticks.length; t++) {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL.GL_LINES);
|
gl.getGL2().glBegin(GL.GL_LINES);
|
||||||
gl.getGL2().glVertex3d(xticks[t], quady[quad][0], quadz[quad][0]);
|
Coord3d quadCoord = new Coord3d(xticks[t], quady[quad][0], quadz[quad][0]);
|
||||||
gl.getGL2().glVertex3d(xticks[t], quady[quad][2], quadz[quad][2]);
|
vertexGL2(gl, quadCoord);
|
||||||
|
|
||||||
|
quadCoord = new Coord3d(xticks[t], quady[quad][2], quadz[quad][2]);
|
||||||
|
vertexGL2(gl, quadCoord);
|
||||||
|
// gl.getGL2().glVertex3d(xticks[t], quady[quad][0],
|
||||||
|
// quadz[quad][0]);
|
||||||
|
// gl.getGL2().glVertex3d(xticks[t], quady[quad][2],
|
||||||
|
// quadz[quad][2]);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -279,8 +295,14 @@ public class AxeBox implements IAxe {
|
||||||
for (int t = 0; t < yticks.length; t++) {
|
for (int t = 0; t < yticks.length; t++) {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL.GL_LINES);
|
gl.getGL2().glBegin(GL.GL_LINES);
|
||||||
gl.getGL2().glVertex3d(quadx[quad][0], yticks[t], quadz[quad][0]);
|
Coord3d quadCoord = new Coord3d(quadx[quad][0], yticks[t], quadz[quad][0]);
|
||||||
gl.getGL2().glVertex3d(quadx[quad][2], yticks[t], quadz[quad][2]);
|
vertexGL2(gl, quadCoord);
|
||||||
|
quadCoord = new Coord3d(quadx[quad][2], yticks[t], quadz[quad][2]);
|
||||||
|
vertexGL2(gl, quadCoord);
|
||||||
|
// gl.getGL2().glVertex3d(quadx[quad][0], yticks[t],
|
||||||
|
// quadz[quad][0]);
|
||||||
|
// gl.getGL2().glVertex3d(quadx[quad][2], yticks[t],
|
||||||
|
// quadz[quad][2]);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -293,8 +315,14 @@ public class AxeBox implements IAxe {
|
||||||
for (int t = 0; t < zticks.length; t++) {
|
for (int t = 0; t < zticks.length; t++) {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL.GL_LINES);
|
gl.getGL2().glBegin(GL.GL_LINES);
|
||||||
gl.getGL2().glVertex3d(quadx[quad][0], quady[quad][0], zticks[t]);
|
Coord3d quadCoord = new Coord3d(quadx[quad][0], quady[quad][0], zticks[t]);
|
||||||
gl.getGL2().glVertex3d(quadx[quad][2], quady[quad][2], zticks[t]);
|
vertexGL2(gl, quadCoord);
|
||||||
|
quadCoord = new Coord3d(quadx[quad][2], quady[quad][2], zticks[t]);
|
||||||
|
vertexGL2(gl, quadCoord);
|
||||||
|
// gl.getGL2().glVertex3d(quadx[quad][0], quady[quad][0],
|
||||||
|
// zticks[t]);
|
||||||
|
// gl.getGL2().glVertex3d(quadx[quad][2], quady[quad][2],
|
||||||
|
// zticks[t]);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -329,9 +357,21 @@ public class AxeBox implements IAxe {
|
||||||
|
|
||||||
// Computes POSition of ticks lying on the selected axe
|
// Computes POSition of ticks lying on the selected axe
|
||||||
// (i.e. 1st point of the tick line)
|
// (i.e. 1st point of the tick line)
|
||||||
double xpos = normx[quad_0] + normx[quad_1];
|
double xpos = 0;
|
||||||
double ypos = normy[quad_0] + normy[quad_1];
|
double ypos = 0;
|
||||||
double zpos = normz[quad_0] + normz[quad_1];
|
double zpos = 0;
|
||||||
|
|
||||||
|
if (spaceTransformer == null) {
|
||||||
|
xpos = normx[quad_0] + normx[quad_1];
|
||||||
|
ypos = normy[quad_0] + normy[quad_1];
|
||||||
|
zpos = normz[quad_0] + normz[quad_1];
|
||||||
|
} else {
|
||||||
|
xpos = spaceTransformer.getX().compute(normx[quad_0]) + spaceTransformer.getX().compute(normx[quad_1]);
|
||||||
|
ypos = spaceTransformer.getY().compute(normy[quad_0]) + spaceTransformer.getY().compute(normy[quad_1]);
|
||||||
|
zpos = spaceTransformer.getZ().compute(normz[quad_0]) + spaceTransformer.getZ().compute(normz[quad_1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : HERE SHOULD OVERRIDE IF TRANSFORM
|
||||||
|
|
||||||
// Computes the DIRection of the ticks
|
// Computes the DIRection of the ticks
|
||||||
// assuming initial vector point is the center
|
// assuming initial vector point is the center
|
||||||
|
@ -419,8 +459,7 @@ public class AxeBox implements IAxe {
|
||||||
return ticks;
|
return ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawAxisTicks(GL gl, GLU glu, Camera cam, int direction, Color color, Halign hal, Valign val, float tickLength, BoundingBox3d ticksTxtBounds, double xpos,
|
public void drawAxisTicks(GL gl, GLU glu, Camera cam, int direction, Color color, Halign hal, Valign val, float tickLength, BoundingBox3d ticksTxtBounds, double xpos, double ypos, double zpos, float xdir, float ydir, float zdir, double[] ticks) {
|
||||||
double ypos, double zpos, float xdir, float ydir, float zdir, double[] ticks) {
|
|
||||||
double xlab;
|
double xlab;
|
||||||
double ylab;
|
double ylab;
|
||||||
double zlab;
|
double zlab;
|
||||||
|
@ -429,24 +468,47 @@ public class AxeBox implements IAxe {
|
||||||
for (int t = 0; t < ticks.length; t++) {
|
for (int t = 0; t < ticks.length; t++) {
|
||||||
// Shift the tick vector along the selected axis
|
// Shift the tick vector along the selected axis
|
||||||
// and set the tick length
|
// and set the tick length
|
||||||
if (isX(direction)) {
|
if (spaceTransformer == null) {
|
||||||
xpos = ticks[t];
|
if (isX(direction)) {
|
||||||
xlab = xpos;
|
xpos = ticks[t];
|
||||||
ylab = (yrange / tickLength) * ydir + ypos;
|
xlab = xpos;
|
||||||
zlab = (zrange / tickLength) * zdir + zpos;
|
ylab = (yrange / tickLength) * ydir + ypos;
|
||||||
tickLabel = layout.getXTickRenderer().format(xpos);
|
zlab = (zrange / tickLength) * zdir + zpos;
|
||||||
} else if (isY(direction)) {
|
tickLabel = layout.getXTickRenderer().format(xpos);
|
||||||
ypos = ticks[t];
|
} else if (isY(direction)) {
|
||||||
xlab = (xrange / tickLength) * xdir + xpos;
|
ypos = ticks[t];
|
||||||
ylab = ypos;
|
xlab = (xrange / tickLength) * xdir + xpos;
|
||||||
zlab = (zrange / tickLength) * zdir + zpos;
|
ylab = ypos;
|
||||||
tickLabel = layout.getYTickRenderer().format(ypos);
|
zlab = (zrange / tickLength) * zdir + zpos;
|
||||||
} else { // (axis==AXE_Z)
|
tickLabel = layout.getYTickRenderer().format(ypos);
|
||||||
zpos = ticks[t];
|
} else { // (axis==AXE_Z)
|
||||||
xlab = (xrange / tickLength) * xdir + xpos;
|
zpos = ticks[t];
|
||||||
ylab = (yrange / tickLength) * ydir + ypos;
|
xlab = (xrange / tickLength) * xdir + xpos;
|
||||||
zlab = zpos;
|
ylab = (yrange / tickLength) * ydir + ypos;
|
||||||
tickLabel = layout.getZTickRenderer().format(zpos);
|
zlab = zpos;
|
||||||
|
tickLabel = layout.getZTickRenderer().format(zpos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// use space transform shift if we have a space transformer
|
||||||
|
if (isX(direction)) {
|
||||||
|
xpos = spaceTransformer.getX().compute((float) ticks[t]);
|
||||||
|
xlab = xpos;
|
||||||
|
ylab = Math.signum(tickLength * ydir) * (yrange / spaceTransformer.getY().compute(Math.abs(tickLength))) * spaceTransformer.getY().compute(Math.abs(ydir)) + ypos;
|
||||||
|
zlab = Math.signum(tickLength * ydir) * (zrange / spaceTransformer.getZ().compute(Math.abs(tickLength))) * spaceTransformer.getZ().compute(Math.abs(zdir)) + zpos;
|
||||||
|
tickLabel = layout.getXTickRenderer().format(xpos);
|
||||||
|
} else if (isY(direction)) {
|
||||||
|
ypos = spaceTransformer.getY().compute((float) ticks[t]);
|
||||||
|
xlab = Math.signum(tickLength * xdir) * (xrange / spaceTransformer.getX().compute(Math.abs(tickLength))) * spaceTransformer.getX().compute(Math.abs(xdir)) + xpos;
|
||||||
|
ylab = ypos;
|
||||||
|
zlab = Math.signum(tickLength * zdir) * (zrange / spaceTransformer.getZ().compute(Math.abs(tickLength))) * spaceTransformer.getZ().compute(Math.abs(zdir)) + zpos;
|
||||||
|
tickLabel = layout.getYTickRenderer().format(ypos);
|
||||||
|
} else { // (axis==AXE_Z)
|
||||||
|
zpos = spaceTransformer.getZ().compute((float) ticks[t]);
|
||||||
|
xlab = Math.signum(tickLength * xdir) * (xrange / spaceTransformer.getX().compute(Math.abs(tickLength))) * spaceTransformer.getX().compute(Math.abs(xdir)) + xpos;
|
||||||
|
ylab = Math.signum(tickLength * ydir) * (yrange / spaceTransformer.getY().compute(Math.abs(tickLength))) * spaceTransformer.getY().compute(Math.abs(ydir)) + ypos;
|
||||||
|
zlab = zpos;
|
||||||
|
tickLabel = layout.getZTickRenderer().format(zpos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Coord3d tickPosition = new Coord3d(xlab, ylab, zlab);
|
Coord3d tickPosition = new Coord3d(xlab, ylab, zlab);
|
||||||
|
|
||||||
|
@ -467,8 +529,7 @@ public class AxeBox implements IAxe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawAxisTickNumericLabel(GL gl, GLU glu, int direction, Camera cam, Color color, Halign hAlign, Valign vAlign, BoundingBox3d ticksTxtBounds, String tickLabel,
|
public void drawAxisTickNumericLabel(GL gl, GLU glu, int direction, Camera cam, Color color, Halign hAlign, Valign vAlign, BoundingBox3d ticksTxtBounds, String tickLabel, Coord3d tickPosition) {
|
||||||
Coord3d tickPosition) {
|
|
||||||
// doTransform(gl);
|
// doTransform(gl);
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glLoadIdentity();
|
gl.getGL2().glLoadIdentity();
|
||||||
|
@ -521,6 +582,32 @@ public class AxeBox implements IAxe {
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper to call glVerted3f on the input coordinate. For GL2 profile
|
||||||
|
* only. If logTransform is non null, then each dimension transform is
|
||||||
|
* processed before calling glVertex3d.
|
||||||
|
*/
|
||||||
|
protected void vertexGL2(GL gl, Coord3d c) {
|
||||||
|
if (spaceTransformer == null) {
|
||||||
|
gl.getGL2().glVertex3f(c.x, c.y, c.z);
|
||||||
|
} else {
|
||||||
|
gl.getGL2().glVertex3f(spaceTransformer.getX().compute(c.x), spaceTransformer.getY().compute(c.y), spaceTransformer.getZ().compute(c.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper to call glVerted3f on the input coordinate. For GLES2 profile
|
||||||
|
* only. If logTransform is non null, then each dimension transform is
|
||||||
|
* processed before calling glVertex3d.
|
||||||
|
*/
|
||||||
|
protected void vertexGLES2(Coord3d c) {
|
||||||
|
if (spaceTransformer == null) {
|
||||||
|
GLES2CompatUtils.glVertex3f(c.x, c.y, c.z);
|
||||||
|
} else {
|
||||||
|
GLES2CompatUtils.glVertex3f(spaceTransformer.getX().compute(c.x), spaceTransformer.getY().compute(c.y), spaceTransformer.getZ().compute(c.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
/* AXIS SELECTION */
|
/* AXIS SELECTION */
|
||||||
|
@ -1005,6 +1092,16 @@ public class AxeBox implements IAxe {
|
||||||
public IAxeLayout getLayout() {
|
public IAxeLayout getLayout() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpaceTransformer getSpaceTransformer() {
|
||||||
|
return spaceTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSpaceTransformer(SpaceTransformer spaceTransformer) {
|
||||||
|
this.spaceTransformer = spaceTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When setting a current view, the AxeBox can know the view is on mode
|
* When setting a current view, the AxeBox can know the view is on mode
|
||||||
|
@ -1092,6 +1189,9 @@ public class AxeBox implements IAxe {
|
||||||
public static final int AXE_X = 0;
|
public static final int AXE_X = 0;
|
||||||
public static final int AXE_Y = 1;
|
public static final int AXE_Y = 1;
|
||||||
public static final int AXE_Z = 2;
|
public static final int AXE_Z = 2;
|
||||||
|
|
||||||
protected List<AxeAnnotation> annotations = new ArrayList<AxeAnnotation>();
|
protected List<AxeAnnotation> annotations = new ArrayList<AxeAnnotation>();
|
||||||
|
|
||||||
|
protected SpaceTransformer spaceTransformer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.jzy3d.maths.BoundingBox3d;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
import org.jzy3d.plot3d.primitives.axes.layout.IAxeLayout;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
|
|
||||||
/**Specify services that a concrete Axe must provide.*/
|
/**Specify services that a concrete Axe must provide.*/
|
||||||
|
@ -21,4 +22,8 @@ public interface IAxe {
|
||||||
public Coord3d getCenter();
|
public Coord3d getCenter();
|
||||||
|
|
||||||
public IAxeLayout getLayout();
|
public IAxeLayout getLayout();
|
||||||
|
|
||||||
|
|
||||||
|
public SpaceTransformer getSpaceTransformer();
|
||||||
|
public void setSpaceTransformer(SpaceTransformer spaceTransformer) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.text.align.Halign;
|
import org.jzy3d.plot3d.text.align.Halign;
|
||||||
import org.jzy3d.plot3d.text.align.Valign;
|
import org.jzy3d.plot3d.text.align.Valign;
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransform;
|
import org.jzy3d.plot3d.transform.space.SpaceTransform;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO :
|
* TODO :
|
||||||
|
@ -32,13 +32,13 @@ import org.jzy3d.plot3d.transform.log.LogTransformer;
|
||||||
* @author Martin Pernollet
|
* @author Martin Pernollet
|
||||||
*/
|
*/
|
||||||
public class LogAxeBox extends AxeBox {
|
public class LogAxeBox extends AxeBox {
|
||||||
public LogAxeBox(BoundingBox3d bbox,LogTransformer transformers) {
|
public LogAxeBox(BoundingBox3d bbox,SpaceTransformer transformers) {
|
||||||
this(bbox, new AxeBoxLayout(),transformers);
|
this(bbox, new AxeBoxLayout(),transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogAxeBox(BoundingBox3d bbox, IAxeLayout layout, LogTransformer transformers) {
|
public LogAxeBox(BoundingBox3d bbox, IAxeLayout layout, SpaceTransformer transformers) {
|
||||||
super(bbox,layout);
|
super(bbox,layout);
|
||||||
this.transformers = transformers;
|
this.spaceTransformer = transformers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** reset to identity and apply scaling */
|
/** reset to identity and apply scaling */
|
||||||
|
@ -70,7 +70,7 @@ public class LogAxeBox extends AxeBox {
|
||||||
//System.out.println(c3d.x);
|
//System.out.println(c3d.x);
|
||||||
//System.out.println(Math.log(c3d.x));
|
//System.out.println(Math.log(c3d.x));
|
||||||
|
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
}
|
}
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,7 +79,7 @@ public class LogAxeBox extends AxeBox {
|
||||||
GLES2CompatUtils.glBegin(GL2.GL_QUADS);
|
GLES2CompatUtils.glBegin(GL2.GL_QUADS);
|
||||||
for (int v = 0; v < 4; v++) {
|
for (int v = 0; v < 4; v++) {
|
||||||
Coord3d c3d = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]);
|
Coord3d c3d = new Coord3d(quadx[q][v], quady[q][v], quadz[q][v]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
}
|
}
|
||||||
GLES2CompatUtils.glEnd();
|
GLES2CompatUtils.glEnd();
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ public class LogAxeBox extends AxeBox {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL2.GL_LINES);
|
gl.getGL2().glBegin(GL2.GL_LINES);
|
||||||
Coord3d c3d = new Coord3d(xticks[t], quady[quad][0], quadz[quad][0]);
|
Coord3d c3d = new Coord3d(xticks[t], quady[quad][0], quadz[quad][0]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
c3d = new Coord3d(xticks[t], quady[quad][2], quadz[quad][2]);
|
c3d = new Coord3d(xticks[t], quady[quad][2], quadz[quad][2]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -114,9 +114,9 @@ public class LogAxeBox extends AxeBox {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL2.GL_LINES);
|
gl.getGL2().glBegin(GL2.GL_LINES);
|
||||||
Coord3d c3d = new Coord3d(quadx[quad][0], yticks[t], quadz[quad][0]);
|
Coord3d c3d = new Coord3d(quadx[quad][0], yticks[t], quadz[quad][0]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
c3d = new Coord3d(quadx[quad][2], yticks[t], quadz[quad][2]);
|
c3d = new Coord3d(quadx[quad][2], yticks[t], quadz[quad][2]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -130,9 +130,9 @@ public class LogAxeBox extends AxeBox {
|
||||||
if (gl.isGL2()) {
|
if (gl.isGL2()) {
|
||||||
gl.getGL2().glBegin(GL2.GL_LINES);
|
gl.getGL2().glBegin(GL2.GL_LINES);
|
||||||
Coord3d c3d = new Coord3d(quadx[quad][0], quady[quad][0], zticks[t]);
|
Coord3d c3d = new Coord3d(quadx[quad][0], quady[quad][0], zticks[t]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
c3d = new Coord3d(quadx[quad][2], quady[quad][2], zticks[t]);
|
c3d = new Coord3d(quadx[quad][2], quady[quad][2], zticks[t]);
|
||||||
GlVertexExecutor.Vertex(gl, c3d, transformers);
|
GlVertexExecutor.Vertex(gl, c3d, spaceTransformer);
|
||||||
gl.getGL2().glEnd();
|
gl.getGL2().glEnd();
|
||||||
} else {
|
} else {
|
||||||
// FIXME TO BE REWRITTEN ANDROID
|
// FIXME TO BE REWRITTEN ANDROID
|
||||||
|
@ -162,9 +162,9 @@ public class LogAxeBox extends AxeBox {
|
||||||
|
|
||||||
// Computes POSition of ticks lying on the selected axe
|
// Computes POSition of ticks lying on the selected axe
|
||||||
// (i.e. 1st point of the tick line)
|
// (i.e. 1st point of the tick line)
|
||||||
double xpos = transformers.getX().compute(normx[quad_0]) + transformers.getX().compute(normx[quad_1]);
|
double xpos = spaceTransformer.getX().compute(normx[quad_0]) + spaceTransformer.getX().compute(normx[quad_1]);
|
||||||
double ypos = transformers.getY().compute(normy[quad_0]) + transformers.getY().compute(normy[quad_1]);
|
double ypos = spaceTransformer.getY().compute(normy[quad_0]) + spaceTransformer.getY().compute(normy[quad_1]);
|
||||||
double zpos = transformers.getZ().compute(normz[quad_0]) + transformers.getZ().compute(normz[quad_1]);
|
double zpos = spaceTransformer.getZ().compute(normz[quad_0]) + spaceTransformer.getZ().compute(normz[quad_1]);
|
||||||
|
|
||||||
// Computes the DIRection of the ticks
|
// Computes the DIRection of the ticks
|
||||||
// assuming initial vector point is the center
|
// assuming initial vector point is the center
|
||||||
|
@ -218,21 +218,21 @@ public class LogAxeBox extends AxeBox {
|
||||||
// Shift the tick vector along the selected axis
|
// Shift the tick vector along the selected axis
|
||||||
// and set the tick length
|
// and set the tick length
|
||||||
if (isX(direction)) {
|
if (isX(direction)) {
|
||||||
xpos = transformers.getX().compute((float) ticks[t]);
|
xpos = spaceTransformer.getX().compute((float) ticks[t]);
|
||||||
xlab = xpos;
|
xlab = xpos;
|
||||||
ylab = Math.signum(tickLength * ydir) * (yrange / transformers.getY().compute(Math.abs(tickLength))) * transformers.getY().compute(Math.abs(ydir)) + ypos;
|
ylab = Math.signum(tickLength * ydir) * (yrange / spaceTransformer.getY().compute(Math.abs(tickLength))) * spaceTransformer.getY().compute(Math.abs(ydir)) + ypos;
|
||||||
zlab = Math.signum(tickLength * ydir) * (zrange / transformers.getZ().compute(Math.abs(tickLength))) * transformers.getZ().compute(Math.abs(zdir)) + zpos;
|
zlab = Math.signum(tickLength * ydir) * (zrange / spaceTransformer.getZ().compute(Math.abs(tickLength))) * spaceTransformer.getZ().compute(Math.abs(zdir)) + zpos;
|
||||||
tickLabel = layout.getXTickRenderer().format(xpos);
|
tickLabel = layout.getXTickRenderer().format(xpos);
|
||||||
} else if (isY(direction)) {
|
} else if (isY(direction)) {
|
||||||
ypos = transformers.getY().compute((float) ticks[t]);
|
ypos = spaceTransformer.getY().compute((float) ticks[t]);
|
||||||
xlab = Math.signum(tickLength * xdir) * (xrange / transformers.getX().compute(Math.abs(tickLength))) * transformers.getX().compute(Math.abs(xdir)) + xpos;
|
xlab = Math.signum(tickLength * xdir) * (xrange / spaceTransformer.getX().compute(Math.abs(tickLength))) * spaceTransformer.getX().compute(Math.abs(xdir)) + xpos;
|
||||||
ylab = ypos;
|
ylab = ypos;
|
||||||
zlab = Math.signum(tickLength * zdir) * (zrange / transformers.getZ().compute(Math.abs(tickLength))) * transformers.getZ().compute(Math.abs(zdir)) + zpos;
|
zlab = Math.signum(tickLength * zdir) * (zrange / spaceTransformer.getZ().compute(Math.abs(tickLength))) * spaceTransformer.getZ().compute(Math.abs(zdir)) + zpos;
|
||||||
tickLabel = layout.getYTickRenderer().format(ypos);
|
tickLabel = layout.getYTickRenderer().format(ypos);
|
||||||
} else { // (axis==AXE_Z)
|
} else { // (axis==AXE_Z)
|
||||||
zpos = transformers.getZ().compute((float) ticks[t]);
|
zpos = spaceTransformer.getZ().compute((float) ticks[t]);
|
||||||
xlab = Math.signum(tickLength * xdir) * (xrange / transformers.getX().compute(Math.abs(tickLength))) * transformers.getX().compute(Math.abs(xdir)) + xpos;
|
xlab = Math.signum(tickLength * xdir) * (xrange / spaceTransformer.getX().compute(Math.abs(tickLength))) * spaceTransformer.getX().compute(Math.abs(xdir)) + xpos;
|
||||||
ylab = Math.signum(tickLength * ydir) * (yrange / transformers.getY().compute(Math.abs(tickLength))) * transformers.getY().compute(Math.abs(ydir)) + ypos;
|
ylab = Math.signum(tickLength * ydir) * (yrange / spaceTransformer.getY().compute(Math.abs(tickLength))) * spaceTransformer.getY().compute(Math.abs(ydir)) + ypos;
|
||||||
zlab = zpos;
|
zlab = zpos;
|
||||||
tickLabel = layout.getZTickRenderer().format(zpos);
|
tickLabel = layout.getZTickRenderer().format(zpos);
|
||||||
}
|
}
|
||||||
|
@ -255,5 +255,4 @@ public class LogAxeBox extends AxeBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LogTransformer transformers;
|
|
||||||
}
|
}
|
|
@ -5,20 +5,20 @@ import javax.media.opengl.GL;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.AbstractGeometry;
|
import org.jzy3d.plot3d.primitives.AbstractGeometry;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public abstract class AxeTransformableAbstractGeometry extends AbstractGeometry{
|
public abstract class AxeTransformableAbstractGeometry extends AbstractGeometry{
|
||||||
|
|
||||||
public AxeTransformableAbstractGeometry(LogTransformer transformers) {
|
public AxeTransformableAbstractGeometry(SpaceTransformer transformers) {
|
||||||
super();
|
super();
|
||||||
this.logTransformer = transformers;
|
this.spaceTransformer = transformers;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void vertexGL2(GL gl, Coord3d c) {
|
protected void vertexGL2(GL gl, Coord3d c) {
|
||||||
GlVertexExecutor.Vertex(gl, c, logTransformer);
|
GlVertexExecutor.Vertex(gl, c, spaceTransformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void vertexGLES2(Coord3d c) {
|
protected void vertexGLES2(Coord3d c) {
|
||||||
GLES2CompatUtils.glVertex3f(logTransformer.getX().compute(c.x), logTransformer.getY().compute(c.y),logTransformer.getZ().compute(c.z));
|
GLES2CompatUtils.glVertex3f(spaceTransformer.getX().compute(c.x), spaceTransformer.getY().compute(c.y),spaceTransformer.getZ().compute(c.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,22 @@ import org.jzy3d.colors.ColorMapper;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.ConcurrentScatterMultiColor;
|
import org.jzy3d.plot3d.primitives.ConcurrentScatterMultiColor;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableConcurrentScatterMultiColor extends
|
public class AxeTransformableConcurrentScatterMultiColor extends
|
||||||
ConcurrentScatterMultiColor {
|
ConcurrentScatterMultiColor {
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, Color[] colors, ColorMapper mapper, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, Color[] colors, ColorMapper mapper, SpaceTransformer transformers) {
|
||||||
this(coordinates, colors, mapper, 1.0f, transformers);
|
this(coordinates, colors, mapper, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, ColorMapper mapper, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, ColorMapper mapper, SpaceTransformer transformers) {
|
||||||
this(coordinates, null, mapper, 1.0f, transformers);
|
this(coordinates, null, mapper, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, Color[] colors, ColorMapper mapper, float width, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColor(Coord3d[] coordinates, Color[] colors, ColorMapper mapper, float width, SpaceTransformer transformers) {
|
||||||
super(coordinates, colors, mapper, width);
|
super(coordinates, colors, mapper, width);
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,22 +11,22 @@ import org.jzy3d.colors.ColorMapper;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.ConcurrentScatterMultiColorList;
|
import org.jzy3d.plot3d.primitives.ConcurrentScatterMultiColorList;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableConcurrentScatterMultiColorList extends
|
public class AxeTransformableConcurrentScatterMultiColorList extends
|
||||||
ConcurrentScatterMultiColorList {
|
ConcurrentScatterMultiColorList {
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColorList(ColorMapper mapper, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColorList(ColorMapper mapper, SpaceTransformer transformers) {
|
||||||
this(new ArrayList<Coord3d>(), mapper, 1.0f, transformers);
|
this(new ArrayList<Coord3d>(), mapper, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColorList(List<Coord3d> coordinates, ColorMapper mapper, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColorList(List<Coord3d> coordinates, ColorMapper mapper, SpaceTransformer transformers) {
|
||||||
this(coordinates, mapper, 1.0f, transformers);
|
this(coordinates, mapper, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableConcurrentScatterMultiColorList(List<Coord3d> coordinates, ColorMapper mapper, float width, LogTransformer transformers) {
|
public AxeTransformableConcurrentScatterMultiColorList(List<Coord3d> coordinates, ColorMapper mapper, float width, SpaceTransformer transformers) {
|
||||||
super(coordinates, mapper, width);
|
super(coordinates, mapper, width);
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,20 @@ import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.ConcurrentScatterPoint;
|
import org.jzy3d.plot3d.primitives.ConcurrentScatterPoint;
|
||||||
import org.jzy3d.plot3d.primitives.LightPoint;
|
import org.jzy3d.plot3d.primitives.LightPoint;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableConcuurentScatterPoint extends
|
public class AxeTransformableConcuurentScatterPoint extends
|
||||||
ConcurrentScatterPoint {
|
ConcurrentScatterPoint {
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
|
|
||||||
public AxeTransformableConcuurentScatterPoint(LogTransformer transformers) {
|
public AxeTransformableConcuurentScatterPoint(SpaceTransformer transformers) {
|
||||||
super();
|
super();
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableConcuurentScatterPoint(List<LightPoint> points, float width, LogTransformer transformers) {
|
public AxeTransformableConcuurentScatterPoint(List<LightPoint> points, float width, SpaceTransformer transformers) {
|
||||||
super(points, width);
|
super(points, width);
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@ package org.jzy3d.plot3d.primitives.log;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.FlatLine2d;
|
import org.jzy3d.plot3d.primitives.FlatLine2d;
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableFlatLine2d extends FlatLine2d {
|
public class AxeTransformableFlatLine2d extends FlatLine2d {
|
||||||
public AxeTransformableFlatLine2d(LogTransformer transformers){
|
public AxeTransformableFlatLine2d(SpaceTransformer transformers){
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableFlatLine2d(float[] x, float[] y, float depth, LogTransformer transformers){
|
public AxeTransformableFlatLine2d(float[] x, float[] y, float depth, SpaceTransformer transformers){
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
setData(x, y, depth);
|
setData(x, y, depth);
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,5 @@ public class AxeTransformableFlatLine2d extends FlatLine2d {
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,16 @@ import org.jzy3d.plot3d.primitives.LineStrip;
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableLineStrip extends LineStrip {
|
public class AxeTransformableLineStrip extends LineStrip {
|
||||||
|
|
||||||
|
|
||||||
public AxeTransformableLineStrip(LogTransformer transformers) {
|
public AxeTransformableLineStrip(SpaceTransformer transformers) {
|
||||||
this(2, transformers);
|
this(2, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableLineStrip(int n, LogTransformer transformers) {
|
public AxeTransformableLineStrip(int n, SpaceTransformer transformers) {
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
points = new ArrayList<Point>(n);
|
points = new ArrayList<Point>(n);
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
|
@ -30,7 +30,7 @@ public class AxeTransformableLineStrip extends LineStrip {
|
||||||
setWireframeColor(null);
|
setWireframeColor(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableLineStrip(List<Coord3d> coords, LogTransformer transformers) {
|
public AxeTransformableLineStrip(List<Coord3d> coords, SpaceTransformer transformers) {
|
||||||
this(transformers);
|
this(transformers);
|
||||||
for (Coord3d c : coords) {
|
for (Coord3d c : coords) {
|
||||||
Point p = new Point(c);
|
Point p = new Point(c);
|
||||||
|
@ -38,7 +38,7 @@ public class AxeTransformableLineStrip extends LineStrip {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableLineStrip(Point c1, Point c2,LogTransformer transformers) {
|
public AxeTransformableLineStrip(Point c1, Point c2,SpaceTransformer transformers) {
|
||||||
this(transformers);
|
this(transformers);
|
||||||
add(c1);
|
add(c1);
|
||||||
add(c2);
|
add(c2);
|
||||||
|
@ -124,7 +124,7 @@ public class AxeTransformableLineStrip extends LineStrip {
|
||||||
for (Point p : points)
|
for (Point p : points)
|
||||||
bbox.add(transform.compute(p.xyz));
|
bbox.add(transform.compute(p.xyz));
|
||||||
}
|
}
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ import org.jzy3d.maths.algorithms.interpolation.IInterpolator;
|
||||||
import org.jzy3d.plot3d.primitives.LineStrip;
|
import org.jzy3d.plot3d.primitives.LineStrip;
|
||||||
import org.jzy3d.plot3d.primitives.LineStripInterpolated;
|
import org.jzy3d.plot3d.primitives.LineStripInterpolated;
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableLineStripInterpolated extends LineStripInterpolated{
|
public class AxeTransformableLineStripInterpolated extends LineStripInterpolated{
|
||||||
|
|
||||||
public AxeTransformableLineStripInterpolated(IInterpolator interpolator, List<Coord3d> controlPoints, int resolution, LogTransformer transformers){
|
public AxeTransformableLineStripInterpolated(IInterpolator interpolator, List<Coord3d> controlPoints, int resolution, SpaceTransformer transformers){
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
this.controlCoords = controlPoints;
|
this.controlCoords = controlPoints;
|
||||||
this.resolution = resolution;
|
this.resolution = resolution;
|
||||||
|
@ -33,5 +33,5 @@ public class AxeTransformableLineStripInterpolated extends LineStripInterpolated
|
||||||
return new AxeTransformablePoint(coord, color, width, transformers);
|
return new AxeTransformablePoint(coord, color, width, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,25 @@ import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.Point;
|
import org.jzy3d.plot3d.primitives.Point;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformablePoint extends Point {
|
public class AxeTransformablePoint extends Point {
|
||||||
/** Intialize a point at the origin, with a white color and a width of 1. */
|
/** Intialize a point at the origin, with a white color and a width of 1. */
|
||||||
public AxeTransformablePoint(LogTransformer transformers) {
|
public AxeTransformablePoint(SpaceTransformer transformers) {
|
||||||
this(Coord3d.ORIGIN, Color.WHITE, 1.0f, transformers);
|
this(Coord3d.ORIGIN, Color.WHITE, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Intialize a point with a white color and a width of 1. */
|
/** Intialize a point with a white color and a width of 1. */
|
||||||
public AxeTransformablePoint(Coord3d xyz, LogTransformer transformers) {
|
public AxeTransformablePoint(Coord3d xyz, SpaceTransformer transformers) {
|
||||||
this(xyz, Color.WHITE, 1.0f, transformers);
|
this(xyz, Color.WHITE, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Intialize a point with a width of 1. */
|
/** Intialize a point with a width of 1. */
|
||||||
public AxeTransformablePoint(Coord3d xyz, Color rgb, LogTransformer transformers) {
|
public AxeTransformablePoint(Coord3d xyz, Color rgb, SpaceTransformer transformers) {
|
||||||
this(xyz, rgb, 1.0f, transformers);
|
this(xyz, rgb, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformablePoint(Coord3d xyz, Color rgb, float width, LogTransformer transformers) {
|
public AxeTransformablePoint(Coord3d xyz, Color rgb, float width, SpaceTransformer transformers) {
|
||||||
super(xyz,rgb,width);
|
super(xyz,rgb,width);
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
updateBounds();
|
updateBounds();
|
||||||
|
@ -67,7 +67,7 @@ public class AxeTransformablePoint extends Point {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ import javax.media.opengl.GL;
|
||||||
import javax.media.opengl.GL2;
|
import javax.media.opengl.GL2;
|
||||||
|
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransform;
|
import org.jzy3d.plot3d.transform.space.SpaceTransform;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformablePolygon extends AxeTransformableAbstractGeometry {
|
public class AxeTransformablePolygon extends AxeTransformableAbstractGeometry {
|
||||||
|
|
||||||
public AxeTransformablePolygon(LogTransformer transformers) {
|
public AxeTransformablePolygon(SpaceTransformer transformers) {
|
||||||
super(transformers);
|
super(transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ import javax.media.opengl.GL;
|
||||||
import javax.media.opengl.GL2;
|
import javax.media.opengl.GL2;
|
||||||
|
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableQuad extends AxeTransformableAbstractGeometry {
|
public class AxeTransformableQuad extends AxeTransformableAbstractGeometry {
|
||||||
|
|
||||||
public AxeTransformableQuad(LogTransformer transformers) {
|
public AxeTransformableQuad(SpaceTransformer transformers) {
|
||||||
super(transformers);
|
super(transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,26 +8,26 @@ import org.jzy3d.maths.BoundingBox3d;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.Scatter;
|
import org.jzy3d.plot3d.primitives.Scatter;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableScatter extends Scatter{
|
public class AxeTransformableScatter extends Scatter{
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
public AxeTransformableScatter(LogTransformer transformers) {
|
public AxeTransformableScatter(SpaceTransformer transformers) {
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
setWidth(1.0f);
|
setWidth(1.0f);
|
||||||
setColor(Color.BLACK);
|
setColor(Color.BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatter(Coord3d[] coordinates, LogTransformer transformers) {
|
public AxeTransformableScatter(Coord3d[] coordinates, SpaceTransformer transformers) {
|
||||||
this(coordinates, Color.BLACK, transformers);
|
this(coordinates, Color.BLACK, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatter(Coord3d[] coordinates, Color rgb, LogTransformer transformers) {
|
public AxeTransformableScatter(Coord3d[] coordinates, Color rgb, SpaceTransformer transformers) {
|
||||||
this(coordinates, rgb, 1.0f, transformers);
|
this(coordinates, rgb, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatter(Coord3d[] coordinates, Color rgb, float width, LogTransformer transformers) {
|
public AxeTransformableScatter(Coord3d[] coordinates, Color rgb, float width, SpaceTransformer transformers) {
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
setData(coordinates);
|
setData(coordinates);
|
||||||
|
@ -35,11 +35,11 @@ public class AxeTransformableScatter extends Scatter{
|
||||||
setColor(rgb);
|
setColor(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatter(Coord3d[] coordinates, Color[] colors, LogTransformer transformers) {
|
public AxeTransformableScatter(Coord3d[] coordinates, Color[] colors, SpaceTransformer transformers) {
|
||||||
this(coordinates, colors, 1.0f, transformers);
|
this(coordinates, colors, 1.0f, transformers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatter(Coord3d[] coordinates, Color[] colors, float width, LogTransformer transformers) {
|
public AxeTransformableScatter(Coord3d[] coordinates, Color[] colors, float width, SpaceTransformer transformers) {
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
setData(coordinates);
|
setData(coordinates);
|
||||||
|
|
|
@ -13,20 +13,20 @@ import org.jzy3d.plot3d.primitives.LightPoint;
|
||||||
import org.jzy3d.plot3d.primitives.ScatterPoint;
|
import org.jzy3d.plot3d.primitives.ScatterPoint;
|
||||||
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
import org.jzy3d.plot3d.rendering.compat.GLES2CompatUtils;
|
||||||
import org.jzy3d.plot3d.rendering.view.Camera;
|
import org.jzy3d.plot3d.rendering.view.Camera;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public class AxeTransformableScatterPoint extends ScatterPoint{
|
public class AxeTransformableScatterPoint extends ScatterPoint{
|
||||||
|
|
||||||
LogTransformer transformers;
|
SpaceTransformer transformers;
|
||||||
|
|
||||||
public AxeTransformableScatterPoint(LogTransformer transformers) {
|
public AxeTransformableScatterPoint(SpaceTransformer transformers) {
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
setWidth(1.0f);
|
setWidth(1.0f);
|
||||||
setPoints(new ArrayList<LightPoint>());
|
setPoints(new ArrayList<LightPoint>());
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AxeTransformableScatterPoint(List<LightPoint> points, float width, LogTransformer transformers) {
|
public AxeTransformableScatterPoint(List<LightPoint> points, float width, SpaceTransformer transformers) {
|
||||||
bbox = new BoundingBox3d();
|
bbox = new BoundingBox3d();
|
||||||
setPoints(points);
|
setPoints(points);
|
||||||
setWidth(width);
|
setWidth(width);
|
||||||
|
|
|
@ -3,11 +3,11 @@ package org.jzy3d.plot3d.primitives.log;
|
||||||
import javax.media.opengl.GL;
|
import javax.media.opengl.GL;
|
||||||
|
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransform;
|
import org.jzy3d.plot3d.transform.space.SpaceTransform;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
public abstract class GlVertexExecutor {
|
public abstract class GlVertexExecutor {
|
||||||
public static void Vertex(GL gl, Coord3d c3d,LogTransformer transformers){
|
public static void Vertex(GL gl, Coord3d c3d,SpaceTransformer transformers){
|
||||||
gl.getGL2().glVertex3d(transformers.getX().compute(c3d.x), transformers.getY().compute(c3d.y), transformers.getZ().compute(c3d.z));
|
gl.getGL2().glVertex3d(transformers.getX().compute(c3d.x), transformers.getY().compute(c3d.y), transformers.getZ().compute(c3d.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class Graph {
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
components = new ArrayList<AbstractDrawable>();
|
this.components = new ArrayList<AbstractDrawable>();
|
||||||
// components = Collections.synchronizedList(new
|
// components = Collections.synchronizedList(new
|
||||||
// ArrayList<AbstractDrawable>());
|
// ArrayList<AbstractDrawable>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.jzy3d.plot3d.rendering.view.modes.ViewBoundMode;
|
||||||
import org.jzy3d.plot3d.rendering.view.modes.ViewPositionMode;
|
import org.jzy3d.plot3d.rendering.view.modes.ViewPositionMode;
|
||||||
import org.jzy3d.plot3d.transform.Scale;
|
import org.jzy3d.plot3d.transform.Scale;
|
||||||
import org.jzy3d.plot3d.transform.Transform;
|
import org.jzy3d.plot3d.transform.Transform;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
import com.jogamp.opengl.util.awt.Overlay;
|
import com.jogamp.opengl.util.awt.Overlay;
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ public class View {
|
||||||
|
|
||||||
this.scene.getGraph().getStrategy().setView(this);
|
this.scene.getGraph().getStrategy().setView(this);
|
||||||
|
|
||||||
|
this.spaceTransformer = new SpaceTransformer(); // apply no transform
|
||||||
current = this;
|
current = this;
|
||||||
transformers = new LogTransformer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chart getChart() {
|
public Chart getChart() {
|
||||||
|
@ -318,7 +318,7 @@ public class View {
|
||||||
public void lookToBox(BoundingBox3d box) {
|
public void lookToBox(BoundingBox3d box) {
|
||||||
if (box.isReset())
|
if (box.isReset())
|
||||||
return;
|
return;
|
||||||
center = box.getTransformedCenter(transformers);
|
center = box.getTransformedCenter(spaceTransformer);
|
||||||
axe.setAxe(box);
|
axe.setAxe(box);
|
||||||
viewbounds = box;
|
viewbounds = box;
|
||||||
}
|
}
|
||||||
|
@ -596,9 +596,9 @@ public class View {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute factors
|
// Compute factors
|
||||||
float xLen = transformers.getX().compute(bounds.getXmax()) - transformers.getX().compute(bounds.getXmin());
|
float xLen = spaceTransformer.getX().compute(bounds.getXmax()) - spaceTransformer.getX().compute(bounds.getXmin());
|
||||||
float yLen = transformers.getY().compute(bounds.getYmax()) - transformers.getY().compute(bounds.getYmin());
|
float yLen = spaceTransformer.getY().compute(bounds.getYmax()) - spaceTransformer.getY().compute(bounds.getYmin());
|
||||||
float zLen = transformers.getZ().compute(bounds.getZmax()) - transformers.getZ().compute(bounds.getZmin());
|
float zLen = spaceTransformer.getZ().compute(bounds.getZmax()) - spaceTransformer.getZ().compute(bounds.getZmin());
|
||||||
float lmax = (float) Math.max(Math.max(xLen, yLen), zLen);
|
float lmax = (float) Math.max(Math.max(xLen, yLen), zLen);
|
||||||
|
|
||||||
if (Float.isInfinite(xLen) || Float.isNaN(xLen) || xLen == 0)
|
if (Float.isInfinite(xLen) || Float.isNaN(xLen) || xLen == 0)
|
||||||
|
@ -922,7 +922,7 @@ public class View {
|
||||||
|
|
||||||
public void updateCamera(GL gl, GLU glu, ViewportConfiguration viewport, BoundingBox3d boundsScaled) {
|
public void updateCamera(GL gl, GLU glu, ViewportConfiguration viewport, BoundingBox3d boundsScaled) {
|
||||||
//before LOG was : (float)bounds.getRadius() * factorViewPointDistance;
|
//before LOG was : (float)bounds.getRadius() * factorViewPointDistance;
|
||||||
float sceneRadius = (float) boundsScaled.getTransformedRadius(transformers);
|
float sceneRadius = (float) boundsScaled.getTransformedRadius(spaceTransformer);
|
||||||
updateCamera(gl, glu, viewport, boundsScaled, sceneRadius);
|
updateCamera(gl, glu, viewport, boundsScaled, sceneRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ public class View {
|
||||||
cam.setRenderingSphereRadius(radius);
|
cam.setRenderingSphereRadius(radius);
|
||||||
correctCameraPositionForIncludingTextLabels(gl, glu, viewport);
|
correctCameraPositionForIncludingTextLabels(gl, glu, viewport);
|
||||||
} else {
|
} else {
|
||||||
cam.setRenderingSphereRadius((float)bounds.getTransformedRadius(transformers));
|
cam.setRenderingSphereRadius((float)bounds.getTransformedRadius(spaceTransformer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,12 +1065,12 @@ public class View {
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
public LogTransformer getTransformers() {
|
public SpaceTransformer getSpaceTransformer() {
|
||||||
return transformers;
|
return spaceTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransformers(LogTransformer transformers) {
|
public void setSpaceTransformer(SpaceTransformer transformer) {
|
||||||
this.transformers = transformers;
|
this.spaceTransformer = transformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -1141,7 +1141,7 @@ public class View {
|
||||||
/** A slave view won't clear its color and depth buffer before rendering */
|
/** A slave view won't clear its color and depth buffer before rendering */
|
||||||
protected boolean slave = false;
|
protected boolean slave = false;
|
||||||
|
|
||||||
protected LogTransformer transformers = new LogTransformer();
|
protected SpaceTransformer spaceTransformer = new SpaceTransformer();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package org.jzy3d.plot3d.transform.log;
|
|
||||||
|
|
||||||
import org.jzy3d.maths.Coord2d;
|
|
||||||
import org.jzy3d.maths.Coord3d;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper to apply 3 {@link AxeTransform} on each dimension of a {@link Coord3d}.
|
|
||||||
*
|
|
||||||
* @author
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LogTransformer {
|
|
||||||
protected AxeTransform x;
|
|
||||||
protected AxeTransform y;
|
|
||||||
protected AxeTransform z;
|
|
||||||
|
|
||||||
public LogTransformer(AxeTransform x, AxeTransform y, AxeTransform z) {
|
|
||||||
this.x = x != null ? x : new AxeTransformLinear();
|
|
||||||
this.y = y != null ? y : new AxeTransformLinear();
|
|
||||||
this.z = z != null ? z : new AxeTransformLinear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogTransformer() {
|
|
||||||
this.x = new AxeTransformLinear();
|
|
||||||
this.y = new AxeTransformLinear();
|
|
||||||
this.z = new AxeTransformLinear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AxeTransform getX() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setX(AxeTransform x) {
|
|
||||||
this.x = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AxeTransform getY() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setY(AxeTransform y) {
|
|
||||||
this.y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AxeTransform getZ() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setZ(AxeTransform z) {
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coord3d compute(Coord3d point) {
|
|
||||||
return new Coord3d(getX().compute(point.x), getY().compute(point.y), getZ().compute(point.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coord2d compute(Coord2d point) {
|
|
||||||
return new Coord2d(getX().compute(point.x), getY().compute(point.y));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.jzy3d.plot3d.transform.log;
|
package org.jzy3d.plot3d.transform.space;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify an axe transform (e.g. for log axes)
|
* Specify an axe transform (e.g. for log axes)
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
*/
|
*/
|
||||||
public interface AxeTransform {
|
public interface SpaceTransform {
|
||||||
public float compute(float value);
|
public float compute(float value);
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package org.jzy3d.plot3d.transform.log;
|
package org.jzy3d.plot3d.transform.space;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply log transform if value is greater than 0 (otherwise return 0).
|
* Apply log transform if value is greater than 0 (otherwise return 0).
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
*/
|
*/
|
||||||
public class AxeTransformLog implements AxeTransform{
|
public class SpaceTransformLog implements SpaceTransform{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float compute(float value) {
|
public float compute(float value) {
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.jzy3d.plot3d.transform.space;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply log transform if value is greater than 0 (otherwise return 0).
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
public class SpaceTransformLog2 implements SpaceTransform{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float compute(float value) {
|
||||||
|
if(value <= 0) return 0;
|
||||||
|
else return log2(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float log2(float x) {
|
||||||
|
return (float)(Math.log(x) / Math.log(2));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package org.jzy3d.plot3d.transform.log;
|
package org.jzy3d.plot3d.transform.space;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not apply any transform (return input value).
|
* Do not apply any transform (return input value).
|
||||||
*
|
*
|
||||||
* @author
|
* @author
|
||||||
*/
|
*/
|
||||||
public class AxeTransformLinear implements AxeTransform {
|
public class SpaceTransformNone implements SpaceTransform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float compute(float value) {
|
public float compute(float value) {
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.jzy3d.plot3d.transform.space;
|
||||||
|
|
||||||
|
import org.jzy3d.maths.Coord2d;
|
||||||
|
import org.jzy3d.maths.Coord3d;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper to apply 3 {@link SpaceTransform} on each dimension of a {@link Coord3d}.
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SpaceTransformer {
|
||||||
|
protected SpaceTransform x;
|
||||||
|
protected SpaceTransform y;
|
||||||
|
protected SpaceTransform z;
|
||||||
|
|
||||||
|
public SpaceTransformer(SpaceTransform x, SpaceTransform y, SpaceTransform z) {
|
||||||
|
this.x = x != null ? x : new SpaceTransformNone();
|
||||||
|
this.y = y != null ? y : new SpaceTransformNone();
|
||||||
|
this.z = z != null ? z : new SpaceTransformNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpaceTransformer() {
|
||||||
|
this.x = new SpaceTransformNone();
|
||||||
|
this.y = new SpaceTransformNone();
|
||||||
|
this.z = new SpaceTransformNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpaceTransform getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(SpaceTransform x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpaceTransform getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(SpaceTransform y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpaceTransform getZ() {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZ(SpaceTransform z) {
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Coord3d compute(Coord3d point) {
|
||||||
|
return new Coord3d(getX().compute(point.x), getY().compute(point.y), getZ().compute(point.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Coord2d compute(Coord2d point) {
|
||||||
|
return new Coord2d(getX().compute(point.x), getY().compute(point.y));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.jzy3d.chart.factories;
|
||||||
|
|
||||||
|
import org.jzy3d.chart.Chart;
|
||||||
|
import org.jzy3d.maths.BoundingBox3d;
|
||||||
|
import org.jzy3d.maths.Coord3d;
|
||||||
|
import org.jzy3d.plot3d.primitives.axes.IAxe;
|
||||||
|
import org.jzy3d.plot3d.primitives.axes.LogAxeBox;
|
||||||
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
|
import org.jzy3d.plot3d.rendering.view.View;
|
||||||
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
|
public class AWTLogChartComponentFactory extends AWTChartComponentFactory {
|
||||||
|
protected SpaceTransformer logTransformers;
|
||||||
|
|
||||||
|
public AWTLogChartComponentFactory(SpaceTransformer transformers) {
|
||||||
|
this.logTransformers = transformers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart() {
|
||||||
|
return chart(Quality.Intermediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality, SpaceTransformer transformers) {
|
||||||
|
AWTLogChartComponentFactory f = new AWTLogChartComponentFactory(transformers);
|
||||||
|
return f.newChart(quality, Toolkit.newt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(String toolkit, SpaceTransformer transformers) {
|
||||||
|
AWTLogChartComponentFactory f = new AWTLogChartComponentFactory(transformers);
|
||||||
|
return f.newChart(Chart.DEFAULT_QUALITY, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality, Toolkit toolkit, SpaceTransformer transformers) {
|
||||||
|
AWTLogChartComponentFactory f = new AWTLogChartComponentFactory(transformers);
|
||||||
|
return f.newChart(quality, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Chart chart(Quality quality, String toolkit, SpaceTransformer transformers) {
|
||||||
|
AWTLogChartComponentFactory f = new AWTLogChartComponentFactory(transformers);
|
||||||
|
return f.newChart(quality, toolkit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAxe newAxe(BoundingBox3d box, View view) {
|
||||||
|
LogAxeBox axe = new LogAxeBox(box, logTransformers);
|
||||||
|
axe.setScale(new Coord3d(10.0, 1.0, 1.0));
|
||||||
|
axe.setView(view);
|
||||||
|
return axe;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,18 +7,14 @@ import java.util.Random;
|
||||||
import org.jzy3d.analysis.AbstractAnalysis;
|
import org.jzy3d.analysis.AbstractAnalysis;
|
||||||
import org.jzy3d.analysis.AnalysisLauncher;
|
import org.jzy3d.analysis.AnalysisLauncher;
|
||||||
import org.jzy3d.chart.factories.AWTChartComponentFactory;
|
import org.jzy3d.chart.factories.AWTChartComponentFactory;
|
||||||
import org.jzy3d.chart.factories.AxeTransformableAWTChartComponentFactory;
|
|
||||||
import org.jzy3d.colors.Color;
|
import org.jzy3d.colors.Color;
|
||||||
import org.jzy3d.colors.ColorMapper;
|
import org.jzy3d.colors.ColorMapper;
|
||||||
import org.jzy3d.colors.colormaps.ColorMapRainbow;
|
import org.jzy3d.colors.colormaps.ColorMapRainbow;
|
||||||
import org.jzy3d.maths.Coord3d;
|
import org.jzy3d.maths.Coord3d;
|
||||||
import org.jzy3d.plot3d.primitives.Scatter;
|
|
||||||
import org.jzy3d.plot3d.primitives.log.AxeTransformableConcurrentScatterMultiColor;
|
|
||||||
import org.jzy3d.plot3d.primitives.log.AxeTransformableConcurrentScatterMultiColorList;
|
import org.jzy3d.plot3d.primitives.log.AxeTransformableConcurrentScatterMultiColorList;
|
||||||
import org.jzy3d.plot3d.primitives.log.AxeTransformableScatter;
|
|
||||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransformLog;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformLog;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
|
|
||||||
public class LogScatterTest extends AbstractAnalysis{
|
public class LogScatterTest extends AbstractAnalysis{
|
||||||
|
@ -27,7 +23,7 @@ public class LogScatterTest extends AbstractAnalysis{
|
||||||
AnalysisLauncher.open(new LogScatterTest());
|
AnalysisLauncher.open(new LogScatterTest());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogTransformer transformers = new LogTransformer(null, null,new AxeTransformLog());
|
SpaceTransformer spaceTransformer = new SpaceTransformer(null, null,new SpaceTransformLog());
|
||||||
|
|
||||||
public void init(){
|
public void init(){
|
||||||
int size = 500000;
|
int size = 500000;
|
||||||
|
@ -51,9 +47,11 @@ public class LogScatterTest extends AbstractAnalysis{
|
||||||
colors[i] = new Color(x, y, z, a);
|
colors[i] = new Color(x, y, z, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
AxeTransformableConcurrentScatterMultiColorList scatter = new AxeTransformableConcurrentScatterMultiColorList(points, new ColorMapper(new ColorMapRainbow(), 0.1, 1.1, new Color(1, 1, 1, .5f)), transformers);
|
AxeTransformableConcurrentScatterMultiColorList scatter = new AxeTransformableConcurrentScatterMultiColorList(points, new ColorMapper(new ColorMapRainbow(), 0.1, 1.1, new Color(1, 1, 1, .5f)), spaceTransformer);
|
||||||
chart = AxeTransformableAWTChartComponentFactory.chart(Quality.Advanced, "awt", transformers);
|
//chart = AWTLogChartComponentFactory.chart(Quality.Advanced, "awt", spaceTransformer);
|
||||||
chart.getView().setTransformers(transformers);
|
chart = AWTChartComponentFactory.chart(Quality.Advanced, "awt");
|
||||||
|
chart.getView().getAxe().setSpaceTransformer(spaceTransformer);
|
||||||
|
chart.getView().setSpaceTransformer(spaceTransformer);
|
||||||
chart.getScene().add(scatter);
|
chart.getScene().add(scatter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.jzy3d.tests;
|
||||||
|
|
||||||
import org.jzy3d.chart.Chart;
|
import org.jzy3d.chart.Chart;
|
||||||
import org.jzy3d.chart.ChartLauncher;
|
import org.jzy3d.chart.ChartLauncher;
|
||||||
import org.jzy3d.chart.factories.AxeTransformableAWTChartComponentFactory;
|
import org.jzy3d.chart.factories.AWTChartComponentFactory;
|
||||||
import org.jzy3d.colors.Color;
|
import org.jzy3d.colors.Color;
|
||||||
import org.jzy3d.colors.ColorMapper;
|
import org.jzy3d.colors.ColorMapper;
|
||||||
import org.jzy3d.colors.colormaps.ColorMapRainbow;
|
import org.jzy3d.colors.colormaps.ColorMapRainbow;
|
||||||
|
@ -12,10 +12,11 @@ import org.jzy3d.plot3d.builder.Builder;
|
||||||
import org.jzy3d.plot3d.builder.Mapper;
|
import org.jzy3d.plot3d.builder.Mapper;
|
||||||
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
|
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
|
||||||
import org.jzy3d.plot3d.primitives.CompileableComposite;
|
import org.jzy3d.plot3d.primitives.CompileableComposite;
|
||||||
|
import org.jzy3d.plot3d.primitives.axes.AxeBox;
|
||||||
import org.jzy3d.plot3d.primitives.log.AxeTransformablePoint;
|
import org.jzy3d.plot3d.primitives.log.AxeTransformablePoint;
|
||||||
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
import org.jzy3d.plot3d.rendering.canvas.Quality;
|
||||||
import org.jzy3d.plot3d.transform.log.AxeTransformLog;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformLog;
|
||||||
import org.jzy3d.plot3d.transform.log.LogTransformer;
|
import org.jzy3d.plot3d.transform.space.SpaceTransformer;
|
||||||
|
|
||||||
|
|
||||||
public class LogTest {
|
public class LogTest {
|
||||||
|
@ -34,10 +35,10 @@ public class LogTest {
|
||||||
Range range2 = new Range((float)0.1,50);
|
Range range2 = new Range((float)0.1,50);
|
||||||
int steps = 200;
|
int steps = 200;
|
||||||
|
|
||||||
LogTransformer transformers = new LogTransformer(null, null, new AxeTransformLog());
|
SpaceTransformer spaceTransformer = new SpaceTransformer(null, null, new SpaceTransformLog());
|
||||||
|
|
||||||
// Create a surface drawing that function
|
// Create a surface drawing that function
|
||||||
CompileableComposite surface = Builder.buildOrthonormalBigLog(new OrthonormalGrid(range, steps, range2, steps), mapper, transformers);
|
CompileableComposite surface = Builder.buildOrthonormalBigLog(new OrthonormalGrid(range, steps, range2, steps), mapper, spaceTransformer);
|
||||||
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
|
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
|
||||||
surface.setFaceDisplayed(true);
|
surface.setFaceDisplayed(true);
|
||||||
surface.setWireframeDisplayed(false);
|
surface.setWireframeDisplayed(false);
|
||||||
|
@ -57,27 +58,30 @@ public class LogTest {
|
||||||
AxeTransformableLineStripInterpolated line = new AxeTransformableLineStripInterpolated(new BernsteinInterpolator(), points, 100, transformers);
|
AxeTransformableLineStripInterpolated line = new AxeTransformableLineStripInterpolated(new BernsteinInterpolator(), points, 100, transformers);
|
||||||
line.setWireframeColor(new Color(1,1,1));*/
|
line.setWireframeColor(new Color(1,1,1));*/
|
||||||
|
|
||||||
AxeTransformablePoint point1 = new AxeTransformablePoint(transformers);
|
AxeTransformablePoint point1 = new AxeTransformablePoint(spaceTransformer);
|
||||||
point1.setData(new Coord3d(1,1,1));
|
point1.setData(new Coord3d(1,1,1));
|
||||||
point1.setColor(new Color(1, 0, 0));
|
point1.setColor(new Color(1, 0, 0));
|
||||||
point1.setWidth(10);
|
point1.setWidth(10);
|
||||||
AxeTransformablePoint point2 = new AxeTransformablePoint(transformers);
|
AxeTransformablePoint point2 = new AxeTransformablePoint(spaceTransformer);
|
||||||
point2.setData(new Coord3d(2,3,3));
|
point2.setData(new Coord3d(2,3,3));
|
||||||
point2.setColor(new Color(0,1,0));
|
point2.setColor(new Color(0,1,0));
|
||||||
point2.setWidth(10);
|
point2.setWidth(10);
|
||||||
AxeTransformablePoint point3 = new AxeTransformablePoint(transformers);
|
AxeTransformablePoint point3 = new AxeTransformablePoint(spaceTransformer);
|
||||||
point3.setData(new Coord3d(3,4,2));
|
point3.setData(new Coord3d(3,4,2));
|
||||||
point3.setColor(new Color(0,0,1));
|
point3.setColor(new Color(0,0,1));
|
||||||
point3.setWidth(10);
|
point3.setWidth(10);
|
||||||
|
|
||||||
|
|
||||||
// Create a chart and add the surface
|
// Create a chart and add the surface
|
||||||
Chart chart = AxeTransformableAWTChartComponentFactory.chart(Quality.Advanced, "awt", transformers);
|
//Chart chart = AWTLogChartComponentFactory.chart(Quality.Advanced, "awt", transformers);
|
||||||
chart.addDrawable(point1);
|
Chart chart = AWTChartComponentFactory.chart(Quality.Advanced, "awt");
|
||||||
|
AxeBox axe = (AxeBox)chart.getView().getAxe();
|
||||||
|
axe.setSpaceTransformer(spaceTransformer);
|
||||||
|
chart.addDrawable(point1);
|
||||||
chart.addDrawable(point2);
|
chart.addDrawable(point2);
|
||||||
chart.addDrawable(point3);
|
chart.addDrawable(point3);
|
||||||
chart.addDrawable(surface);
|
chart.addDrawable(surface);
|
||||||
chart.getView().setTransformers(transformers);
|
chart.getView().setSpaceTransformer(spaceTransformer);
|
||||||
ChartLauncher.openChart(chart);
|
ChartLauncher.openChart(chart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue