]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/geometry/ReducerGeometryProvider.java
Force zero offset for concentric reducers
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / geometry / ReducerGeometryProvider.java
index 5ca0330dd34d0c38e12c248af81e7902d4d1605b..c793fd26f6b65fa9e3fb1738a84e4224192a22e4 100644 (file)
@@ -30,9 +30,8 @@ public class ReducerGeometryProvider extends BuiltinMeshProvider  {
        
 //     @Override
        public Collection<TopoDS_Shape> getModel() throws Exception {
-//             GP_Circ circ = new GP_Circ(new double[]{-length*0.5, 0.0, 0.0,1.0,0.0,0.0}, radius);
-//             GP_Circ circ2 = new GP_Circ(new double[]{length*0.5, 0.0, 0.0,1.0,0.0,0.0}, radius2);
-//             System.out.println("Reducer " + length  + " " + radius + " " + radius2);
+               if (radius < MathTools.NEAR_ZERO || radius2 < MathTools.NEAR_ZERO)
+                       return Collections.emptyList();
                double length = Math.max(0.1, Math.abs(radius-radius2)*4.0);
                TopoDS_Shape shape;
                if (Math.abs(radius-radius2) < MathTools.NEAR_ZERO) {
@@ -46,7 +45,7 @@ public class ReducerGeometryProvider extends BuiltinMeshProvider  {
        @Override
        public Mesh getMesh() {
                double length = Math.max(0.1, Math.abs(radius-radius2)*4.0);
-               if (length < .0001)
+               if (length < .0001 || radius < MathTools.NEAR_ZERO || radius2 < MathTools.NEAR_ZERO)
                        return null;
                Tube tube = new Tube();
                tube.setResolution(16);
@@ -79,6 +78,8 @@ public class ReducerGeometryProvider extends BuiltinMeshProvider  {
                
                if (props.containsKey("offset")) {
                        offset = (Double)props.get("offset");
+               } else {
+                   offset = 0.0;
                }