bprocessor-commit Mailing List for B-processor (Page 164)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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 ---- |
From: Michael L. <he...@us...> - 2005-08-31 07:02:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2333/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: View3d.toCanvasCoords implemented - returns poin in XY plane Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PencilTool.java 30 Aug 2005 13:20:09 -0000 1.4 --- PencilTool.java 31 Aug 2005 07:02:52 -0000 1.5 *************** *** 9,13 **** --- 9,15 ---- import java.awt.event.MouseEvent; + import java.util.ArrayList; import java.util.LinkedList; + import java.util.List; import net.sourceforge.bprocessor.gl.GLView; *************** *** 34,37 **** --- 36,43 ---- private int factor = 0; + /** The current Edge list */ + protected List edges; + + /** * Constructor *************** *** 40,43 **** --- 46,50 ---- public PencilTool(GLView glv) { super(glv); + edges = new ArrayList(); } *************** *** 88,96 **** Transformation transformation = v.transformation(); if (selectedVertex != null) { ! Vertex projected = transformation.project(selectedVertex); ! Vertex unprojected = transformation.unProject(projected); ! System.out.println(selectedVertex.toString()); ! System.out.println(projected.toString()); ! System.out.println(unprojected.toString()); } else { Plane xy = new Plane(0, 0, 1, 0); --- 95,99 ---- Transformation transformation = v.transformation(); if (selectedVertex != null) { ! System.out.println(selectedVertex); } else { Plane xy = new Plane(0, 0, 1, 0); *************** *** 106,112 **** direction = transformation.unProject(direction); direction = direction.minus(origin); - System.out.println(origin.toString() + " " + direction.toString()); Vertex vertex = xy.intersection(origin, direction); - System.out.println(vertex); } } --- 109,113 ---- |
From: Michael L. <he...@us...> - 2005-08-30 13:20:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8835/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java View3D.java Log Message: Clicking at the XY plane works Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractView.java 30 Aug 2005 13:05:54 -0000 1.14 --- AbstractView.java 30 Aug 2005 13:20:08 -0000 1.15 *************** *** 109,112 **** --- 109,118 ---- protected IntBuffer selectBuffer; + /** The last used near value */ + protected double near; + + /** The last used far value */ + protected double far; + /** The modelview matrix used for rendering the scene */ protected double[] modelMatrix = new double[16]; *************** *** 189,193 **** int[] mode = new int[1]; gl.glViewport(0, 0, (int)width, (int)height); ! if (picking > 0) { selectBuffer = BufferUtils.newIntBuffer(512); --- 195,200 ---- int[] mode = new int[1]; gl.glViewport(0, 0, (int)width, (int)height); ! AbstractView.height = height; ! AbstractView.width = width; if (picking > 0) { selectBuffer = BufferUtils.newIntBuffer(512); *************** *** 978,980 **** --- 985,1011 ---- return null; } + + /** + * Return the near plane + * @return The near plane + */ + public double getNear() { + return near; + } + + /** + * Return the far plane + * @return The far plane + */ + public double getFar() { + return far; + } + + /** + * Return the view height + * @return The view height + */ + public static double getHeight() { + return height; + } } Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** View3D.java 30 Aug 2005 08:22:35 -0000 1.9 --- View3D.java 30 Aug 2005 13:20:08 -0000 1.10 *************** *** 57,65 **** } double aspect = width / height; if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0, 1.0, 2.0 / getZoomFactor(), 100.0 * getZoomFactor()); } else { ! glu.gluPerspective(60.0, aspect, 2.0 / getZoomFactor(), 100.0 * getZoomFactor()); } --- 57,67 ---- } double aspect = width / height; + near = 2.0 / getZoomFactor(); + far = 100.0 * getZoomFactor(); if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0, 1.0, near, far); } else { ! glu.gluPerspective(60.0, aspect, near, far); } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** View.java 26 Aug 2005 14:48:15 -0000 1.7 --- View.java 30 Aug 2005 13:20:08 -0000 1.8 *************** *** 174,176 **** --- 174,188 ---- */ public void changeDrawMode(int mode); + + /** + * Return the near plane + * @return The near plane + */ + public double getNear(); + + /** + * Return the far plane + * @return The far plane + */ + public double getFar(); } |
From: Michael L. <he...@us...> - 2005-08-30 13:20:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8835/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Clicking at the XY plane works Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PencilTool.java 30 Aug 2005 09:37:25 -0000 1.3 --- PencilTool.java 30 Aug 2005 13:20:09 -0000 1.4 *************** *** 12,18 **** --- 12,20 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.view.AbstractView; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 91,94 **** --- 93,112 ---- System.out.println(projected.toString()); System.out.println(unprojected.toString()); + } else { + 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); + System.out.println(origin.toString() + " " + direction.toString()); + Vertex vertex = xy.intersection(origin, direction); + System.out.println(vertex); } } |
From: Nordholt <nor...@us...> - 2005-08-30 13:19:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8570 Modified Files: PersistenceManager.java Log Message: added support for inner surfaces Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PersistenceManager.java 24 Aug 2005 06:58:37 -0000 1.5 --- PersistenceManager.java 30 Aug 2005 13:19:14 -0000 1.6 *************** *** 231,234 **** --- 231,236 ---- sm.setConstructor(s.isConstructor()); + + sm.setIsInner(s.isIsinner()); sm = SurfaceFacade.getInstance().create(sm); *************** *** 514,517 **** --- 516,532 ---- sm.setEdges(er); } + + List iss = s.getInnersurfacesref(); + if (iss != null && iss.size() > 0) { + Set isr = new HashSet(); + Iterator iiss = iss.iterator(); + while (iiss.hasNext()) { + Long isid = (Long)mapper.get((Long)iiss.next()); + net.sourceforge.bprocessor.model.Surface is = + SurfaceFacade.getInstance().findById(isid); + isr.add(is); + } + sm.setInnerSurfaces(isr); + } SurfaceFacade.getInstance().update(sm); } *************** *** 1084,1087 **** --- 1099,1114 ---- sx.getEdgeref().add(m.get(e.getId())); } + + Set isData = s.getInnerSurfaces(); + it = isData.iterator(); + while (it.hasNext()) { + net.sourceforge.bprocessor.model.Surface is = + (net.sourceforge.bprocessor.model.Surface)it.next(); + + Map m = (Map)mapper.get(KEY_SURFACE); + + sx.getInnersurfacesref().add(m.get(is.getId())); + } + } } |
From: Nordholt <nor...@us...> - 2005-08-30 13:15:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7616 Modified Files: Vertex.java Log Message: method for calculating derterminants Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Vertex.java 16 Aug 2005 11:45:03 -0000 1.5 --- Vertex.java 30 Aug 2005 13:14:55 -0000 1.6 *************** *** 225,228 **** --- 225,254 ---- return Math.sqrt(Math.abs(getX() * getX() + getY() * getY() + getZ() * getZ())); } + + /** + * Computes the the determinant of this and to other vertecies. + * The form is: determinant{this, v, u}. + * @param v the second vertex + * @param u the third vertex + * @return the determinant. + */ + public double determinant(Vertex v, Vertex u) { + double tx = this.getX(); + double ty = this.getY(); + double tz = this.getZ(); + + double vx = v.getX(); + double vy = v.getY(); + double vz = v.getZ(); + + double ux = u.getX(); + double uy = u.getY(); + double uz = u.getZ(); + + double result = tx * ((vy * uz) - (vz * uy)); + result -= vx * ((ty * uz) - (tz * uy)); + result += ux * ((ty * vz) - (tz * vy)); + return result; + } /** |
From: Nordholt <nor...@us...> - 2005-08-30 13:14:08
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7416 Modified Files: Surface.java Log Message: added support for inner surfaces Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Surface.java 26 Aug 2005 12:15:15 -0000 1.13 --- Surface.java 30 Aug 2005 13:14:01 -0000 1.14 *************** *** 10,13 **** --- 10,15 ---- import java.util.Iterator; import java.util.List; + import java.util.Set; + import java.util.HashSet; import org.apache.log4j.Logger; *************** *** 37,40 **** --- 39,48 ---- private List edges; + /** The inner surfaces of this surface (for holes) */ + private Set innerSurfaces; + + /** Tells if this is an inner surface */ + private boolean isInner; + /** * Constructor for persistence layer *************** *** 51,55 **** --- 59,65 ---- setName(name); setConstructor(false); + setIsInner(false); setEdges(null); + setInnerSurfaces(null); } *************** *** 130,133 **** --- 140,187 ---- this.edges = edges; } + + /** + * Get the inner surfaces + * @return The inner surfaces + * @hibernate.set + * lazy="false" + * @hibernate.key + * column="SURFACE_ID" + * @hibernate.many-to-many + * class="net.sourceforge.bprocessor.model.Surface" + */ + public Set getInnerSurfaces() { + return innerSurfaces; + } + + /** + * Set the inner surfaces + * @param is The inner surfaces + */ + public void setInnerSurfaces(Set is) { + this.innerSurfaces = is; + } + + /** + * Adds a hole surface to this surface. + * @param inner the hole to add. + */ + public void addHole(Surface inner) { + if (innerSurfaces == null) { + Set initSet = new HashSet(); + initSet.add(inner); + setInnerSurfaces(initSet); + } else { + innerSurfaces.add(inner); + } + } + + /** + * Removes a hole from this surface + * @param inner the hole to remove + */ + public void removeHole(Surface inner) { + innerSurfaces.remove(inner); + } /** *************** *** 146,149 **** --- 200,220 ---- return null; } + + /** + * Get the whether this is an inner surface. + * @return wheter or not this is an inner surface + * @hibernate.property + */ + public boolean getIsInner() { + return isInner; + } + + /** + * Set this surface to be an inner surface. + * @param isInner whether or not this is an inner surface. + */ + public void setIsInner(boolean isInner) { + this.isInner = isInner; + } /** |
From: Nordholt <nor...@us...> - 2005-08-30 13:12:41
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7089 Modified Files: bprocessor.xsd Log Message: added support for inner surfaces Index: bprocessor.xsd =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/bprocessor.xsd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bprocessor.xsd 24 Aug 2005 06:57:32 -0000 1.3 --- bprocessor.xsd 30 Aug 2005 13:12:33 -0000 1.4 *************** *** 73,76 **** --- 73,78 ---- <xsd:element name="constructor" type="xsd:boolean"/> <xsd:element name="edgeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> + <xsd:element name="innersurfacesref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> + <xsd:element name="isinner" type="xsd:boolean"/> </xsd:sequence> </xsd:complexType> |
From: Michael L. <he...@us...> - 2005-08-30 13:12:18
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6819/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: Clicking at the XY plane works Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Plane.java 26 Aug 2005 14:49:23 -0000 1.2 --- Plane.java 30 Aug 2005 13:11:32 -0000 1.3 *************** *** 51,55 **** * @return the intersection with the (x y t) ray or NaN */ ! double intersection(double x, double y) { if (c != 0) { return -(a * x + b * y + d) / c; --- 51,55 ---- * @return the intersection with the (x y t) ray or NaN */ ! public double intersection(double x, double y) { if (c != 0) { return -(a * x + b * y + d) / c; *************** *** 58,61 **** --- 58,89 ---- } } + + /** + * Find the intersection with the ray originating at origin + * with the specified direction + * @param origin The origin of the ray + * @param direction The direction of the ray + * @return The intersection point + */ + public Vertex intersection(Vertex origin, Vertex direction) { + double x0 = origin.getX(); + double y0 = origin.getY(); + double z0 = origin.getZ(); + double xd = direction.getX(); + double yd = direction.getY(); + double zd = direction.getZ(); + double vd = a * xd + b * yd + c * zd; + if (vd != 0) { + double v0 = -(a * x0 + b * y0 + c * z0 + d); + double t = v0 / vd; + Vertex i = new Vertex("intersection"); + i.setX(x0 + t * xd); + i.setY(y0 + t * yd); + i.setZ(z0 + t * zd); + return i; + } else { + return null; + } + } } |
From: Nordholt <nor...@us...> - 2005-08-30 13:08:43
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6051 Modified Files: SurfacesTreeView.java Log Message: deleted surfaces should disappear from the tree Index: SurfacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfacesTreeView.java 28 Jul 2005 10:19:06 -0000 1.2 --- SurfacesTreeView.java 30 Aug 2005 13:08:21 -0000 1.3 *************** *** 69,73 **** TreePath tp = new TreePath(new Object[] {rn}); getModel().valueForPathChanged(tp, sn); ! } } --- 69,89 ---- TreePath tp = new TreePath(new Object[] {rn}); getModel().valueForPathChanged(tp, sn); ! } else if (type.equals(Notification.SURFACE_DELETED)) { ! Long deletedId = n.getObject(); ! ! RootNode rn = (RootNode)getModel().getRoot(); ! Enumeration children = rn.children(); ! SurfaceNode node = null; ! while (children.hasMoreElements()) { ! node = (SurfaceNode) children.nextElement(); ! if (node.getId() == deletedId) { ! rn.remove(node); ! } ! } ! if (node != null) { ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, node); ! } ! } } |
From: Nordholt <nor...@us...> - 2005-08-30 13:06:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5456 Modified Files: AbstractView.java Log Message: Added tesselation of surfaces to allow concave surfaces and holes Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractView.java 30 Aug 2005 08:22:35 -0000 1.13 --- AbstractView.java 30 Aug 2005 13:05:54 -0000 1.14 *************** *** 28,31 **** --- 28,34 ---- import net.java.games.jogl.GLU; import net.java.games.jogl.util.BufferUtils; + import net.java.games.jogl.GLUtesselatorCallbackAdapter; + import net.java.games.jogl.GLUtesselatorCallback; + import net.java.games.jogl.GLUtesselator; import org.apache.log4j.Logger; *************** *** 449,453 **** List l = s.getEdges(); if (l != null) { ! gl.glBegin(GL.GL_POLYGON); if (drawMode == LIGHTING_MODE) { Vertex norm = s.normal(); --- 452,470 ---- List l = s.getEdges(); if (l != null) { ! //Setting up tessellation ! GLUtesselator tess = glu.gluNewTess(); ! GLUtesselatorCallback cb = new Callback(); ! ! //Setting callbacks ! glu.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_END, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb); ! ! //Contours contained in an even number of contours are filled ! glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); ! ! //begining the polygon, we are not using userdata for now (hence the null) ! glu.gluTessBeginPolygon(tess, null); ! //light stuff if (drawMode == LIGHTING_MODE) { Vertex norm = s.normal(); *************** *** 455,494 **** gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ()); } ! Vertex previous = null; ! Edge previousEdge = null; ! for (int i = 0; i < l.size(); i++) { ! Edge e = (Edge)l.get(i); ! if (previous == null) { ! previous = e.getTo(); ! // will be drawn with the secound vertex as to find out if it is to or from that counts } else { ! Vertex temp = e.otherVertex(previous); ! if (temp != null) { ! gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! previous = temp; ! if (i == l.size() - 1) { ! gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! } ! } else { ! temp = previousEdge.otherVertex(previous); ! gl.glVertex3d(temp.getX(), temp.getY(), temp.getZ()); ! previous = e.otherVertex(temp); ! if (i == l.size() - 1) { ! if (previous == null) { ! log.warn("[drawSurface] could not find vertex " + temp + " on " + e); ! } else { ! gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! } } } } - previousEdge = e; } ! gl.glEnd(); } ! //gl.glDisable(GL.GL_POLYGON_STIPPLE); ! //gl.glEnable(GL.GL_DEPTH_TEST); } ! /** * Draw an Edge --- 472,548 ---- gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ()); } ! //drawing the outer contour ! drawContour(l, tess); ! ! //drawing the inner conturs ! Set innerSurfaces = s.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface surface = (Surface)innerIt.next(); ! List innerEdges = surface.getEdges(); ! if (innerEdges != null) { ! drawContour(innerEdges, tess); ! } ! } ! } ! ! glu.gluTessEndPolygon(tess); ! glu.gluDeleteTess(tess); ! } ! } ! ! /** ! * Draws contours of a surface using the tessellator. ! * @param edges a non-null list of edges describing the contour ! * @param tess the tessellator object ! */ ! private void drawContour(List edges, GLUtesselator tess) { ! //beginning the contour. ! glu.gluTessBeginContour(tess); ! ! Vertex previous = null; ! Edge previousEdge = null; ! double[] coords; ! for (int i = 0; i < edges.size(); i++) { ! Edge e = (Edge)edges.get(i); ! if (previous == null) { ! previous = e.getTo(); ! // will be drawn with the second vertex as to find out if it is to or from that counts ! } else { ! Vertex temp = e.otherVertex(previous); ! if (temp != null) { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! previous = temp; ! if (i == edges.size() - 1) { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! } } else { ! temp = previousEdge.otherVertex(previous); ! coords = new double[] {temp.getX(), temp.getY(), temp.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(temp.getX(), temp.getY(), temp.getZ()); ! previous = e.otherVertex(temp); ! if (i == edges.size() - 1) { ! if (previous == null) { ! log.warn("[drawSurface] could not find vertex " + temp + " on " + e); ! } else { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); } } } } ! previousEdge = e; } ! //Ending contour ! glu.gluTessEndContour(tess); } ! /** * Draw an Edge *************** *** 831,834 **** --- 885,975 ---- /** + * representation of a 3D point. + */ + private class Point { + /** the x coordinate*/ + private double x; + /** the y coordinate */ + private double y; + /** the z coordinate */ + private double z; + + /** + * Constructor for a point + * @param x the x coordinate. + * @param y the y coordinate. + * @param z the z coordinate. + */ + public Point(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + /** + * Gets x + * @return x value + */ + public double getX() { + return x; + } + /** + * Gets y + * @return y value + */ + public double getY() { + return y; + } + /** + * Gets y + * @return y value + */ + public double getZ() { + return z; + } + } + + /** + * Inner class that defines the callbacks for tessellation + */ + private class Callback extends GLUtesselatorCallbackAdapter { + + /** + * Constructor + */ + public Callback() { + super(); + } + + /** + * The begin callback. + * @param type the type of begin + */ + public void begin(int type) { + gl.glBegin(type); + } + + /** + * The end callback. + */ + public void end() { + gl.glEnd(); + } + + /** + * The vertex callback. + * @param vertex an object representing the vertex. + */ + public void vertex(Object vertex) { + if (vertex instanceof Point) { + Point p = (Point)vertex; + gl.glVertex3d(p.x, p.y, p.z); + } else { + log.error("A none-point object was passed to the tessellator"); + } + } + } + + /** * Get transformation for model to screen coordinates * @return The transformation |
From: Nordholt <nor...@us...> - 2005-08-30 13:00:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4304 Added Files: HoleTool.java Log Message: Initial import --- NEW FILE: HoleTool.java --- //--------------------------------------------------------------------------------- // $Id: HoleTool.java,v 1.1 2005/08/30 13:00:33 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.SurfaceFacade; import java.util.ArrayList; import java.util.List; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * The tool to cut holes in surfaces. */ public class HoleTool extends DrawTool { /** The Logger */ private static Logger log = Logger.getLogger(HoleTool.class); /** * The Constructor * @param glv The 3D canvas */ public HoleTool(GLView glv) { super(glv); } /** * Add the last edge to the edgelist => hole. * A hole must to inside an other surface and must be a closed shape. * @param coord The end coordinate */ protected void endSurface(double[] coord) { /* * Override this method to check that only full surfaces are drawn, and * that these surfaces are overlap some other surface. */ //Much of this code is taken from DrawTool Edge activeEdge = glv.getView().getActiveEdge(); //no hole has only one edge. if (edges.size() > 1) { Vertex to = vertexCollide(coord); if (to != null) { // we have to change excisting surface edges.add(activeEdge); Vertex old = activeEdge.getTo(); activeEdge.setTo(null); updateEdge(activeEdge); removeVertex(old); activeEdge.setTo(to); updateEdge(activeEdge); Surface hole = createSurface(edges); Surface surface = insideCheck(hole); if (surface != null) { surface.addHole(hole); hole.setIsInner(true); } else { deleteSurface(hole); } } else { to = activeEdge.getTo(); removeEdge(activeEdge); removeVertex(to); } } glv.getView().setAlignVertex(null); glv.getView().setActiveEdge(null); edges = new ArrayList(); } /** * Gets the surface this hole is inside if any other wise returns null. * @param hole the we wish to check is ok. * @return the surface */ private Surface insideCheck(Surface hole) { Set surfaces = SurfaceFacade.getInstance().findAll(); Iterator it = surfaces.iterator(); Surface surf = null; while (it.hasNext()) { surf = (Surface)it.next(); if (hole.getId() != surf.getId()) { if (planeCheck(hole, surf)) { if (containedCheck(hole, surf)) { return surf; } } } } return null; } /** * Checks if a hole is contained in a surface, given that the hole and the * surface is in the same plane. * @param hole the hole * @param surf the surface * @return boolean indicating werther or not the hole is contained in the plane. */ private boolean containedCheck(Surface hole, Surface surf) { /*this is done by aplying the crossing numbers algorithm on every vertex *of the hole. Using the edges of the hole as rays we cover two vertecies *at a time. */ List holeEdges = hole.getEdges(); Iterator holeIt = holeEdges.iterator(); Edge holeEdge = null; boolean contained = true; if (holeIt.hasNext()) { holeEdge = (Edge)holeIt.next(); contained = crossingNumbers(holeEdge, surf); } while (holeIt.hasNext() && contained) { holeEdge = (Edge)holeIt.next(); if (holeIt.hasNext()) { holeEdge = (Edge)holeIt.next(); if (!crossingNumbers(holeEdge, surf)) { contained = false; } } } return contained; } /** * The crossing numbers algorithm to check if an edge is contained in an other surface. * @param edge the edge. * @param surf the surface. * @return a boolean werther or not the edge is contained */ private boolean crossingNumbers(Edge edge, Surface surf) { List surfEdges = surf.getEdges(); Iterator surfIt = surfEdges.iterator(); Edge holeEdge = edge; Vertex holeOr = holeEdge.getTo(); Vertex holeDir = holeEdge.getFrom().minus(holeOr); holeDir.scale(1 / holeDir.length()); boolean contained = true; int crossings = 0; while (surfIt.hasNext() && contained) { Edge surfEdge = (Edge)surfIt.next(); //in order to find intersections we get a parametrizied version of the edges //the origin point and direction vector for the surface edge Vertex surfOr = surfEdge.getTo(); Vertex surfDir = surfEdge.getFrom().minus(surfOr); surfDir.scale(1 / surfDir.length()); //formulars for finding intersections taken from http://www.realtimerendering.com/int/#I304 Vertex dirCross = surfDir.cross(holeDir); double denominator = dirCross.length() * dirCross.length(); if (denominator != 0) { Vertex orSubs = holeOr.minus(surfOr); double surfDet = orSubs.determinant(holeDir, dirCross); double holeDet = orSubs.determinant(surfDir, dirCross); double tSurf = surfDet / denominator; double tHole = holeDet / denominator; //checking if there is an intersection and if it is within the line segments if ((tSurf > 0) && (tHole > 0) && collide((surfOr.getX() + surfDir.getX() * tSurf), (holeOr.getX() + holeDir.getX() * tHole)) && collide((surfOr.getY() + surfDir.getY() * tSurf), (holeOr.getY() + holeDir.getY() * tHole)) && collide((surfOr.getZ() + surfDir.getZ() * tSurf), (holeOr.getZ() + holeDir.getZ() * tHole))) { //the parameters for the "from" point on the edges double tSurfFrom = 0; double tHoleFrom = 0; if (surfDir.getX() != 0) { tSurfFrom = ((surfEdge.getFrom().getX() - surfOr.getX()) / surfDir.getX()); } else if (surfDir.getY() != 0) { tSurfFrom = ((surfEdge.getFrom().getY() - surfOr.getY()) / surfDir.getY()); } else if (surfDir.getZ() != 0 && holeDir.getZ() != 0) { tSurfFrom = ((surfEdge.getFrom().getZ() - surfOr.getZ()) / surfDir.getZ()); } else { log.warn("outer surface edge has a zero vector direction vector"); } if (holeDir.getX() != 0) { tHoleFrom = ((holeEdge.getFrom().getX() - holeOr.getX()) / holeDir.getX()); } else if (holeDir.getY() != 0) { tHoleFrom = ((holeEdge.getFrom().getY() - holeOr.getY()) / holeDir.getY()); } else if (holeDir.getZ() != 0) { tHoleFrom = ((holeEdge.getFrom().getZ() - holeOr.getZ()) / holeDir.getZ()); } else { log.warn("inner surface edge has a zero vector direction vector"); } if (tHoleFrom > tHole) { contained = false; } else if (tSurfFrom > tSurf) { crossings++; } } } } if (crossings % 2 == 0) { contained = false; } return contained; } /** * Checks if a hole and a surface is in the same plane. * @param hole the hole * @param surf the surface * @return boolean indicating werther or not the hole and plane is in the same plane */ private boolean planeCheck(Surface hole, Surface surf) { //finding an equation for the plane of surface hole Vertex normal = hole.normal(); //doing a lot to get edges here, //we really just need a point in the plane List holeEdges = hole.getEdges(); Iterator it = holeEdges.iterator(); if (it.hasNext()) { Edge holeEdge = (Edge)it.next(); Vertex point = holeEdge.getTo(); /* * equation for the plane of hole is now * normal.getX()*(x - point.getX()) + * normal.getY()*(y - point.getY()) + * normal.getZ()*(z - point.getZ()) == 0 */ List edges = surf.getEdges(); Iterator edgeIt = edges.iterator(); boolean inPlane = true; while (edgeIt.hasNext() && inPlane) { Edge edge = (Edge)edgeIt.next(); Vertex to = edge.getTo(); Vertex from = edge.getFrom(); //might have to use an EPSILON here instead if ((normal.getX() * (to.getX() - point.getX()) + normal.getY() * (to.getY() - point.getY()) + normal.getZ() * (to.getZ() - point.getZ()) != 0) && (normal.getX() * (from.getX() - point.getX()) + normal.getY() * (from.getY() - point.getY()) + normal.getZ() * (from.getZ() - point.getZ()) != 0)) { inPlane = false; } } return inPlane; } else { return false; } } } |
From: Nordholt <nor...@us...> - 2005-08-30 12:59:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4003 Modified Files: SelectTool.java Log Message: solved a conflict Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SelectTool.java 26 Aug 2005 14:48:15 -0000 1.9 --- SelectTool.java 30 Aug 2005 12:59:36 -0000 1.10 *************** *** 26,30 **** import java.util.Iterator; import java.util.Set; - import java.util.List; import org.apache.log4j.Logger; --- 26,29 ---- *************** *** 113,140 **** viewType = View.VIEW_3D; } ! Vertex v = vertexCollide(coords); ! if ((v != null) && (viewType != View.VIEW_3D)) { Notification n = new Notification(Notification.VERTEX_SELECTED, v.getId()); Notifier.getInstance().sendNotification(n); ! } else { ! Object selectObject; ! selectObject = view.getObjectAtPoint(x, y); ! if (selectObject instanceof Surface) { ! Surface surface = (Surface)selectObject; ! Notification n = new Notification(Notification.SURFACE_SELECTED, surface.getId()); ! Notifier.getInstance().sendNotification(n); ! } else if (selectObject instanceof Edge) { ! Edge edge = (Edge)selectObject; ! Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); ! Notifier.getInstance().sendNotification(n); ! } else if (selectObject instanceof Vertex) { ! Vertex vertex = (Vertex) selectObject; ! Notification n = new Notification(Notification.VERTEX_SELECTED, vertex.getId()); ! Notifier.getInstance().sendNotification(n); ! selectedVertex = vertex; ! } ! } ! } ! } /** --- 112,134 ---- viewType = View.VIEW_3D; } ! ! Object selectObject; ! selectObject = view.getObjectAtPoint(x, y); ! if (selectObject instanceof Vertex) { ! Vertex v = (Vertex)selectObject; Notification n = new Notification(Notification.VERTEX_SELECTED, v.getId()); Notifier.getInstance().sendNotification(n); ! } else if (selectObject instanceof Surface) { ! Surface surface = (Surface)selectObject; ! Notification n = new Notification(Notification.SURFACE_SELECTED, surface.getId()); ! Notifier.getInstance().sendNotification(n); ! } else if (selectObject instanceof Edge) { ! Edge edge = (Edge)selectObject; ! Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); ! Notifier.getInstance().sendNotification(n); ! } ! } ! } ! /** *************** *** 196,241 **** super.keyPressed(e); } ! } ! ! ! /** ! * Deletes a surface and its edges if it is safe to do so. ! * @param surface the surface to delete ! */ ! private void deleteSurface(Surface surface) { ! List edges = surface.getEdges(); ! Iterator it = edges.iterator(); ! Edge edge = null; ! removeSurface(surface); ! while (it.hasNext()) { ! edge = (Edge)it.next(); ! deleteEdge(edge); ! } ! ! } ! ! /** ! * Deletes an edge and it's endpoint vertecies if it is safe to do so. ! * @param edge the edge to delete ! */ ! private void deleteEdge(Edge edge) { ! Set surfaces = edge.getSurfaces(); ! if (surfaces.size() < 1) { ! removeEdge(edge); ! deleteVertex(edge.getTo()); ! deleteVertex(edge.getFrom()); ! } ! } ! ! /** ! * Deletes a vertex if it is safe to do so. ! * @param vertex the vertex to delete ! */ ! private void deleteVertex(Vertex vertex) { ! Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! removeVertex(vertex); ! } ! } /** --- 190,194 ---- super.keyPressed(e); } ! } /** |
From: Nordholt <nor...@us...> - 2005-08-30 12:55:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3284 Modified Files: ToolFactory.java Log Message: added code to handle the holetool Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ToolFactory.java 22 Aug 2005 14:30:59 -0000 1.4 --- ToolFactory.java 30 Aug 2005 12:54:55 -0000 1.5 *************** *** 43,48 **** /** debug tool */ - private PencilTool debug; /** --- 43,50 ---- /** debug tool */ private PencilTool debug; + + /** hole tool */ + private HoleTool hole; /** *************** *** 56,59 **** --- 58,62 ---- extrusion = new ExtrusionTool(glv); debug = new PencilTool(glv); + hole = new HoleTool(glv); Toolbar tb = Toolbar.getInstance(); *************** *** 68,71 **** --- 71,76 ---- but = tb.registerAction(new DebugAction(glv)); but.setToolTipText("Debug"); + but = tb.registerAction(new HoleAction(glv)); + but.setToolTipText("Hole"); Notifier.getInstance().addListener(select); } *************** *** 107,110 **** --- 112,117 ---- } else if (i == Tool.DEBUG_TOOL) { return debug; + } else if (i == Tool.HOLE_TOOL) { + return hole; } else { log.error("[get] No such tool " + i); *************** *** 224,227 **** --- 231,262 ---- } } + + /** + * The hole action inner class + */ + class HoleAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + HoleAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("drawicon.png"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.HOLE_TOOL); + } + } } /** *************** *** 231,235 **** /** The GLView */ private GLView glv = null; ! /** * Constructor --- 266,270 ---- /** The GLView */ private GLView glv = null; ! /** * Constructor *************** *** 243,247 **** putValue(Action.SMALL_ICON, im); } ! /** * Called when the button is pressed --- 278,282 ---- putValue(Action.SMALL_ICON, im); } ! /** * Called when the button is pressed *************** *** 252,253 **** --- 287,289 ---- } } + |
From: Nordholt <nor...@us...> - 2005-08-30 12:53:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2991 Modified Files: Tool.java Log Message: added a constant for the hole tool Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Tool.java 10 Aug 2005 12:42:46 -0000 1.3 --- Tool.java 30 Aug 2005 12:53:21 -0000 1.4 *************** *** 24,28 **** /** The debug tool */ public static final int DEBUG_TOOL = 4; ! ! } --- 24,28 ---- /** The debug tool */ public static final int DEBUG_TOOL = 4; ! /** The hole tool */ ! public static final int HOLE_TOOL = 5; } |
From: Nordholt <nor...@us...> - 2005-08-30 12:52:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2841 Modified Files: MoveTool.java Log Message: holes move with the surface they belong to Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MoveTool.java 25 Aug 2005 09:50:45 -0000 1.4 --- MoveTool.java 30 Aug 2005 12:52:06 -0000 1.5 *************** *** 11,14 **** --- 11,15 ---- import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Surface; import java.awt.event.MouseEvent; *************** *** 16,19 **** --- 17,22 ---- import java.util.List; + import java.util.Set; + import java.util.Iterator; import org.apache.log4j.Logger; *************** *** 89,92 **** --- 92,117 ---- } } + Set innerSurfaces = selectedSurface.getInnerSurfaces(); + if (innerSurfaces != null) { + Iterator innerIt = innerSurfaces.iterator(); + while (innerIt.hasNext()) { + Surface innerSurface = (Surface)innerIt.next(); + List innerEdges = Util.traverse(innerSurface); + for (int i = 0; i < innerEdges.size(); i++) { + Vertex v = (Vertex)innerEdges.get(i); + if (moveMode == XY) { + coords = new double[] {v.getX() + deltaX / moveSpeed, + v.getY() - deltaY / moveSpeed, + v.getZ() + 0}; + updateVertex(v, coords); + } else { + coords = new double[] {v.getX() + deltaX / moveSpeed, + v.getY() + 0, + v.getZ() - deltaY / moveSpeed}; + updateVertex(v, coords); + } + } + } + } } else if (selectedEdge != null) { Vertex to = selectedEdge.getTo(); |
From: Nordholt <nor...@us...> - 2005-08-30 12:49:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2414 Modified Files: ExtrusionTool.java Log Message: Changed to extrution work better with holes Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtrusionTool.java 19 Aug 2005 10:31:29 -0000 1.3 --- ExtrusionTool.java 30 Aug 2005 12:49:34 -0000 1.4 *************** *** 56,60 **** createExtension(); } ! } if (dragSurface != null) { if (viewType != View.VIEW_3D) { --- 56,60 ---- createExtension(); } ! } if (dragSurface != null) { if (viewType != View.VIEW_3D) { *************** *** 72,76 **** v.getZ() + proj.getZ()}); } ! } } else { double dX = pressPos[0] - e.getX(); --- 72,76 ---- v.getZ() + proj.getZ()}); } ! } } else { double dX = pressPos[0] - e.getX(); *************** *** 88,91 **** --- 88,106 ---- v.getZ() + normal.getZ()}); } + //also moving any inner surfaces + Set innerSurfaces = dragSurface.getInnerSurfaces(); + if (innerSurfaces != null) { + Iterator innerIt = innerSurfaces.iterator(); + while (innerIt.hasNext()) { + Surface innerSurf = (Surface)innerIt.next(); + List verticies = Util.traverse(innerSurf); + for (int count = 0; verticies != null && count < verticies.size(); count++) { + Vertex v = (Vertex)verticies.get(count); + updateVertex(v, new double[] {v.getX() + normal.getX(), + v.getY() + normal.getY(), + v.getZ() + normal.getZ()}); + } + } + } } } *************** *** 102,106 **** */ private boolean isExtrudeable(Surface s) { ! if (s == null) { return false; } --- 117,121 ---- */ private boolean isExtrudeable(Surface s) { ! if (s == null || s.getIsInner()) { return false; } *************** *** 147,158 **** /** ! * Do all the initial extrusion stuff */ ! private void createExtension() { Edge previousEdge = null; Vertex previousVertex = null; Edge first = null; List newEdges = new ArrayList(); ! List edges = selectedSurface.getEdges(); List top = new ArrayList(edges.size()); Iterator i = edges.iterator(); --- 162,175 ---- /** ! * Extends a single surface to a corresponding 3D figure. ! * @param extendSurf the surface to extend. ! * @return the top surface of the extended surface. */ ! private Surface extendSurface(Surface extendSurf) { Edge previousEdge = null; Vertex previousVertex = null; Edge first = null; List newEdges = new ArrayList(); ! List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); Iterator i = edges.iterator(); *************** *** 215,219 **** while (i.hasNext() && !found) { Edge temp = (Edge)i.next(); ! if (selectedSurface.getEdges().contains(temp) && !temp.equals(current)) { current = temp; found = true; --- 232,236 ---- while (i.hasNext() && !found) { Edge temp = (Edge)i.next(); ! if (extendSurf.getEdges().contains(temp) && !temp.equals(current)) { current = temp; found = true; *************** *** 222,226 **** } } ! dragSurface = createSurface(top); Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); --- 239,261 ---- } } ! return createSurface(top); ! } ! ! /** ! * Do all the initial extrusion stuff ! */ ! private void createExtension() { ! Surface top = extendSurface(selectedSurface); ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! Surface newInnerSurf = extendSurface(innerSurf); ! top.addHole(newInnerSurf); ! newInnerSurf.setIsInner(true); ! } ! } ! dragSurface = top; Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); |
From: Nordholt <nor...@us...> - 2005-08-30 12:47:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2079 Modified Files: DrawTool.java Log Message: small change Index: DrawTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DrawTool.java 5 Aug 2005 10:57:47 -0000 1.6 --- DrawTool.java 30 Aug 2005 12:47:25 -0000 1.7 *************** *** 31,35 **** /** The current Edge list */ ! private List edges; /** --- 31,35 ---- /** The current Edge list */ ! protected List edges; /** |
From: Nordholt <nor...@us...> - 2005-08-30 12:46:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867 Modified Files: AbstractTool.java Log Message: moved methods for safe vertex, edge and surface delete to abstracttool Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AbstractTool.java 25 Aug 2005 09:49:17 -0000 1.10 --- AbstractTool.java 30 Aug 2005 12:46:14 -0000 1.11 *************** *** 21,24 **** --- 21,26 ---- import java.util.List; + import java.util.Iterator; + import java.util.Set; import javax.swing.Timer; *************** *** 362,365 **** --- 364,424 ---- } + /** + * Deletes a surface and its edges if it is safe to do so. + * @param surface the surface to delete + */ + protected void deleteSurface(Surface surface) { + List edges = surface.getEdges(); + Iterator it = edges.iterator(); + Edge edge = null; + //checking if this is a hole in some surface an thus must removed before deleted + //consider method that does not have to get all surfaces. + Set surfaces = SurfaceFacade.getInstance().findAll(); + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surf = (Surface)surfIt.next(); + Set inners = surf.getInnerSurfaces(); + if (inners != null) { + Iterator innerIt = inners.iterator(); + while (innerIt.hasNext()) { + Surface innerSurf = (Surface)innerIt.next(); + if (innerSurf.equals(surface)) { + surf.removeHole(surface); + SurfaceFacade.getInstance().update(surf); + } + } + } + } + removeSurface(surface); + while (it.hasNext()) { + edge = (Edge)it.next(); + deleteEdge(edge); + } + } + + /** + * Deletes an edge and it's endpoint vertecies if it is safe to do so. + * @param edge the edge to delete + */ + protected void deleteEdge(Edge edge) { + Set surfaces = edge.getSurfaces(); + if (surfaces.size() < 1) { + removeEdge(edge); + deleteVertex(edge.getTo()); + deleteVertex(edge.getFrom()); + } + } + + /** + * Deletes a vertex if it is safe to do so. + * @param vertex the vertex to delete + */ + protected void deleteVertex(Vertex vertex) { + Set edges = vertex.getEdges(); + if (edges.size() < 1) { + removeVertex(vertex); + } + } + /** * Invoked when the mouse cursor has been moved |
From: Michael L. <he...@us...> - 2005-08-30 09:37:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26344/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Un-Projecting is implemented Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PencilTool.java 26 Aug 2005 14:48:15 -0000 1.2 --- PencilTool.java 30 Aug 2005 09:37:25 -0000 1.3 *************** *** 87,92 **** --- 87,94 ---- if (selectedVertex != null) { Vertex projected = transformation.project(selectedVertex); + Vertex unprojected = transformation.unProject(projected); System.out.println(selectedVertex.toString()); System.out.println(projected.toString()); + System.out.println(unprojected.toString()); } } |
From: Michael L. <he...@us...> - 2005-08-30 09:37:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26344/src/net/sourceforge/bprocessor/gl/view Modified Files: Transformation.java Log Message: Un-Projecting is implemented Index: Transformation.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Transformation.java 30 Aug 2005 08:22:35 -0000 1.2 --- Transformation.java 30 Aug 2005 09:37:25 -0000 1.3 *************** *** 117,120 **** --- 117,184 ---- return projection; } + + /** + * Un-projects the Surface to screen coordinates + * + * @param surface The Surface to un-project + * @return The un-projected Surface + */ + public Surface unProject(Surface surface) { + List edges = new ArrayList(); + Iterator iter = surface.getEdges().iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + edges.add(unProject(current)); + } + Surface projected = new Surface("projection of " + surface.getName()); + projected.setEdges(edges); + return projected; + } + + /** + * Un-projects the Edge to model coordinates + * @param edge The edge to un-project + * @return The un-projected edge + */ + public Edge unProject(Edge edge) { + Vertex from = unProject(edge.getFrom()); + Vertex to = unProject(edge.getTo()); + Edge projected = new Edge("projection of " + edge.getName()); + projected.setFrom(from); + projected.setTo(to); + return projected; + } + + /** + * Un-projects the Vertex to model coordinates + * @param vertex The Vertex to un-project + * @return The un-projected Vertex + */ + public Vertex unProject(Vertex vertex) { + double x = vertex.getX(); + double y = vertex.getY(); + double z = vertex.getZ(); + double[] view = new double[3]; + boolean success = glu.gluUnProject(x, y, z, modelview, projection, viewport, view); + if (!success) { + System.out.println("error un-projecting"); + } + 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])); + projection.setZ(round(view[2])); + return projection; + } + + /** + * Round to 4 decimals + * @param value The value to round + * @return The rounded value + */ + private double round(double value) { + long i = (long) Math.round(value * 1000); + return ((double) i) / 1000.0; + } } |
From: Michael L. <he...@us...> - 2005-08-30 08:22:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7635/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View3D.java Transformation.java Log Message: Projecting from model coordinates to screen coordinates is working Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AbstractView.java 26 Aug 2005 14:48:15 -0000 1.12 --- AbstractView.java 30 Aug 2005 08:22:35 -0000 1.13 *************** *** 113,117 **** /** The viewport used for rendering the scene */ ! protected int[] viewport = new int[4]; /** The x-coordinate of last selection */ --- 113,117 ---- /** The viewport used for rendering the scene */ ! protected int[] screenport = new int[4]; /** The x-coordinate of last selection */ Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** View3D.java 26 Aug 2005 14:48:15 -0000 1.8 --- View3D.java 30 Aug 2005 08:22:35 -0000 1.9 *************** *** 76,84 **** gl.glRotated(rotationZ, 0.0, 0.0, 1.0); ! ! gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix); ! gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix); ! gl.glGetIntegerv(GL.GL_VIEWPORT, viewport); ! } --- 76,84 ---- gl.glRotated(rotationZ, 0.0, 0.0, 1.0); ! if (picking == 0) { ! gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix); ! gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix); ! gl.glGetIntegerv(GL.GL_VIEWPORT, screenport); ! } } *************** *** 172,176 **** */ public Transformation transformation() { ! return new Transformation(glu, modelMatrix, projMatrix, viewport); } --- 172,176 ---- */ public Transformation transformation() { ! return new Transformation(glu, modelMatrix, projMatrix, screenport); } Index: Transformation.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Transformation.java 26 Aug 2005 14:48:15 -0000 1.1 --- Transformation.java 30 Aug 2005 08:22:35 -0000 1.2 *************** *** 106,110 **** double z = vertex.getZ(); double[] view = new double[3]; ! glu.gluProject(x, y, z, modelview, projection, viewport, view); Vertex projection = new Vertex("projection of " + vertex.getName()); System.out.println("x = " + view[0]); --- 106,113 ---- double z = vertex.getZ(); double[] view = new double[3]; ! boolean success = glu.gluProject(x, y, z, modelview, projection, viewport, view); ! if (!success) { ! System.out.println("error projecting"); ! } Vertex projection = new Vertex("projection of " + vertex.getName()); System.out.println("x = " + view[0]); |
From: Michael L. <he...@us...> - 2005-08-26 14:49:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26875/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: Implemented intersection Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Plane.java 25 Aug 2005 14:32:37 -0000 1.1 --- Plane.java 26 Aug 2005 14:49:23 -0000 1.2 *************** *** 44,55 **** /** ! * Find the intersection with the ray (x y t) * @param x the x * @param y the y ! * @return the intersection with the (x y t) ray */ double intersection(double x, double y) { ! ! return 0; } --- 44,60 ---- /** ! * Find the intersection with the ray (x y t), ! * if the ray is parallel to the Plane, otherwise NaN is ! * returned. The return value is the computed t. * @param x the x * @param y the y ! * @return the intersection with the (x y t) ray or NaN */ double intersection(double x, double y) { ! if (c != 0) { ! return -(a * x + b * y + d) / c; ! } else { ! return Double.NaN; ! } } |
From: Michael L. <he...@us...> - 2005-08-26 14:48:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26667/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java View3D.java Added Files: Transformation.java Log Message: Added Transformation that implements transforming between model and screen coordinates. Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AbstractView.java 25 Aug 2005 14:34:07 -0000 1.11 --- AbstractView.java 26 Aug 2005 14:48:15 -0000 1.12 *************** *** 106,109 **** --- 106,118 ---- protected IntBuffer selectBuffer; + /** The modelview matrix used for rendering the scene */ + protected double[] modelMatrix = new double[16]; + + /** The projection matrix used for rendering the scene */ + protected double[] projMatrix = new double[16]; + + /** The viewport used for rendering the scene */ + protected int[] viewport = new int[4]; + /** The x-coordinate of last selection */ protected double x; *************** *** 723,727 **** double far = z1 / 0xFFFFFFFF; double near = z2 / 0xFFFFFFFF; ! System.out.println("z1 = " + far + "z2 = " + near); } bufferOffset += names; --- 732,736 ---- double far = z1 / 0xFFFFFFFF; double near = z2 / 0xFFFFFFFF; ! System.out.println("z1 = " + far + " z2 = " + near); } bufferOffset += names; *************** *** 820,822 **** --- 829,839 ---- */ public abstract double[] toCanvasCoords(double[] coords); + + /** + * Get transformation for model to screen coordinates + * @return The transformation + */ + public Transformation transformation() { + return null; + } } Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** View3D.java 25 Aug 2005 09:44:18 -0000 1.7 --- View3D.java 26 Aug 2005 14:48:15 -0000 1.8 *************** *** 75,78 **** --- 75,84 ---- gl.glRotated(rotationX, 1.0, 0.0, 0.0); gl.glRotated(rotationZ, 0.0, 0.0, 1.0); + + + gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix); + gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix); + gl.glGetIntegerv(GL.GL_VIEWPORT, viewport); + } *************** *** 160,162 **** --- 166,177 ---- } } + + /** + * Get transformation for model to screen coordinates + * @return The transformation + */ + public Transformation transformation() { + return new Transformation(glu, modelMatrix, projMatrix, viewport); + } + } --- NEW FILE: Transformation.java --- //--------------------------------------------------------------------------------- // $Id: Transformation.java,v 1.1 2005/08/26 14:48:15 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.view; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import net.java.games.jogl.GLU; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * The Transformation is represented by the two matrices * modelview and projection and the viewport, and has methods * to transform coordinates from model to screen and back again. * */ public class Transformation { /** The glu */ private GLU glu; /** * The modelview contains the modelview matrix represented * as 16 double values. */ private double[] modelview; /** * The projection contains the projection matrix represented * as 16 double values. */ private double[] projection; /** * The viewport contains the viewport represented as 4 * int values */ private int[] viewport; /** * Constructor * * @param glu The GLU * @param modelview The modelview * @param projection The projection * @param viewport The viewport */ public Transformation(GLU glu, double[] modelview, double[] projection, int[] viewport) { super(); this.glu = glu; this.modelview = modelview; this.projection = projection; this.viewport = viewport; } /** * Projects the Surface to screen coordinates * * @param surface The Surface to project * @return The projected Ssurface */ public Surface project(Surface surface) { List edges = new ArrayList(); Iterator iter = surface.getEdges().iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); edges.add(project(current)); } Surface projected = new Surface("projection of " + surface.getName()); projected.setEdges(edges); return projected; } /** * Projects the Edge to screen coordinates * @param edge The edge to project * @return The projected edge */ public Edge project(Edge edge) { Vertex from = project(edge.getFrom()); Vertex to = project(edge.getTo()); Edge projected = new Edge("projection of " + edge.getName()); projected.setFrom(from); projected.setTo(to); return projected; } /** * Projects the Vertex to screen coordinates * @param vertex The Vertex to project * @return The projected Vertex */ public Vertex project(Vertex vertex) { double x = vertex.getX(); double y = vertex.getY(); double z = vertex.getZ(); double[] view = new double[3]; glu.gluProject(x, y, z, modelview, projection, viewport, view); Vertex projection = new Vertex("projection of " + vertex.getName()); System.out.println("x = " + view[0]); projection.setX(view[0]); projection.setY(view[1]); projection.setZ(view[2]); return projection; } } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** View.java 25 Aug 2005 09:45:42 -0000 1.6 --- View.java 26 Aug 2005 14:48:15 -0000 1.7 *************** *** 154,157 **** --- 154,163 ---- */ public double[] getAlignPoint(); + + /** + * Get transformation for model to screen coordinates + * @return The transformation + */ + public Transformation transformation(); /** |
From: Michael L. <he...@us...> - 2005-08-26 14:48:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26667/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java SelectTool.java Log Message: Added Transformation that implements transforming between model and screen coordinates. Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SelectTool.java 23 Aug 2005 11:56:48 -0000 1.8 --- SelectTool.java 26 Aug 2005 14:48:15 -0000 1.9 *************** *** 128,131 **** --- 128,136 ---- Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); + } else if (selectObject instanceof Vertex) { + Vertex vertex = (Vertex) selectObject; + Notification n = new Notification(Notification.VERTEX_SELECTED, vertex.getId()); + Notifier.getInstance().sendNotification(n); + selectedVertex = vertex; } } Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PencilTool.java 22 Aug 2005 14:30:59 -0000 1.1 --- PencilTool.java 26 Aug 2005 14:48:15 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; *************** *** 83,87 **** int y = e.getY(); View v = glv.getView(); ! } /** --- 84,93 ---- int y = e.getY(); View v = glv.getView(); ! Transformation transformation = v.transformation(); ! if (selectedVertex != null) { ! Vertex projected = transformation.project(selectedVertex); ! System.out.println(selectedVertex.toString()); ! System.out.println(projected.toString()); ! } } /** *************** *** 93,96 **** --- 99,103 ---- int y = e.getY(); View v = glv.getView(); + } |