bprocessor-commit Mailing List for B-processor (Page 75)
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...> - 2007-03-05 12:14:13
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21006/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Added a relate menu item that does nothing yet Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** PopupMenu.java 16 Feb 2007 09:56:42 -0000 1.26 --- PopupMenu.java 5 Mar 2007 12:14:10 -0000 1.27 *************** *** 94,99 **** ); jm.add(offsetItem); ! } ! return jm; } --- 94,104 ---- ); jm.add(offsetItem); ! AbstractAction relate = new CollectionMenuAction(c, "Relate") { ! public void actionPerformed(ActionEvent e) { ! ! } ! }; ! jm.add(relate); ! } return jm; } |
|
From: Michael L. <he...@us...> - 2007-03-04 23:34:29
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10284/src/net/sourceforge/bprocessor/model Modified Files: CoordinateSystem.java Constructor.java Added Files: Relation.java Log Message: Improved hitdetection of surface/edge intersections slightly. Fixed problem with overlarge CoordinateSystems in hitdetection. Implemented an alternative movetool that is an experiment in moving vertices to a plane, sliding on binding edges. Started implementation of relations, that contains an offset in the form of an expression. Index: Constructor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constructor.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Constructor.java 8 Feb 2007 12:23:39 -0000 1.17 --- Constructor.java 4 Mar 2007 23:14:45 -0000 1.18 *************** *** 26,30 **** /** The origin of the constructor */ ! private Vertex origin; /** Tells if the constructor is extended for hit or not */ --- 26,30 ---- /** The origin of the constructor */ ! protected Vertex origin; /** Tells if the constructor is extended for hit or not */ Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** CoordinateSystem.java 2 Jan 2007 17:48:58 -0000 1.33 --- CoordinateSystem.java 4 Mar 2007 23:14:45 -0000 1.34 *************** *** 24,33 **** */ public class CoordinateSystem extends Constructor { - - /** - * - */ - private static final long serialVersionUID = 1L; - /** The i unit vector (x-direction) */ protected Vertex i; --- 24,27 ---- *************** *** 42,45 **** --- 36,42 ---- private boolean onlyPlane; + /** Relations */ + protected Collection<Relation> relations; + /** * Empty constructor for persistence only *************** *** 60,63 **** --- 57,61 ---- n = new Vertex(0, 0, 1); onlyPlane = false; + relations = new LinkedList<Relation>(); } *************** *** 71,83 **** public CoordinateSystem(Vertex i, Vertex j, Vertex n, Vertex origin) { super(origin); - //i.normalize(); - //j.normalize(); - //n.normalize(); this.i = i; this.j = j; this.n = n; onlyPlane = false; } /** {@inheritDoc} */ public Vertex canMove(double x, double y, double z, Collection entities) { --- 69,104 ---- public CoordinateSystem(Vertex i, Vertex j, Vertex n, Vertex origin) { super(origin); this.i = i; this.j = j; this.n = n; onlyPlane = false; + relations = new LinkedList<Relation>(); } + /** + * + * @return relations + */ + public Collection<Relation> relations() { + return relations; + } + + /** + * + * @param relation Relation + */ + public void add(Relation relation) { + relations.add(relation); + relation.setId(new Long(relations.size() + 1)); + } + + /** + * + * @param relation Relation + */ + public void remove(Relation relation) { + relations.remove(relation); + } + /** {@inheritDoc} */ public Vertex canMove(double x, double y, double z, Collection entities) { *************** *** 241,244 **** --- 262,292 ---- /** + * Return the projection of the vertex in the xy plane + * of this CoordinateSystem. + * @param vertex The vertex to project. + * @return The projected vertex. + */ + public Vertex project(Vertex vertex) { + Vertex vector = vertex.minus(origin); + double t = vector.dot(n); + Vertex normal = n.copy(); + normal.scale(t); + vector = vector.minus(normal); + return origin.add(vector); + } + + /** + * Slide the vertex along the given vector to the xy plane + * of this CoordinateSystem. + * @param vertex The vertex to slide + * @param vector The vector to slide on + * @return The resulting vertex. + */ + public Vertex slide(Vertex vertex, Vertex vector) { + Plane plane = plane(); + return plane.intersection(vertex, vector, true); + } + + /** * Return the vertex translated to this CoordinateSystem * @param vertex The vertex to translate --- NEW FILE: Relation.java --- //--------------------------------------------------------------------------------- // $Id: Relation.java,v 1.1 2007/03/04 23:14:45 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.model; import java.util.LinkedList; import java.util.List; /** * Relation */ public class Relation extends Entity implements Parametric { private Geometric geometric; private String offset; /** * Constructs a Relation * @param geometric Geomtric * @param offset Expression */ public Relation(Geometric geometric, String offset) { this.geometric = geometric; this.offset = offset; } /** {@inheritDoc} */ public List getAttributes() { LinkedList attributes = new LinkedList(); attributes.add(new Attribute("Object", geometric)); attributes.add(new Attribute("Offset", offset)); return attributes; } /** {@inheritDoc} */ public String getGeneralName() { return "Relation"; } /** {@inheritDoc} */ public void setAttributes(List attributes) { // TODO Auto-generated method stub } /** {@inheritDoc} */ @Override public void delete() { // TODO Auto-generated method stub } } |
|
From: Michael L. <he...@us...> - 2007-03-04 23:34:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10265/src/net/sourceforge/bprocessor/gl/tool Modified Files: AltMoveTool.java Log Message: Improved hitdetection of surface/edge intersections slightly. Fixed problem with overlarge CoordinateSystems in hitdetection. Implemented an alternative movetool that is an experiment in moving vertices to a plane, sliding on binding edges. Started implementation of relations, that contains an offset in the form of an expression. Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AltMoveTool.java 1 Mar 2007 14:53:56 -0000 1.2 --- AltMoveTool.java 4 Mar 2007 23:14:40 -0000 1.3 *************** *** 10,15 **** --- 10,18 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.Collection; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; + import java.util.Map; import net.sourceforge.bprocessor.gl.GLView; *************** *** 20,24 **** --- 23,29 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 32,35 **** --- 37,43 ---- private CoordinateSystem system; private Plane dragplane; + private Vertex origin; + private Collection<Vertex> vertices; + private Map<Vertex, Collection<Edge>> map; /** *************** *** 40,44 **** --- 48,87 ---- super(glv, cursor); } + + private Map<Vertex, Collection<Edge>> + edgeMap(Space space, Collection<Vertex> vertices) { + HashMap<Vertex, Collection<Edge>> map = new HashMap<Vertex, Collection<Edge>>(); + for (Vertex vertex : vertices) { + map.put(vertex, new LinkedList<Edge>()); + } + Collection<Edge> edges = space.getEdges(); + for (Edge edge : edges) { + Collection<Edge> from = map.get(edge.getFrom()); + Collection<Edge> to = map.get(edge.getTo()); + if (from != null && to == null) { + from.add(edge); + } + if (to != null && from == null) { + to.add(edge); + } + } + return map; + } + private void move(Vertex to) { + system.setOrigin(to); + for (Vertex vertex : vertices) { + Vertex vector = system.getN(); + Collection<Edge> binding = map.get(vertex); + if (!binding.isEmpty()) { + Edge bind = binding.iterator().next(); + vector = bind.getDirection(); + vector.normalize(); + } + Vertex project = system.slide(vertex, vector); + vertex.set(project); + } + } + /** {@inheritDoc} */ @Override *************** *** 61,64 **** --- 104,108 ---- edge.setStrippled(true); edges.add(edge); + move(origin.add(normal)); } feedback(edges); *************** *** 69,80 **** protected void pressed(MouseEvent e) { if (system == null) { - System.out.println("Alternative Moving!"); findTarget(e, View.OBJECTS); glv.getView().makeTarget(target); if (target instanceof Surface) { - System.out.println(" Surface"); surface = (Surface) target; Selection.primary().set(surface); system = surface.coordinateSystem(); system.onlyPlane(true); system.setActive(true); --- 113,127 ---- protected void pressed(MouseEvent e) { if (system == null) { findTarget(e, View.OBJECTS); glv.getView().makeTarget(target); if (target instanceof Surface) { surface = (Surface) target; + Space space = surface.getOwner(); + vertices = surface.collect(); + map = edgeMap(space, vertices); + Selection.primary().set(surface); system = surface.coordinateSystem(); + origin = system.getOrigin().copy(); system.onlyPlane(true); system.setActive(true); *************** *** 95,99 **** } } else { ! System.out.println("clean up."); cleanUp(); moved(e); --- 142,147 ---- } } else { ! Project.getInstance().checkpoint(); ! origin = null; cleanUp(); moved(e); *************** *** 104,110 **** --- 152,166 ---- @Override public void cleanUp() { + if (origin != null) { + move(origin); + } glv.getView().removeTempConstructor(system); surface = null; system = null; + dragplane = null; + origin = null; + vertices = null; + map = null; + Selection.primary().clear(); super.cleanUp(); |
|
From: Michael L. <he...@us...> - 2007-03-04 23:34:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10265/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Improved hitdetection of surface/edge intersections slightly. Fixed problem with overlarge CoordinateSystems in hitdetection. Implemented an alternative movetool that is an experiment in moving vertices to a plane, sliding on binding edges. Started implementation of relations, that contains an offset in the form of an expression. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** View.java 1 Mar 2007 14:53:56 -0000 1.190 --- View.java 4 Mar 2007 23:14:40 -0000 1.191 *************** *** 515,518 **** --- 515,526 ---- return lastSurface; } + + /** + * + * @param surface Surface + */ + public static void setLastSurface(Surface surface) { + lastSurface = surface; + } /** *************** *** 900,904 **** } ! drawSpace(Project.getInstance().world(), false); //Draw edges --- 908,912 ---- } ! drawSpace(Project.getInstance().world(), false, false); //Draw edges *************** *** 1058,1066 **** * @param space The Space * @param active inside active space */ ! private void drawSpace(Space space, boolean active) { if (space == Project.getInstance().getActiveSpace()) { active = true; } gl.glPushMatrix(); transform(space.getTransformations()); --- 1066,1079 ---- * @param space The Space * @param active inside active space + * @param selected inside selected space */ ! private void drawSpace(Space space, boolean active, boolean selected) { if (space == Project.getInstance().getActiveSpace()) { active = true; } + Collection<Geometric> selection = Selection.primary(); + if (selection.contains(space)) { + selected = true; + } gl.glPushMatrix(); transform(space.getTransformations()); *************** *** 1106,1110 **** while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, active); } gl.glPopMatrix(); --- 1119,1123 ---- while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, active, selected); } gl.glPopMatrix(); *************** *** 2030,2037 **** { Camera camera = Project.getInstance().getCurrentCamera(); ! Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65) * (500 / height); ! double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! Collection all = new LinkedList(); all.addAll(space.getConstructors()); --- 2043,2047 ---- { Camera camera = Project.getInstance().getCurrentCamera(); ! Collection all = new LinkedList(); all.addAll(space.getConstructors()); *************** *** 2042,2046 **** while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); ! if (!excluded.contains(current)) { if (current.getOwner() != owner) { --- 2052,2056 ---- while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); ! double dist = camera.distance(current.getOrigin()); if (!excluded.contains(current)) { if (current.getOwner() != owner) { *************** *** 2050,2056 **** transformTo(owner); } - if (camera.getType() == Camera.PERSPECTIVE) { - dist = (current.getOrigin().minus(v)).length() * scale; - } if (selectionMode == INTERSECTIONS) { if (current.isEditable()) { --- 2060,2063 ---- *************** *** 2510,2514 **** // into empty space. if (object == null && vertex == null && edge == null) { ! lastSurface = surface; } --- 2517,2521 ---- // into empty space. if (object == null && vertex == null && edge == null) { ! setLastSurface(surface); } *************** *** 2518,2522 **** // into empty space. if (lastSurface == null) { ! lastSurface = surface; } --- 2525,2529 ---- // into empty space. if (lastSurface == null) { ! setLastSurface(surface); } *************** *** 2630,2633 **** --- 2637,2653 ---- if (surface != null) { Plane plane = surface.plane(); + for (Edge current : (Collection<Edge>) edges) { + Vertex intersection = plane.intersection(current); + if (intersection != null) { + Vertex projected = transformation.project(intersection); + double dx = x - projected.getX(); + double dy = (height - y) - projected.getY(); + double distance = Math.sqrt(dx * dx + dy * dy); + if (distance < 5) { + return new Intersection(intersection, + Intersection.SURFACE_INTERSECTION, surface); + } + } + } Vertex intersection = plane.intersection(ray); return new Intersection(intersection, Intersection.SURFACE, surface); |
|
From: Michael L. <he...@us...> - 2007-03-04 23:34:23
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10300/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Improved hitdetection of surface/edge intersections slightly. Fixed problem with overlarge CoordinateSystems in hitdetection. Implemented an alternative movetool that is an experiment in moving vertices to a plane, sliding on binding edges. Started implementation of relations, that contains an offset in the form of an expression. Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** GenericTreeView.java 8 Feb 2007 12:24:32 -0000 1.72 --- GenericTreeView.java 4 Mar 2007 23:14:50 -0000 1.73 *************** *** 20,23 **** --- 20,24 ---- import java.util.Iterator; import java.util.LinkedList; + import java.util.List; import java.util.Map; import java.util.Set; *************** *** 44,47 **** --- 45,49 ---- import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Constructor; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; *************** *** 51,54 **** --- 53,57 ---- import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Relation; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Space; *************** *** 712,727 **** * ConstructorNode */ ! public class ConstructorNode extends ContainerNode { ! /** ! * ! */ ! private static final long serialVersionUID = 1L; ! /** * Constructor for ConstructorNode ! * @param c The constructor */ ! public ConstructorNode(Constructor c) { ! super(c, c.getConnectedGeometry()); } --- 715,729 ---- * ConstructorNode */ ! public class ConstructorNode extends EntityNode { /** * Constructor for ConstructorNode ! * @param constructor The constructor */ ! public ConstructorNode(Constructor constructor) { ! super(constructor); ! if (constructor instanceof CoordinateSystem) { ! CoordinateSystem system = (CoordinateSystem) constructor; ! add(new ContainerNode("Relations", system.relations())); ! } } *************** *** 742,747 **** model.nodeChanged(this); } ! Constructor c = (Constructor) o; ! super.update(c.getConnectedGeometry()); } } --- 744,751 ---- model.nodeChanged(this); } ! if (o instanceof CoordinateSystem) { ! CoordinateSystem system = (CoordinateSystem) o; ! ((GenericNode)getChildAt(0)).update(system.relations()); ! } } } *************** *** 1313,1317 **** /** ! * ConstraintContainer */ public class TransformationContainer extends ContainerNode { --- 1317,1336 ---- /** ! * RelationContainer ! */ ! public class RelationContainer extends ContainerNode { ! /** ! * Constructs a RelationContainer ! * @param relations The constraints ! * @return ! */ ! public RelationContainer(List<Relation> relations) { ! super("Relations", relations); ! update(relations); ! } ! } ! ! /** ! * TransformationContainer */ public class TransformationContainer extends ContainerNode { |
|
From: Michael L. <he...@us...> - 2007-03-01 14:54:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15680/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java AltMoveTool.java PanStrategy.java Log Message: Experimenting with move-interaction Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AltMoveTool.java 28 Feb 2007 15:25:52 -0000 1.1 --- AltMoveTool.java 1 Mar 2007 14:53:56 -0000 1.2 *************** *** 10,15 **** --- 10,26 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.LinkedList; + import java.util.List; import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.gl.view.Transformation; + import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 18,21 **** --- 29,36 ---- public class AltMoveTool extends AbstractPencil { + private Surface surface; + private CoordinateSystem system; + private Plane dragplane; + /** * @param glv GLView *************** *** 29,33 **** @Override protected void moved(MouseEvent e) { ! } --- 44,66 ---- @Override protected void moved(MouseEvent e) { ! List<Edge> edges = new LinkedList<Edge>(); ! if (system == null) { ! findTarget(e, View.OBJECTS); ! glv.getView().makeTarget(target); ! } else { ! Vertex hit = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! current = new Intersection(hit, Intersection.SURFACE, null); ! Vertex from = start.vertex(); ! Vertex delta = hit.minus(from); ! Vertex normal = system.getN().copy(); ! double distance = normal.dot(delta); ! normal.scale(distance); ! Vertex to = from.add(normal); ! makeTarget(current); ! Edge edge = new Edge(from, to); ! edge.setStrippled(true); ! edges.add(edge); ! } ! feedback(edges); } *************** *** 35,39 **** @Override protected void pressed(MouseEvent e) { ! System.out.println("Alternative Moving!"); } } --- 68,112 ---- @Override protected void pressed(MouseEvent e) { ! if (system == null) { ! System.out.println("Alternative Moving!"); ! findTarget(e, View.OBJECTS); ! glv.getView().makeTarget(target); ! if (target instanceof Surface) { ! System.out.println(" Surface"); ! surface = (Surface) target; ! Selection.primary().set(surface); ! system = surface.coordinateSystem(); ! system.onlyPlane(true); ! system.setActive(true); ! start = findIntersection(e); ! makeTarget(start); ! glv.getView().addTempConstructor(system); ! ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = e.getX(); ! double y = View.getHeight() - e.getY(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! Plane plane = system.plane(); ! dragplane = plane.orthogonalPlane(ray); ! } ! } else { ! System.out.println("clean up."); ! cleanUp(); ! moved(e); ! } ! } ! ! /** {@inheritDoc} */ ! @Override ! public void cleanUp() { ! glv.getView().removeTempConstructor(system); ! surface = null; ! system = null; ! Selection.primary().clear(); ! super.cleanUp(); } } Index: PanStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PanStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PanStrategy.java 26 Nov 2006 22:15:15 -0000 1.2 --- PanStrategy.java 1 Mar 2007 14:53:56 -0000 1.3 *************** *** 75,84 **** } double d = -dx * center[0] - dy * center[1] - dz * center[2]; ! Vertex first = view.toPlaneCoords(new double[] {x, ! y}, ! new Plane(dx, dy, dz, d)); ! Vertex second = view.toPlaneCoords(new double[] {e.getX(), ! e.getY()}, ! new Plane(dx, dy, dz, d)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), --- 75,83 ---- } double d = -dx * center[0] - dy * center[1] - dz * center[2]; ! Vertex first = view.toPlaneCoords(x, y, ! new Plane(dx, dy, dz, d)); ! Vertex second = view.toPlaneCoords(e.getX(), ! e.getY(), ! new Plane(dx, dy, dz, d)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ExtrusionTool.java 19 Feb 2007 15:47:43 -0000 1.49 --- ExtrusionTool.java 1 Mar 2007 14:53:56 -0000 1.50 *************** *** 172,176 **** } else { // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); Vertex normal = extrudesurface.normal(); //a bit cleanup --- 172,176 ---- } else { // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); Vertex normal = extrudesurface.normal(); //a bit cleanup *************** *** 263,267 **** Plane plane = extrudesurface.plane(); dragplane = plane.orthogonalPlane(ray); ! from = view.toPlaneCoords(new double[] {startx, starty}, dragplane); all = !e.isAltDown(); } --- 263,267 ---- Plane plane = extrudesurface.plane(); dragplane = plane.orthogonalPlane(ray); ! from = view.toPlaneCoords(startx, starty, dragplane); all = !e.isAltDown(); } |
|
From: Michael L. <he...@us...> - 2007-03-01 14:54:13
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15680/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Experimenting with move-interaction Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** View.java 21 Feb 2007 14:57:24 -0000 1.189 --- View.java 1 Mar 2007 14:53:56 -0000 1.190 *************** *** 3038,3043 **** /** {@inheritDoc} */ ! public Vertex toModelCoords(double[] coords) { ! return toPlaneCoords(coords, new Plane(0, 0, 1, 0)); } --- 3038,3043 ---- /** {@inheritDoc} */ ! public Vertex toModelCoords(double x, double y) { ! return toPlaneCoords(x, y, new Plane(0, 0, 1, 0)); } *************** *** 3051,3074 **** /** {@inheritDoc} */ ! public Vertex toPlaneCoords(double[] coords, Plane plane) { ! if (coords.length == 2 && plane != null) { ! double x = coords[0]; ! double y = View.getHeight() - coords[1]; ! ! Transformation transformation = transformation(); ! ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = transformation.unProject(ray); ! Vertex vertex = plane.intersection(ray); ! ! if (vertex != null) { ! return vertex; ! } ! } else { ! log.warn("Too many arguments " + coords.length + ", " + plane.toString()); ! } ! return null; } --- 3051,3063 ---- /** {@inheritDoc} */ ! public Vertex toPlaneCoords(double x, double y, Plane plane) { ! y = View.getHeight() - y; ! Transformation transformation = transformation(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = transformation.unProject(ray); ! Vertex vertex = plane.intersection(ray); ! return vertex; } |
|
From: Michael L. <he...@us...> - 2007-02-28 15:26:07
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2725/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: AltMoveTool.java Log Message: Experimenting Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ToolFactory.java 23 Feb 2007 11:09:18 -0000 1.77 --- ToolFactory.java 28 Feb 2007 15:25:52 -0000 1.78 *************** *** 113,116 **** --- 113,125 ---- private RotationTool rotation; + /** The tool for binding constructors and geometry together */ + private RelationTool relation; + + /** The tool for focusing on objects */ + private FocusTool focusTool; + + /** The too for moving alternatively */ + private AltMoveTool altMoveTool; + /** The selection button */ private JToggleButton selBut; *************** *** 151,160 **** /** The alternative rect tool button */ private JToggleButton altRectBut; - - /** The tool for binding constructors and geometry together */ - private RelationTool relation; - - /** The tool for focusing on objects */ - private FocusTool focusTool; /** --- 160,163 ---- *************** *** 210,213 **** --- 213,217 ---- altRect = new RectTool(glv, pencilcursor); focusTool = new FocusTool(glv, null); + altMoveTool = new AltMoveTool(glv, pencilcursor); Toolbar tb = Toolbar.getInstance(); *************** *** 232,235 **** --- 236,240 ---- moveBut.setMnemonic(KeyEvent.VK_M); registerTool(Tool.CONTROLLED_MOVE_TOOL, controlled, "Biconmovetool.gif", "Controlled Move"); + registerTool(Tool.ALT_MOVE_TOOL, altMoveTool, "Biconmovetool.gif", "Alternative Moving"); rotationBut = this.registerTool(Tool.ROTATION_TOOL, rotation, "Biconrotaxe.gif", "Rotate"); tb.addSeparator(3); --- NEW FILE: AltMoveTool.java --- //--------------------------------------------------------------------------------- // $Id: AltMoveTool.java,v 1.1 2007/02/28 15:25:52 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.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import net.sourceforge.bprocessor.gl.GLView; /** * Alternative Move Tool */ public class AltMoveTool extends AbstractPencil { /** * @param glv GLView * @param cursor Cursor */ public AltMoveTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** {@inheritDoc} */ @Override protected void moved(MouseEvent e) { } /** {@inheritDoc} */ @Override protected void pressed(MouseEvent e) { System.out.println("Alternative Moving!"); } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Tool.java 22 Feb 2007 12:36:57 -0000 1.29 --- Tool.java 28 Feb 2007 15:25:52 -0000 1.30 *************** *** 64,67 **** --- 64,69 ---- /** the tool for focusing on objects */ public static final int FOCUS_TOOL = 21; + /** the tool for alternative moving of objects */ + public static final int ALT_MOVE_TOOL = 22; /** |
|
From: rimestad <rim...@us...> - 2007-02-26 15:06:44
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16474/src/net/sourceforge/bprocessor/gl/tool Modified Files: EraserTool.java Log Message: Surface extrude null pointer fixed... altered the erasertool to only delete lines and clippingplanes Index: EraserTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/EraserTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EraserTool.java 13 Nov 2006 14:54:45 -0000 1.5 --- EraserTool.java 26 Feb 2007 15:06:36 -0000 1.6 *************** *** 13,18 **** --- 13,21 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.ClippingPlane; + import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 45,49 **** protected void pressed(MouseEvent e) { findTarget(e); ! if (target instanceof Geometric) { ((Geometric) target).delete(); Project.getInstance().changed(target); --- 48,52 ---- protected void pressed(MouseEvent e) { findTarget(e); ! if (target instanceof Edge || target instanceof ClippingPlane || target instanceof Vertex) { ((Geometric) target).delete(); Project.getInstance().changed(target); |
|
From: rimestad <rim...@us...> - 2007-02-26 15:06:44
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16464/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Surface extrude null pointer fixed... altered the erasertool to only delete lines and clippingplanes Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** Surface.java 19 Feb 2007 11:45:06 -0000 1.138 --- Surface.java 26 Feb 2007 15:06:33 -0000 1.139 *************** *** 1105,1115 **** hole.setBackDomain(holeFront); } ! // If there are no front space assignments, make one ! if (hole.getFrontDomain() == getOwner().getEmpty()) { ! hole.setFrontDomain(front); ! } ! // If there are no back space assignments, make one ! if (hole.getBackDomain() == getOwner().getEmpty()) { ! hole.setBackDomain(back); } } --- 1105,1117 ---- hole.setBackDomain(holeFront); } ! if (getOwner() != null) { ! // If there are no front space assignments, make one ! if (hole.getFrontDomain() == getOwner().getEmpty()) { ! hole.setFrontDomain(front); ! } ! // If there are no back space assignments, make one ! if (hole.getBackDomain() == getOwner().getEmpty()) { ! hole.setBackDomain(back); ! } } } |
|
From: Michael L. <he...@us...> - 2007-02-23 11:09:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24330/src/net/sourceforge/bprocessor/gl/tool Modified Files: FocusTool.java ToolFactory.java Log Message: Style-errors Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** ToolFactory.java 22 Feb 2007 12:36:57 -0000 1.76 --- ToolFactory.java 23 Feb 2007 11:09:18 -0000 1.77 *************** *** 13,17 **** import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; - import net.sourceforge.bprocessor.model.Surface; import java.net.URL; --- 13,16 ---- Index: FocusTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FocusTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FocusTool.java 22 Feb 2007 12:36:57 -0000 1.1 --- FocusTool.java 23 Feb 2007 11:09:18 -0000 1.2 *************** *** 13,19 **** import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.ClippingPlane; - import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; --- 13,17 ---- *************** *** 25,30 **** /** ! * @param glv ! * @param cursor */ public FocusTool(GLView glv, Cursor cursor) { --- 23,28 ---- /** ! * @param glv GLView ! * @param cursor Cursor */ public FocusTool(GLView glv, Cursor cursor) { |
|
From: rimestad <rim...@us...> - 2007-02-22 12:37:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18862/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: FocusTool.java Log Message: Added a focus on tool that works as a tool --- NEW FILE: FocusTool.java --- //--------------------------------------------------------------------------------- // $Id: FocusTool.java,v 1.1 2007/02/22 12:36:57 rimestad 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 java.awt.Cursor; import java.awt.event.MouseEvent; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; /** * @author Rimestad * */ public class FocusTool extends AbstractTool { /** * @param glv * @param cursor */ public FocusTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * {@inheritDoc} */ protected void moved(MouseEvent e) { findTarget(e); if (target instanceof Surface || target instanceof ClippingPlane) { glv.getView().makeTarget(target); } else { target = null; } } /** * {@inheritDoc} */ protected void pressed(MouseEvent e) { // do nothing } /** * {@inheritDoc} */ protected void dragged(MouseEvent e) { // do nothing } /** * {@inheritDoc} */ protected void released(MouseEvent e) { if (target != null) { if (target instanceof Surface) { Camera.focusOn(Project.getInstance().getCurrentCamera(), (Surface)target); } else { Camera.focusOn(Project.getInstance().getCurrentCamera(), (ClippingPlane)target); } this.glv.repaint(); } } } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** ToolFactory.java 8 Feb 2007 12:23:13 -0000 1.75 --- ToolFactory.java 22 Feb 2007 12:36:57 -0000 1.76 *************** *** 156,159 **** --- 156,162 ---- private RelationTool relation; + /** The tool for focusing on objects */ + private FocusTool focusTool; + /** * Constructor *************** *** 207,210 **** --- 210,214 ---- offset = new OffsetTool(glv, pencilcursor); altRect = new RectTool(glv, pencilcursor); + focusTool = new FocusTool(glv, null); Toolbar tb = Toolbar.getInstance(); *************** *** 256,271 **** Toolbar.getInstance().registerPushButtonAction(zoomAction, "Zoom All"); ! Action focusAction = new ToolAction(glv, 0, "Biconzomeselect.gif") { ! public void actionPerformed(ActionEvent agr0) { ! if (Selection.primary().size() == 1) { ! Object o = Selection.primary().iterator().next(); ! if (o instanceof Surface) { ! Camera.focusOn(Project.getInstance().getCurrentCamera(), (Surface)o); ! this.glv.repaint(); ! } ! } ! } ! }; ! Toolbar.getInstance().registerPushButtonAction(focusAction, "Focus on surface"); tb.addSeparator(10); --- 260,264 ---- Toolbar.getInstance().registerPushButtonAction(zoomAction, "Zoom All"); ! this.registerTool(Tool.FOCUS_TOOL, focusTool, "Biconzomeselect.gif", "Focus on surface"); tb.addSeparator(10); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Tool.java 6 Feb 2007 17:30:17 -0000 1.28 --- Tool.java 22 Feb 2007 12:36:57 -0000 1.29 *************** *** 62,65 **** --- 62,67 ---- /** the tool for creating relation between elements */ public static final int RELATION_TOOL = 20; + /** the tool for focusing on objects */ + public static final int FOCUS_TOOL = 21; /** |
|
From: rimestad <rim...@us...> - 2007-02-22 12:37:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18849/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Added a focus on tool that works as a tool Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Camera.java 15 Feb 2007 14:57:41 -0000 1.37 --- Camera.java 22 Feb 2007 12:36:54 -0000 1.38 *************** *** 657,660 **** --- 657,683 ---- * Static modification of the camera to focus on a given surface * @param currentCamera The camera to change + * @param cp The clippingplane to focus on + */ + public static void focusOn(Camera currentCamera, ClippingPlane cp) { + List<Edge> edges = new ArrayList<Edge>(4); + Vertex first = null, prev = null, cur = null;; + for (Vertex v : (Collection<Vertex>)cp.getCorners()) { + cur = v; + if (first == null) { + first = cur; + } else { + edges.add(new Edge(prev, cur)); + } + prev = cur; + } + edges.add(new Edge(cur, first)); + Surface s = new Surface(edges); + + focusOn(currentCamera, s); + } + + /** + * Static modification of the camera to focus on a given surface + * @param currentCamera The camera to change * @param s The surface to focus on */ |
|
From: Michael L. <he...@us...> - 2007-02-21 14:57:37
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20569/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed IGNORE flag Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** View.java 20 Feb 2007 15:16:38 -0000 1.188 --- View.java 21 Feb 2007 14:57:24 -0000 1.189 *************** *** 95,101 **** public static final int SUPPORT = 4; - /** IGNORE */ - public static final boolean IGNORE = true; - /** the color of the x axis */ public static final float[] X_AXIS_COLOR = new float[] {0.1f, 0.8f, 0.1f}; --- 95,98 ---- *************** *** 1489,1515 **** while (iter.hasNext()) { Edge current = (Edge)iter.next(); ! if (IGNORE || !(highligts.contains(current) || current == target)) { ! float[] color = (float[])colorMap.get(current); ! if (color != null) { ! gl.glColor3fv(color, 0); ! if (current.getStrippled()) { ! drawConstructor(current); ! } else { ! drawEdge(current); ! } ! gl.glColor3fv(lineColor, 0); ! } else if (current.getStrippled()) { ! gl.glColor3fv(constructorColor, 0); drawConstructor(current); - gl.glColor3fv(lineColor, 0); } else { - if (dodge) { - gl.glColor3fv(GREY_LINE_COLOR, 0); - } drawEdge(current); } if (dodge) { ! gl.glColor3fv(lineColor, 0); } } } --- 1486,1510 ---- while (iter.hasNext()) { Edge current = (Edge)iter.next(); ! float[] color = (float[])colorMap.get(current); ! if (color != null) { ! gl.glColor3fv(color, 0); ! if (current.getStrippled()) { drawConstructor(current); } else { drawEdge(current); } + gl.glColor3fv(lineColor, 0); + } else if (current.getStrippled()) { + gl.glColor3fv(constructorColor, 0); + drawConstructor(current); + gl.glColor3fv(lineColor, 0); + } else { if (dodge) { ! gl.glColor3fv(GREY_LINE_COLOR, 0); } + drawEdge(current); + } + if (dodge) { + gl.glColor3fv(lineColor, 0); } } |
|
From: Nordholt <nor...@us...> - 2007-02-20 15:16:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21982/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: hit detection also returns globjects Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** View.java 15 Feb 2007 15:12:13 -0000 1.187 --- View.java 20 Feb 2007 15:16:38 -0000 1.188 *************** *** 2544,2547 **** --- 2544,2556 ---- } } + + if (glo != null && object == null && + nearestGLO < nearestVertex && + nearestGLO < nearestEdge && + nearestGLO < nearestSurface) { + surface = null; + edge = null; + vertex = null; + } if (intersections) { Transformation transformation = this.transformation(); *************** *** 2652,2655 **** --- 2661,2666 ---- } else if (surface != null) { return surface; + } else if (glo != null) { + return glo; } } *************** *** 3265,3271 **** return glObjects3D.remove(glo); } /** ! * Add a whole list of GLObject * @param glObjects The glObjects to add. */ --- 3276,3290 ---- return glObjects3D.remove(glo); } + + /** + * remove a whole set of GLObject + * @param glObjects The glObjects to remove. + */ + public void removeGlObjects3D(Set glObjects) { + this.glObjects3D.removeAll(glObjects); + } /** ! * Add a whole set of GLObject * @param glObjects The glObjects to add. */ |
|
From: Nordholt <nor...@us...> - 2007-02-20 15:16:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21915/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: selecttool can select 3d cameras Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SelectStrategy.java 29 Jan 2007 11:56:59 -0000 1.7 --- SelectStrategy.java 20 Feb 2007 15:16:10 -0000 1.8 *************** *** 13,17 **** --- 13,20 ---- import java.util.List; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.GlCamera; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; *************** *** 19,22 **** --- 22,26 ---- import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Space; *************** *** 28,31 **** --- 32,38 ---- */ public class SelectStrategy implements Strategy { + /** The logger */ + private static Logger log = Logger.getLogger(SelectStrategy.class); + /** The GLView **/ private GLView glv; *************** *** 120,125 **** ClippingPlane cp = (ClippingPlane)target; cp.setActive(!cp.isActive()); } ! } else { if (target == null) { selection.clear(); --- 127,135 ---- ClippingPlane cp = (ClippingPlane)target; cp.setActive(!cp.isActive()); + } else if (target instanceof GlCamera) { + GlCamera glcam = (GlCamera)target; + Project.getInstance().setCurrentCamera(glcam.getCamera()); } ! } else { if (target == null) { selection.clear(); *************** *** 131,134 **** --- 141,147 ---- selection.remove(target); } + } else if (target instanceof GlCamera) { + GlCamera glcam = (GlCamera)target; + Project.getInstance().setCurrentCamera(glcam.getCamera()); } else { if (!selection.contains(target)) { |
|
From: Nordholt <nor...@us...> - 2007-02-20 15:14:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21045/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: pressing s will show 3d cameras Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** AbstractTool.java 13 Feb 2007 15:05:47 -0000 1.113 --- AbstractTool.java 20 Feb 2007 15:14:10 -0000 1.114 *************** *** 16,19 **** --- 16,20 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.gl.model.GlCamera; import net.sourceforge.bprocessor.gl.model.Widget; import net.sourceforge.bprocessor.gl.view.View; *************** *** 30,33 **** --- 31,35 ---- import java.net.URL; + import java.util.HashSet; import java.util.Iterator; import java.util.Set; *************** *** 128,131 **** --- 130,136 ---- protected Cursor metaCursor = null; + /** The gl Cameras */ + private Set<GlCamera> glCams = new HashSet<GlCamera> (); + /** * KeyListener for the GL Canvas *************** *** 270,274 **** } else { key(e); ! } glv.repaint(true); } --- 275,289 ---- } else { key(e); ! } ! if (e.getKeyCode() == KeyEvent.VK_S) { ! Collection cams = Project.getInstance().getCameras(); ! Iterator it = cams.iterator(); ! glv.getView().removeGlObjects3D(glCams); ! glCams.clear(); ! while (it.hasNext()) { ! glCams.add(new GlCamera((Camera)it.next())); ! } ! glv.getView().addGlObjects3D(glCams); ! } glv.repaint(true); } *************** *** 291,294 **** --- 306,314 ---- glv.setCursor(cursor); } + if (e.getKeyCode() == KeyEvent.VK_S) { + glv.getView().removeGlObjects3D(glCams); + glCams.clear(); + } + } |
|
From: Nordholt <nor...@us...> - 2007-02-20 15:13:08
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20304/src/net/sourceforge/bprocessor/gl/model Added Files: GlCamera.java Log Message: A 3d representation of cameras --- NEW FILE: GlCamera.java --- //--------------------------------------------------------------------------------- // $Id: GlCamera.java,v 1.1 2007/02/20 15:13:00 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.model; import javax.media.opengl.GL; import org.apache.log4j.Logger; import com.sun.opengl.util.GLUT; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; /** * Af 3d representation of a camera */ public class GlCamera implements GlObject { /** The logger */ private static Logger log = Logger.getLogger(GlCamera.class); /** The camera to represent in 3d */ private Camera cam; /** Constructor setting the camera * @param c the camera to present in 3d */ public GlCamera(Camera c) { cam = c; } /** * {@inheritDoc} */ public void draw(GL gl) { Vertex position = new Vertex(cam.getCamera()); Vertex lookAt = position.minus(new Vertex(cam.getCenter())); lookAt.normalize(); GLUT glut = new GLUT(); //Drawing the camera box gl.glPushMatrix(); gl.glEnable(GL.GL_LIGHTING); gl.glColor3d(0.1, 0.1, 0.1); gl.glTranslated(position.getX(), position.getY(), position.getZ()); gl.glRotated(Math.toDegrees(Geometry.degreesAboutZ(lookAt)), 0.0, 0.0, 1.0); gl.glRotated(-Math.toDegrees(Geometry.degreesAboutY(lookAt)), 0.0, 1.0, 0.0); gl.glScaled(0.5, 0.25, 0.25); glut.glutSolidCube(2.0f); gl.glPopMatrix(); //Drawing the camera lense (the cone) gl.glPushMatrix(); gl.glTranslated(position.getX(), position.getY(), position.getZ()); gl.glRotated(Math.toDegrees(Geometry.degreesAboutZ(lookAt)), 0.0, 0.0, 1.0); gl.glRotated(-Math.toDegrees(Geometry.degreesAboutY(lookAt)), 0.0, 1.0, 0.0); gl.glTranslated(-1.5 / 2, 0, 0); gl.glRotated(90, 0.0, 1.0, 0.0); glut.glutSolidCone(0.25, 1.5 / 2, 32, 32); gl.glPopMatrix(); gl.glDisable(GL.GL_LIGHTING); } /** * {@inheritDoc} */ public Plane getPlane() { Vertex roll = new Vertex(cam.getRoll()); Vertex position = new Vertex(cam.getCamera()); Vertex lookAt = position.minus(new Vertex(cam.getCenter())); Vertex cross = lookAt.cross(roll); Plane p = new Plane(cross.getX(), cross.getY(), cross.getX(), position); return p; } /** * {@inheritDoc} */ public Vertex intersection(Edge e) { Plane p = getPlane(); return p.intersection(e); } /** * get the ca model camera of this gl camera * @return the camera */ public Camera getCamera() { return cam; } } |
|
From: Nordholt <nor...@us...> - 2007-02-20 15:12:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20005/src/net/sourceforge/bprocessor/gl/model Modified Files: GlObject.java Log Message: grama in doc Index: GlObject.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/GlObject.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GlObject.java 14 Feb 2007 14:27:24 -0000 1.4 --- GlObject.java 20 Feb 2007 15:12:04 -0000 1.5 *************** *** 14,18 **** /** ! * A object for making more interesting graphics for tools and the like * Can make any gl operations, and are called during every drawing in the view */ --- 14,18 ---- /** ! * An object for making more interesting graphics for tools and the like * Can make any gl operations, and are called during every drawing in the view */ |
|
From: rimestad <rim...@us...> - 2007-02-19 15:50:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22671/src/net/sourceforge/bprocessor/model Modified Files: ClippingPlane.java Log Message: improved the interaction in the controlled move tool Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ClippingPlane.java 31 Jan 2007 21:27:30 -0000 1.17 --- ClippingPlane.java 19 Feb 2007 15:50:14 -0000 1.18 *************** *** 103,106 **** --- 103,114 ---- /** + * gets the normal of the clippingplane + * @return the normal + */ + public Vertex getNormal() { + return cs.getN().copy(); + } + + /** * Update this clipping from the defining coordinatesystem attribute */ *************** *** 319,323 **** /** {@inheritDoc} */ public Vertex canMove(double x, double y, double z, Collection entities) { ! return new Vertex(x, y, z).projectOnto(plane.normal()); } --- 327,331 ---- /** {@inheritDoc} */ public Vertex canMove(double x, double y, double z, Collection entities) { ! return (new Vertex(x, y, z).projectOnto(getPlane().normal())); } |
|
From: rimestad <rim...@us...> - 2007-02-19 15:50:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22780/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledMoveTool.java Log Message: improved the interaction in the controlled move tool Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ControlledMoveTool.java 2 Jan 2007 17:47:08 -0000 1.7 --- ControlledMoveTool.java 19 Feb 2007 15:50:21 -0000 1.8 *************** *** 19,24 **** --- 19,28 ---- 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.ClippingPlane; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; *************** *** 34,37 **** --- 38,42 ---- /** Direction */ private Vertex direction; + /** the logger */ private static Logger log = Logger.getLogger(ControlledMoveTool.class); *************** *** 63,66 **** --- 68,77 ---- } else if (geo instanceof Vertex) { map = createSlideMap((Vertex)geo); + } else if (geo instanceof ClippingPlane) { + ClippingPlane cp = (ClippingPlane) geo; + map = new HashMap(); + map.put(cp.center(), cp.getNormal()); + } else { + log.warn(geo.getClass().getName() + " is not able to be moved controlled"); } if (map != null) { *************** *** 196,199 **** --- 207,229 ---- found = direction != null; } + if (!found) { + return false; + } else { + // Make the intersection mechanism in abstractpencil lock to the workingplane + double startx = e.getX(); + double starty = e.getY(); + View view = glv.getView(); + Transformation trans = view.transformation(); + double x = startx; + double y = View.getHeight() - starty; + Vertex near = new Vertex(x, y, 0.0); + Vertex far = new Vertex(x, y, 1.0); + Edge ray = new Edge(near, far); + ray = trans.unProject(ray); + Vertex center = start.vertex(); + Plane plane = new Plane(direction.getX(), direction.getY(), direction.getZ(), center); + lockingPlane = plane.orthogonalPlane(ray); + lock = true; + } } } *************** *** 224,227 **** --- 254,261 ---- } else if (geo instanceof Vertex) { return (Vertex)slideMap.get(geo); + } else if (geo instanceof ClippingPlane) { + return ((ClippingPlane)geo).getNormal(); + } else { + log.info("A nonsupported object in direction method in ControlledMoveTool"); } return null; |
|
From: rimestad <rim...@us...> - 2007-02-19 15:47:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21593/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: Removed commented code and log info Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** ExtrusionTool.java 19 Feb 2007 14:59:28 -0000 1.48 --- ExtrusionTool.java 19 Feb 2007 15:47:43 -0000 1.49 *************** *** 186,211 **** Set ignore = new HashSet(2); ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ignore.add(extrudesurface.getExterior()); } findTarget(e, ignore); - /*if (metaPressed) { - // extrude onto the plane generated by surfaces - if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { - Surface sur = (Surface) target; - if (normal.dot(sur.normal()) == 0) { - // the normals are orthogonal so we cant extrude one to the other - // therefore we just extrude as useual - calcDistCallExtrude(to, from, normal); - } else { - ontoPlane = sur.plane(); - extrudeOnto(ontoPlane, all, false); - } - } else { - calcDistCallExtrude(to, from, normal); - } - } else */ { - // extrude the normal way if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface surface = (Surface) target; --- 186,194 ---- Set ignore = new HashSet(2); ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ignore.add(extrudesurface.getExterior()); } findTarget(e, ignore); { if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface surface = (Surface) target; *************** *** 222,226 **** } else { ontoPlane = surface.plane(); - log.info(Math.abs(ontoPlane.normal().dot(normal))); if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { // the two normals have a greater angle between 0 and 84 or 94 and 180 degrees --- 205,208 ---- |
|
From: Michael L. <he...@us...> - 2007-02-19 14:59:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv882/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: Fixed a few style errors Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ExtrusionTool.java 19 Feb 2007 12:17:59 -0000 1.47 --- ExtrusionTool.java 19 Feb 2007 14:59:28 -0000 1.48 *************** *** 187,191 **** ignore.add(extrudesurface); if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); } findTarget(e, ignore); --- 187,191 ---- ignore.add(extrudesurface); if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); } findTarget(e, ignore); *************** *** 205,209 **** calcDistCallExtrude(to, from, normal); } ! } else */{ // extrude the normal way if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { --- 205,210 ---- calcDistCallExtrude(to, from, normal); } ! } else */ ! { // extrude the normal way if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { |
|
From: rimestad <rim...@us...> - 2007-02-19 12:18:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28555/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: Made some major fixes to the code and GUI feedback... seems to work quite ok on lines, surfaces (unless they are almost orthogonal to the extruded surface) and on the dragplane otherwise, and the extrude surface and its exterior are the only geometry that are not included in hitdetection Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** ExtrusionTool.java 14 Feb 2007 13:50:21 -0000 1.46 --- ExtrusionTool.java 19 Feb 2007 12:17:59 -0000 1.47 *************** *** 183,194 **** elements.add(extrudesurface); } ! findTarget(e); ! if (metaPressed) { // extrude onto the plane generated by surfaces if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface sur = (Surface) target; if (normal.dot(sur.normal()) == 0) { ! /* the normals are orthogonal so we cant extrude one to the other ! therefore we just extrude as useual */ calcDistCallExtrude(to, from, normal); } else { --- 183,200 ---- elements.add(extrudesurface); } ! //ignore self when extruding ! Set ignore = new HashSet(2); ! ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); ! } ! findTarget(e, ignore); ! /*if (metaPressed) { // extrude onto the plane generated by surfaces if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface sur = (Surface) target; if (normal.dot(sur.normal()) == 0) { ! // the normals are orthogonal so we cant extrude one to the other ! // therefore we just extrude as useual calcDistCallExtrude(to, from, normal); } else { *************** *** 199,205 **** calcDistCallExtrude(to, from, normal); } ! } else { // extrude the normal way ! if (target instanceof Surface) { Surface surface = (Surface) target; if (!elements.contains(surface)) { --- 205,211 ---- calcDistCallExtrude(to, from, normal); } ! } else */{ // extrude the normal way ! if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface surface = (Surface) target; if (!elements.contains(surface)) { *************** *** 207,214 **** --- 213,231 ---- Vertex cross = normal.cross(n); if (cross.isZero()) { + // the surfaces are coplanar Vertex v = surface.getFirstVertex(); if (!extrudesurface.plane().contains(v)) { to = v; } + calcDistCallExtrude(to, from, normal); + } else { + ontoPlane = surface.plane(); + log.info(Math.abs(ontoPlane.normal().dot(normal))); + if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { + // the two normals have a greater angle between 0 and 84 or 94 and 180 degrees + calcDistCallExtrude(to, from, normal); + } else { + extrudeOnto(ontoPlane, all, false); + } } } *************** *** 222,227 **** } } } - calcDistCallExtrude(to, from, normal); } } --- 239,246 ---- } } + calcDistCallExtrude(to, from, normal); + } else { + calcDistCallExtrude(to, from, normal); } } } *************** *** 266,275 **** } else { if (extrusion != null) { ! if (metaPressed) { ! if (ontoPlane != null) { ! extrudeOnto(ontoPlane, all, true); ! } else { ! extrude(distance, all, true); ! } } else { extrude(distance, all, true); --- 285,290 ---- } else { if (extrusion != null) { ! if (ontoPlane != null) { ! extrudeOnto(ontoPlane, all, true); } else { extrude(distance, all, true); |
|
From: rimestad <rim...@us...> - 2007-02-19 11:45:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14984/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: changed addHole space assignments to work again Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** Surface.java 16 Feb 2007 09:50:21 -0000 1.137 --- Surface.java 19 Feb 2007 11:45:06 -0000 1.138 *************** *** 672,676 **** top.setFrontDomain(getFrontDomain()); } ! return top; } --- 672,676 ---- top.setFrontDomain(getFrontDomain()); } ! return top; } *************** *** 1105,1112 **** hole.setBackDomain(holeFront); } ! if (hole.getFrontDomain() == null) { hole.setFrontDomain(front); } ! if (hole.getBackDomain() == null) { hole.setBackDomain(back); } --- 1105,1114 ---- hole.setBackDomain(holeFront); } ! // If there are no front space assignments, make one ! if (hole.getFrontDomain() == getOwner().getEmpty()) { hole.setFrontDomain(front); } ! // If there are no back space assignments, make one ! if (hole.getBackDomain() == getOwner().getEmpty()) { hole.setBackDomain(back); } *************** *** 1921,1926 **** inside = exterior.getOwner() == getOwner(); } ! ! int delta = 1; for (int i = 0; i < n; i++) { if (delta < 0) { --- 1923,1928 ---- inside = exterior.getOwner() == getOwner(); } ! // positive for angles less then 90 degrees and negative otherwise ! double delta = normal.dot(sidemap[0].getDirection()); for (int i = 0; i < n; i++) { if (delta < 0) { |