Merge pull request #3781 from JakubValtar/bugfix-pshape-p3d

Fix PShape creation in P3D
This commit is contained in:
Ben Fry
2015-09-09 18:33:16 -04:00
+2 -2
View File
@@ -1784,7 +1784,7 @@ public class PGraphics extends PImage implements PConstants {
if (kind == POINT) {
if (is3D() && len != 2 && len != 3) {
throw new IllegalArgumentException("Use createShape(POINT, x, y) or createShape(POINT, x, y, z)");
} else if (len != 2) {
} else if (is2D() && len != 2) {
throw new IllegalArgumentException("Use createShape(POINT, x, y)");
}
return createShapePrimitive(kind, p);
@@ -1792,7 +1792,7 @@ public class PGraphics extends PImage implements PConstants {
} else if (kind == LINE) {
if (is3D() && len != 4 && len != 6) {
throw new IllegalArgumentException("Use createShape(LINE, x1, y1, x2, y2) or createShape(LINE, x1, y1, z1, x2, y2, z1)");
} else if (len != 4) {
} else if (is2D() && len != 4) {
throw new IllegalArgumentException("Use createShape(LINE, x1, y1, x2, y2)");
}
return createShapePrimitive(kind, p);