import org.jcae.opencascade.jni.TopoDS_Shape;
import org.jcae.opencascade.jni.TopoDS_Wire;
import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
import org.simantics.opencascade.OccTriangulator;
public class HorizontalTankGeometryProvider extends BuiltinGeometryProvider {
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
-
- double p0[] = new double[]{-length*0.50, 0.0,0.0};
- double p1[] = new double[]{-length*0.488, radius*0.6,0.0};
- double p2[] = new double[]{-length*0.46, radius,0.0};
- double p3[] = new double[]{ length*0.46, radius,0.0};
- double p4[] = new double[]{ length*0.488, radius*0.6,0.0};
- double p5[] = new double[]{ length*0.50, 0.0,0.0};
+ if (radius < MathTools.NEAR_ZERO || length < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
+ double p0[] = new double[]{ length*0.50, 0.0,0.0};
+ double p1[] = new double[]{ length*0.488, radius*0.6,0.0};
+ double p2[] = new double[]{ length*0.46, radius,0.0};
+ double p3[] = new double[]{-length*0.46, radius,0.0};
+ double p4[] = new double[]{-length*0.488, radius*0.6,0.0};
+ double p5[] = new double[]{-length*0.50, 0.0,0.0};
GC_MakeArcOfCircle m1 = new GC_MakeArcOfCircle(p0,p1,p2);
GC_MakeSegment s1 = new GC_MakeSegment(p2,p3);
TopoDS_Shape shape2 = OccTriangulator.makeTranslation(shape, 0.0, radius, 0.0);
shape.delete();
- shape = shape2;
TopoDS_Shape box = OccTriangulator.makeBox(-length*0.4, 0.0, -radius*0.5, -length*0.3, radius, radius*0.5);
- shape2 = OccTriangulator.makeFuse(shape, box);
- shape.delete();
- box.delete();
- box = OccTriangulator.makeBox(length*0.3, 0.0, -radius*0.5, length*0.4, radius, radius*0.5);
shape = OccTriangulator.makeFuse(shape2, box);
shape2.delete();
box.delete();
+ box = OccTriangulator.makeBox(length*0.3, 0.0, -radius*0.5, length*0.4, radius, radius*0.5);
+ shape2 = OccTriangulator.makeFuse(shape, box);
+ shape.delete();
+ box.delete();
- return Collections.singletonList(shape);
+ return Collections.singletonList(shape2);
}
@Override