kopia lustrzana https://github.com/jameshball/osci-render
Cleaned up code and added comments
rodzic
e87739158d
commit
e5460bf096
|
@ -38,6 +38,7 @@ public class AudioPlayer extends Thread {
|
|||
double drawingProgress = framesDrawn / framesToDraw;
|
||||
|
||||
for (int c = 0; c < format.outputs; c++) {
|
||||
// Even output indexes refer to first channel, odd indexes refer to second channel.
|
||||
((float[]) output)[f * format.outputs] = shape.nextX(drawingProgress);
|
||||
((float[]) output)[f * format.outputs + 1] = shape.nextY(drawingProgress);
|
||||
}
|
||||
|
@ -98,7 +99,11 @@ public class AudioPlayer extends Thread {
|
|||
}
|
||||
|
||||
private static Shape currentShape() {
|
||||
return shapes.get(currentShape % shapes.size());
|
||||
if (currentShape >= shapes.size()) {
|
||||
currentShape -= shapes.size();
|
||||
}
|
||||
|
||||
return shapes.get(currentShape);
|
||||
}
|
||||
|
||||
public static void setRotateSpeed(double speed) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import shapes.Vector;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Node {
|
||||
private Vector location;
|
||||
|
@ -38,15 +39,15 @@ public class Node {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
} else if (obj instanceof Node) {
|
||||
Node point = (Node) obj;
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Node node = (Node) o;
|
||||
return location.equals(node.location);
|
||||
}
|
||||
|
||||
return getLocation().equals(point.getLocation());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(location);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ public class Shapes {
|
|||
List<Shape> polygon = new ArrayList<>();
|
||||
|
||||
double theta = angleJump * 2 * Math.PI / sides;
|
||||
|
||||
Vector rotated = start.rotate(theta);
|
||||
|
||||
polygon.add(new Line(start, rotated, weight));
|
||||
|
||||
while (!rotated.equals(start)) {
|
||||
|
|
Ładowanie…
Reference in New Issue