Add bug function
This commit is contained in:
parent
9c576acf1d
commit
26669e9ad5
1 changed files with 22 additions and 0 deletions
|
|
@ -41,6 +41,8 @@ void draw() {
|
||||||
placementIndicatorOffsetX = 0;
|
placementIndicatorOffsetX = 0;
|
||||||
}
|
}
|
||||||
/* END - Create and animate placementIndicator */
|
/* END - Create and animate placementIndicator */
|
||||||
|
bug(100, 100, 2);
|
||||||
|
|
||||||
|
|
||||||
/* if ( arduinoPort.available() > 0) {
|
/* if ( arduinoPort.available() > 0) {
|
||||||
String rec = arduinoPort.readStringUntil('\n');
|
String rec = arduinoPort.readStringUntil('\n');
|
||||||
|
|
@ -55,6 +57,26 @@ void draw() {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bug(float x, float y, float scale) {
|
||||||
|
ArrayList<PShape> legs = new ArrayList<PShape>();
|
||||||
|
|
||||||
|
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) {
|
void placementIndicator(float polygonRadius, int npoints, float offsetX) {
|
||||||
float centerX = width / 2;
|
float centerX = width / 2;
|
||||||
float centerY = height / 2;
|
float centerY = height / 2;
|
||||||
|
|
|
||||||
Reference in a new issue