@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (radius < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {-radius*2, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, radius*4);
TopoDS_Shape sph = OccTriangulator.makeSphere(0, 0, 0, radius*1.5);
TopoDS_Shape shape = OccTriangulator.makeCompound(new TopoDS_Shape[]{cyl, sph});
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
-// TopoDS_Shape cyl = OccTriangulator.makeCylinder(new double[] {0.0, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, radius*0.25);
-// return Collections.singletonList(cyl);
+ if (radius < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
+
double length = radius * 0.5;
double p0[] = new double[]{ length, 0.0,0.0};
double p1[] = new double[]{length*0.8, radius*0.6,0.0};
@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-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);
// @Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (radius < MathTools.NEAR_ZERO || turnRadius < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
double t = Math.tan((Math.PI - turnAngle) * 0.5);
double R = 0.0;
if (t > MathTools.NEAR_ZERO)
// @Override
public Mesh getMesh() {
+ if (radius < MathTools.NEAR_ZERO || turnRadius < MathTools.NEAR_ZERO)
+ return null;
double t = Math.tan((Math.PI - turnAngle) * 0.5);
double R = 0.0;
if (t > MathTools.NEAR_ZERO)
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
-
+ if (radius < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
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);
TopoDS_Shape con2 = OccTriangulator.makeCone(new double[] {radius, 0.0, 0.0}, new double[] { -1.0, 0.0, 0.0 }, radius, radius*0.1,radius);
//TopoDS_Shape sph = OccTriangulator.makeSphere(0, 0, 0, radius*0.75);
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 {
-
+ 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};
import org.jcae.opencascade.jni.TopoDS_Shape;
import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
import org.simantics.opencascade.OccTriangulator;
public class NozzleGeometryProvider extends BuiltinGeometryProvider {
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (radius < MathTools.NEAR_ZERO || length < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
TopoDS_Shape shape = OccTriangulator.makeCylinder(new double[] {-length, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, length);
TopoDS_Shape shape2 = OccTriangulator.makeCylinder(new double[] {-length*0.25, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius*1.2, length*0.25);
TopoDS_Shape shape3 = OccTriangulator.makeCompound(new TopoDS_Shape[]{shape,shape2});
import org.jcae.opencascade.jni.TopoDS_Shape;
import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
import org.simantics.opencascade.OccTriangulator;
public class PumpGeometryProvider extends BuiltinGeometryProvider {
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (width < MathTools.NEAR_ZERO || length < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
double h = width * 0.5;
double h2 = width * 0.1;
double ld2 = length * 0.5;
// @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) {
@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);
@Override
public Mesh getMesh() {
- if (length < .001)
+ if (length < .001 || radius < MathTools.NEAR_ZERO )
return null;
Tube tube = new Tube();
tube.setResolution(16);
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;
public class VerticalTankGeometryProvider extends BuiltinGeometryProvider {
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (radius < MathTools.NEAR_ZERO || height < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
double p0[] = new double[]{ 0.0, height,0.0};
double p1[] = new double[]{radius*0.6,height*0.98,0.0};