Skip to content

Commit

Permalink
Update Point class.
Browse files Browse the repository at this point in the history
  • Loading branch information
azurepolarbear committed Dec 28, 2024
1 parent 60d2665 commit e581747
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/main/wave/point/point.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 brittni and the polar bear LLC.
* Copyright (C) 2015-2024 brittni and the polar bear LLC.
*
* This file is a part of azurepolarbear's rainbow waves algorithmic art project,
* which is released under the GNU Affero General Public License, Version 3.0.
Expand All @@ -23,29 +23,27 @@

import P5Lib from 'p5';

import {CanvasContext, CanvasRedrawListener, CoordinateMode, P5Context} from '@batpb/genart';
import { CanvasContext, P5Context } from '@batpb/genart';

export interface PointConfig {
base: P5Lib.Vector;
diameter: number;
coordinateMode: CoordinateMode;
waveRatio_start: number;
waveRatio_end: number;
base: P5Lib.Vector;
diameter: number;
}

/**
* NOTES:
* - The Point class assumes that it's base is on a line starting at (0, 0), and ending at (waveLength, 0).
*/
export class Point implements CanvasRedrawListener {
export class Point {
#waveRatio_start: number;
#waveRatio_end: number;
#base: P5Lib.Vector;
#diameter: number;
// #theta: number = 0;
// #deltaTheta: number = 0.01;

#waveRatio_start: number;
#waveRatio_end: number;

public constructor(config: PointConfig) {
this.#base = config.base;
this.#diameter = config.diameter;
Expand All @@ -62,11 +60,11 @@ export class Point implements CanvasRedrawListener {
}

public get waveRatio_center(): number {
return (this.#waveRatio_start + this.#waveRatio_end) / 2;
return (this.waveRatio_start + this.waveRatio_end) / 2;
}

public get waveRatio_length(): number {
return Math.abs(this.#waveRatio_end - this.#waveRatio_start);
return Math.abs(this.waveRatio_end - this.waveRatio_start);
}

public draw(): void {
Expand All @@ -77,9 +75,6 @@ export class Point implements CanvasRedrawListener {
p5.ellipse(this.#base.x, this.#base.y, this.#diameter, this.#diameter);
}

public canvasRedraw(): void {
}

public updateBase(base: P5Lib.Vector): void {
this.#base.set(base);
}
Expand Down

0 comments on commit e581747

Please sign in to comment.