From 26669e9ad5a0698750f97534ff1e5bff4e16ac24 Mon Sep 17 00:00:00 2001 From: Dennis Schoepf Date: Mon, 21 Sep 2020 16:56:36 +0200 Subject: [PATCH] Add bug function --- .../magic_veneer_processing.pde | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/magic_veneer_processing/magic_veneer_processing.pde b/magic_veneer_processing/magic_veneer_processing.pde index 7d82c7a..ef8b09b 100644 --- a/magic_veneer_processing/magic_veneer_processing.pde +++ b/magic_veneer_processing/magic_veneer_processing.pde @@ -41,6 +41,8 @@ void draw() { placementIndicatorOffsetX = 0; } /* END - Create and animate placementIndicator */ + bug(100, 100, 2); + /* if ( arduinoPort.available() > 0) { String rec = arduinoPort.readStringUntil('\n'); @@ -55,6 +57,26 @@ void draw() { }*/ } +void bug(float x, float y, float scale) { + ArrayList legs = new ArrayList(); + + polygon(x, y, 40 * scale, 6); + + PShape leftUpperLeg = createShape(TRIANGLE, x - 40 * scale, y - 40 * scale, x * scale - 20, y, x - 20 * scale, y); + legs.add(leftUpperLeg); + PShape leftLowerLeg = createShape(TRIANGLE, x - 40 * scale, y + 40 * scale, x * scale - 20, y, x - 20 * scale, y); + legs.add(leftLowerLeg); + PShape rightUpperLeg = createShape(TRIANGLE, x + 40 * scale, y - 40 * scale, x * scale + 20, y, x + 20 * scale, y); + legs.add(rightUpperLeg); + PShape rightLowerLeg = createShape(TRIANGLE, x + 40 * scale, y + 40 * scale, x * scale + 20, y, x + 20 * scale, y); + legs.add(rightLowerLeg); + + for (int i = 0; i < legs.size(); i++) { + legs.get(i).setFill(color(255)); + shape(legs.get(i)); + } +} + void placementIndicator(float polygonRadius, int npoints, float offsetX) { float centerX = width / 2; float centerY = height / 2;