[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.15,1.16 View3D.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-08-31 07:03:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2333/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View3D.java Transformation.java Log Message: View3d.toCanvasCoords implemented - returns poin in XY plane Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractView.java 30 Aug 2005 13:20:08 -0000 1.15 --- AbstractView.java 31 Aug 2005 07:02:51 -0000 1.16 *************** *** 793,797 **** double far = z1 / 0xFFFFFFFF; double near = z2 / 0xFFFFFFFF; - System.out.println("z1 = " + far + " z2 = " + near); } bufferOffset += names; --- 793,796 ---- Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** View3D.java 30 Aug 2005 13:20:08 -0000 1.10 --- View3D.java 31 Aug 2005 07:02:51 -0000 1.11 *************** *** 8,11 **** --- 8,13 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Vertex; import net.java.games.jogl.GL; *************** *** 162,166 **** public double[] toCanvasCoords(double[] coords) { if (coords.length == 2) { ! return new double[] {0.0, 0.0, 0.0}; } else { log.warn("Too many arguments"); --- 164,187 ---- public double[] toCanvasCoords(double[] coords) { if (coords.length == 2) { ! ! double x = coords[0]; ! double y = coords[1]; ! ! Transformation transformation = transformation(); ! ! Plane xy = new Plane(0, 0, 1, 0); ! Vertex origin = new Vertex("origin"); ! origin.setX(x); ! origin.setY(AbstractView.getHeight() - y); ! origin.setZ(0.0); ! origin = transformation.unProject(origin); ! Vertex direction = new Vertex("direction"); ! direction.setX(x); ! direction.setY(AbstractView.getHeight() - y); ! direction.setZ(1.0); ! direction = transformation.unProject(direction); ! direction = direction.minus(origin); ! Vertex vertex = xy.intersection(origin, direction); ! return new double[] {vertex.getX(), vertex.getY(), vertex.getZ()}; } else { log.warn("Too many arguments"); Index: Transformation.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Transformation.java 30 Aug 2005 09:37:25 -0000 1.3 --- Transformation.java 31 Aug 2005 07:02:51 -0000 1.4 *************** *** 111,115 **** } Vertex projection = new Vertex("projection of " + vertex.getName()); - System.out.println("x = " + view[0]); projection.setX(view[0]); projection.setY(view[1]); --- 111,114 ---- *************** *** 165,169 **** } Vertex projection = new Vertex("un-projection of " + vertex.getName()); - System.out.println("x = " + view[0]); projection.setX(round(view[0])); projection.setY(round(view[1])); --- 164,167 ---- |