Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24385/src/net/sourceforge/bprocessor/model
Modified Files:
Space.java Relation.java CoordinateSystem.java
Log Message:
Implemented update of relations
Index: Space.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v
retrieving revision 1.122
retrieving revision 1.123
diff -C2 -d -r1.122 -r1.123
*** Space.java 6 Feb 2007 16:17:23 -0000 1.122
--- Space.java 7 Mar 2007 09:47:13 -0000 1.123
***************
*** 2676,2679 ****
--- 2676,2703 ----
}
+ /**
+ *
+ * @param vertices Collection of vertices
+ * @return Map of edges going into the collection
+ */
+ public Map<Vertex, Collection<Edge>>
+ edgeMap(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 = 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;
+ }
}
Index: CoordinateSystem.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** CoordinateSystem.java 7 Mar 2007 07:38:41 -0000 1.38
--- CoordinateSystem.java 7 Mar 2007 09:47:13 -0000 1.39
***************
*** 13,16 ****
--- 13,17 ----
import java.util.LinkedList;
import java.util.List;
+ import java.util.Map;
/**
***************
*** 259,263 ****
double b = n.getY();
double c = n.getZ();
! d = -(a * getOrigin().getX() + b * getOrigin().getY() + c * getOrigin().getZ());
return new Plane(a, b, c, d);
}
--- 260,284 ----
double b = n.getY();
double c = n.getZ();
! double x0 = origin.x;
! double y0 = origin.y;
! double z0 = origin.z;
! d = -(a * x0 + b * y0 + c * z0);
! return new Plane(a, b, c, d);
! }
!
! /**
! *
! * @param offset offset
! * @return Plane
! */
! public Plane plane(double offset) {
! double d = 0;
! double a = n.getX();
! double b = n.getY();
! double c = n.getZ();
! double x0 = origin.x + a * offset;
! double y0 = origin.y + b * offset;
! double z0 = origin.z + c * offset;
! d = -(a * x0 + b * y0 + c * z0);
return new Plane(a, b, c, d);
}
***************
*** 688,692 ****
for (Relation relation : relations) {
double distance = relation.evaluate();
! System.out.println("offset : " + distance);
}
}
--- 709,728 ----
for (Relation relation : relations) {
double distance = relation.evaluate();
! Geometric geometric = relation.geometric();
! Space space = geometric.getOwner();
! Collection<Vertex> vertices = geometric.collect();
! Map<Vertex, Collection<Edge>> map = space.edgeMap(vertices);
! for (Vertex vertex : vertices) {
! Vertex vector = getN();
! Collection<Edge> binding = map.get(vertex);
! if (!binding.isEmpty()) {
! Edge bind = binding.iterator().next();
! vector = bind.getDirection();
! vector.normalize();
! }
! Plane plane = plane(distance);
! Vertex project = plane.intersection(vertex, vector, true);
! vertex.set(project);
! }
}
}
Index: Relation.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Relation.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Relation.java 7 Mar 2007 07:38:41 -0000 1.4
--- Relation.java 7 Mar 2007 09:47:13 -0000 1.5
***************
*** 54,57 ****
--- 54,65 ----
/**
+ *
+ * @return geometric
+ */
+ public Geometric geometric() {
+ return geometric;
+ }
+
+ /**
* @return offset
*/
|