Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3582/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
ExtrusionTool.java
Log Message:
small fixes to make the tool give better responce
Index: ExtrusionTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** ExtrusionTool.java 13 Feb 2007 15:05:47 -0000 1.45
--- ExtrusionTool.java 14 Feb 2007 13:50:21 -0000 1.46
***************
*** 162,165 ****
--- 162,166 ----
protected void moved(MouseEvent e) {
if (extrudesurface == null) {
+ //the extrusion isn't started yet
findTarget(e);
if (target instanceof Surface) {
***************
*** 168,176 ****
glv.getView().makeTarget(null);
}
- } else {
active = true;
to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane);
Vertex normal = extrudesurface.normal();
!
Set elements = new HashSet();
if (extrusion != null) {
--- 169,180 ----
glv.getView().makeTarget(null);
}
active = true;
+ } else {
+ // a extrudesurface have been chosen
to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane);
Vertex normal = extrudesurface.normal();
! //a bit cleanup
! ontoPlane = null;
! // the list of all extruded geometric objects
Set elements = new HashSet();
if (extrusion != null) {
***************
*** 185,192 ****
Surface sur = (Surface) target;
if (normal.dot(sur.normal()) == 0) {
! // the normals are orthogonal
! Vertex delta = to.minus(from);
! distance = normal.dot(delta);
! extrude(distance, all, false);
} else {
ontoPlane = sur.plane();
--- 189,195 ----
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();
***************
*** 194,200 ****
}
} else {
! Vertex delta = to.minus(from);
! distance = normal.dot(delta);
! extrude(distance, all, false);
}
} else {
--- 197,201 ----
}
} else {
! calcDistCallExtrude(to, from, normal);
}
} else {
***************
*** 222,228 ****
}
}
! Vertex delta = to.minus(from);
! distance = normal.dot(delta);
! extrude(distance, all, false);
}
}
--- 223,227 ----
}
}
! calcDistCallExtrude(to, from, normal);
}
}
***************
*** 231,234 ****
--- 230,244 ----
/**
+ * @param to
+ * @param from
+ * @param normal
+ */
+ private void calcDistCallExtrude(Vertex to, Vertex from, Vertex normal) {
+ Vertex delta = to.minus(from);
+ distance = normal.dot(delta);
+ extrude(distance, all, false);
+ }
+
+ /**
* Pressed
* @param e MouseEvent
***************
*** 257,261 ****
if (extrusion != null) {
if (metaPressed) {
! extrudeOnto(ontoPlane, all, true);
} else {
extrude(distance, all, true);
--- 267,275 ----
if (extrusion != null) {
if (metaPressed) {
! if (ontoPlane != null) {
! extrudeOnto(ontoPlane, all, true);
! } else {
! extrude(distance, all, true);
! }
} else {
extrude(distance, all, true);
|