Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3115/src/net/sourceforge/bprocessor/model
Modified Files:
Line.java
Log Message:
added some testes for vertex (still need many) and made some changes to line canMove method (works ok but not perfect)
Index: Line.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Line.java 5 Sep 2006 11:01:37 -0000 1.22
--- Line.java 5 Sep 2006 13:52:46 -0000 1.23
***************
*** 402,414 ****
/** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */
public void move(double x, double y, double z) {
! Vertex move = new Vertex(x, y, z);
! if (constraint != null) {
! move = move.projectOnto(constraint.getDirection());
! if (!constraint.coincides(getOrigin().add(move))) {
! // If the movement is outside the constraint don't move the edge
! move = new Vertex(0, 0, 0);
! }
! }
! getOrigin().move(move.getX(), move.getY(), move.getZ());
}
--- 402,406 ----
/** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */
public void move(double x, double y, double z) {
! getOrigin().move(x, y, z);
}
***************
*** 416,420 ****
public Vertex canMove(double x, double y, double z, Collection entities) {
// TODO Think it through
! return new Vertex(x, y, z);
}
}
--- 408,426 ----
public Vertex canMove(double x, double y, double z, Collection entities) {
// TODO Think it through
! Vertex move = new Vertex(x, y, z);
! if (constraint != null) {
! move = move.projectOnto(constraint.getDirection());
! Vertex to = getOrigin().add(move);
! if (!constraint.coincides(to)) {
! Vertex where = to.minus(constraint.getFrom());
! Vertex where2 = to.minus(constraint.getTo());
! if (where.length() > where2.length()) {
! where = where2;
! }
! log.info("there were so long " + where);
! move = where.minus(move);
! }
! }
! return move;
}
}
|