From 116fbc975315dc88fd87dda4a941cfb57ea1f94f Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 13 Sep 2011 10:53:16 +0100 Subject: Improved drawCircle. --- Arduino/ButtonMatrix/ButtonMatrix.pde | 2 ++ PunchingBag/src/PunchingBag.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Arduino/ButtonMatrix/ButtonMatrix.pde b/Arduino/ButtonMatrix/ButtonMatrix.pde index 702e487..d3a0874 100755 --- a/Arduino/ButtonMatrix/ButtonMatrix.pde +++ b/Arduino/ButtonMatrix/ButtonMatrix.pde @@ -3,6 +3,7 @@ const byte ROWS = 19; const byte COLS = 8; +// Top // these constants describe the pins for the acellarometer . They won't change: const int agroundpin = A4; // analog input pin 4 -- ground const int apowerpin = A5; // analog input pin 5 -- voltage @@ -11,6 +12,7 @@ const int aypin = A2; // y-axis const int azpin = A1; // z-axis (only on 3-axis models) const int aselfTest = A0; +// Bottom // these constants describe the pins for the acellarometer . They won't change: const int bgroundpin = A12; // analog input pin 4 -- ground const int bpowerpin = A13; // analog input pin 5 -- voltage diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java index f27738f..271ef60 100644 --- a/PunchingBag/src/PunchingBag.java +++ b/PunchingBag/src/PunchingBag.java @@ -166,6 +166,7 @@ public class PunchingBag implements Runnable { double currentRadius = 0.5; public CircleExpand(int x, int y, int intensity) { + System.out.println("Circle Expand"); this.x = x + 0.5; this.y = y + 0.5; this.intensity = intensity; @@ -391,8 +392,8 @@ public class PunchingBag implements Runnable { int px; int py; for (double i = 0; i < 360; i++) { - px = (int) (x + Math.round(radius * Math.cos(i))); - py = (int) (y + Math.round(radius * Math.sin(i))); + px = (int) Math.round(x + (radius * Math.cos(i))); + py = (int) Math.round(y + (radius * Math.sin(i))); if (x >= 0 && x <= 8 && y >= 0 && y <= 19) { if (setLEDInternal(px, py, colour)) { -- cgit v1.2.3