]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/geometry/CheckValveGeometryProvider.java
Allow adding adjustable length components in the middle of a pipe
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / geometry / CheckValveGeometryProvider.java
index 85f4c7aa01146a44781bc2c9b81560eb0bda88b1..c14ff4b477fe1511cf3f8abeea5e186ccb7c3028 100644 (file)
@@ -19,9 +19,11 @@ public class CheckValveGeometryProvider extends BuiltinGeometryProvider {
        
        @Override
        public Collection<TopoDS_Shape> getModel() throws Exception {
+               if (radius < MathTools.NEAR_ZERO)
+                       return Collections.emptyList();
                double l = radius*0.2;
-               TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {-radius, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, l);
-               TopoDS_Shape con = OccTriangulator.makeCone(new double[] {-radius, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius*0.1, radius,radius*2);
+               TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {radius-l, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, l);
+               TopoDS_Shape con = OccTriangulator.makeCone(new double[] {-radius, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, radius*0.1,radius*2);
                TopoDS_Shape shape = OccTriangulator.makeFuse(cyl, con);
                cyl.delete();
                con.delete();