-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
247 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2024 brittni and the polar bear LLC. | ||
* | ||
* This file is a part of brittni and the polar bear's rainbow waves algorithmic art project, | ||
* which is released under the GNU Affero General Public License, Version 3.0. | ||
* You may not use this file except in compliance with the license. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. See LICENSE or go to | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* The visual outputs of this source code are licensed under the | ||
* Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License. | ||
* You should have received a copy of the CC BY-NC-ND 4.0 License with this program. | ||
* See OUTPUT-LICENSE or go to https://creativecommons.org/licenses/by-nc-nd/4.0/ | ||
* for full license details. | ||
*/ | ||
|
||
import { CanvasScreen, P5Context } from '@batpb/genart'; | ||
|
||
export class SketchScreen extends CanvasScreen { | ||
public constructor() { | ||
super('sketch'); | ||
} | ||
|
||
public draw(): void { | ||
P5Context.p5.background(0, 175, 0); | ||
} | ||
|
||
public keyPressed(): void { | ||
console.log('keyPressed'); | ||
} | ||
|
||
public mousePressed(): void { | ||
console.log('mousePressed'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2024 brittni and the polar bear LLC. | ||
* | ||
* This file is a part of brittni and the polar bear's rainbow waves algorithmic art project, | ||
* which is released under the GNU Affero General Public License, Version 3.0. | ||
* You may not use this file except in compliance with the license. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. See LICENSE or go to | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* The visual outputs of this source code are licensed under the | ||
* Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License. | ||
* You should have received a copy of the CC BY-NC-ND 4.0 License with this program. | ||
* See OUTPUT-LICENSE or go to https://creativecommons.org/licenses/by-nc-nd/4.0/ | ||
* for full license details. | ||
*/ | ||
|
||
import {CanvasRedrawListener, Color, Coordinate, Point as PointShape} from '@batpb/genart' | ||
import P5Lib from "p5"; | ||
|
||
export class Point implements CanvasRedrawListener { | ||
#base: Coordinate = new Coordinate(); | ||
#point: PointShape; | ||
#theta: number; | ||
#amplitude: number; | ||
#deltaTheta: number; | ||
|
||
public constructor(base: P5Lib.Vector, theta: number, amp: number, deltaTheta: number) { | ||
this.#base.position = base; | ||
this.#theta = theta; | ||
this.#amplitude = amp; | ||
this.#deltaTheta = deltaTheta; | ||
this.#point = new PointShape(); | ||
this.#updatePosition(); | ||
this.#point.stroke = new Color(255, 0, 0); | ||
} | ||
|
||
public draw(): void { | ||
this.#point.draw(); | ||
this.update(); | ||
} | ||
|
||
public update(): void { | ||
this.#theta += this.#deltaTheta; | ||
} | ||
|
||
public canvasRedraw(): void { | ||
this.#point.canvasRedraw(); | ||
} | ||
|
||
#updatePosition(): void { | ||
this.#point.x = this.#base.x; | ||
this.#point.y = this.#calculateY(); | ||
} | ||
|
||
#calculateY(): number { | ||
return this.#base.y + (Math.sin(this.#theta) * this.#amplitude); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2015-2024 brittni and the polar bear LLC. | ||
* | ||
* This file is a part of brittni and the polar bear's rainbow waves algorithmic art project, | ||
* which is released under the GNU Affero General Public License, Version 3.0. | ||
* You may not use this file except in compliance with the license. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. See LICENSE or go to | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* The visual outputs of this source code are licensed under the | ||
* Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License. | ||
* You should have received a copy of the CC BY-NC-ND 4.0 License with this program. | ||
* See OUTPUT-LICENSE or go to https://creativecommons.org/licenses/by-nc-nd/4.0/ | ||
* for full license details. | ||
*/ | ||
|
||
import P5Lib, {length} from "p5"; | ||
import {Point} from "./point"; | ||
import {CanvasRedrawListener, P5Context} from "@batpb/genart"; | ||
|
||
export class Wave implements CanvasRedrawListener { | ||
#base: P5Lib.Vector; | ||
#length: number; | ||
#amplitude: number; | ||
#frequency: number; | ||
#pointCount: number; | ||
#deltaTheta: number; | ||
readonly #points: Point[] = []; | ||
|
||
constructor(base: P5Lib.Vector, length: number, amplitude: number, frequency: number, pointCount: number) { | ||
this.#base = base; | ||
this.#length = length; | ||
this.#amplitude = amplitude; | ||
this.#frequency = frequency; | ||
this.#pointCount = pointCount; | ||
this.#deltaTheta = 0.01; | ||
this.#buildPoints(); | ||
} | ||
|
||
#buildPoints(): void { | ||
let theta: number = 0; | ||
|
||
for (let i: number = 0; i < this.#pointCount; i++) { | ||
const pointBase: P5Lib.Vector = new P5Lib.Vector(); | ||
pointBase.x = this.#base.x + (i * (this.#length / this.#pointCount)); | ||
pointBase.y = this.#base.y; | ||
const point: Point = new Point(pointBase, theta, this.#amplitude, this.#deltaTheta); | ||
this.#points.push(point); | ||
theta += ((P5Context.p5.TWO_PI * this.#frequency) / this.#pointCount); | ||
} | ||
} | ||
|
||
canvasRedraw(): void { | ||
this.#points.forEach((point: Point): void => point.canvasRedraw()); | ||
} | ||
|
||
draw(): void { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2024 brittni and the polar bear LLC. | ||
* | ||
* This file is a part of brittni and the polar bear's rainbow waves algorithmic art project, | ||
* which is released under the GNU Affero General Public License, Version 3.0. | ||
* You may not use this file except in compliance with the license. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. See LICENSE or go to | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* The visual outputs of this source code are licensed under the | ||
* Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) License. | ||
* You should have received a copy of the CC BY-NC-ND 4.0 License with this program. | ||
* See OUTPUT-LICENSE or go to https://creativecommons.org/licenses/by-nc-nd/4.0/ | ||
* for full license details. | ||
*/ | ||
|
||
// TODO - layouts | ||
// TODO - horizontal | ||
// TODO - vertical | ||
// TODO - gabriel graph | ||
// TODO - random geometric graph (maybe?) | ||
|
||
// TODO - graph point distributions | ||
// TODO - square | ||
// TODO - circle | ||
// TODO - poisson distribution (code train tutorial) | ||
// TODO - square lattice | ||
// TODO - equilateral triangle lattice | ||
// TODO - hexagon lattice | ||
// TODO - rhombic lattice | ||
// TODO - rectangular lattice | ||
// TODO - oblique lattice |