X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fshape%2FTube.java;h=a3c9dd192f085d201a76c6c9536074bb0cb3e422;hb=HEAD;hp=0300f068b601711001d5413e1fee21dd05a00902;hpb=a8667c284ad9c713461f452543423188db712fe3;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/g3d/shape/Tube.java b/org.simantics.g3d/src/org/simantics/g3d/shape/Tube.java index 0300f068..a3c9dd19 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/shape/Tube.java +++ b/org.simantics.g3d/src/org/simantics/g3d/shape/Tube.java @@ -69,11 +69,13 @@ public class Tube { Vector3d t = new Vector3d(); - for (int i = 0; i < vertices.size() - 1; i++) { - t.set(vertices.get(i+1)); - t.sub(vertices.get(i)); - if (t.lengthSquared() < 0.000001) - throw new IllegalArgumentException("vertices at index " + i + " are too close to each other"); + if (tangents == null) { + for (int i = 0; i < vertices.size() - 1; i++) { + t.set(vertices.get(i+1)); + t.sub(vertices.get(i)); + if (t.lengthSquared() < 0.0000001) + throw new IllegalArgumentException("vertices at index " + i + " are too close to each other"); + } } int vcount = vertices.size()*resolution; @@ -194,9 +196,9 @@ public class Tube { int iv = c*resolution + s; /* - iv+1 ---- iv + resolution + 1 - | /| - |/ | + iv+1 ---- iv + resolution + 1 + | /| + |/ | iv ---- iv + resolution */ if (s < resolution - 1) {