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);
|