forked from FreezingMoon/AncientBeast
-
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
5 changed files
with
35 additions
and
36 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,31 +1,31 @@ | ||
/** | ||
* Quadratic Curve Class | ||
* | ||
* | ||
* Used to define a quadratic curve of the form y = ax^2 + bx + c | ||
*/ | ||
export class QuadraticCurve { | ||
a: number; | ||
b: number; | ||
c: number; | ||
a: number; | ||
b: number; | ||
c: number; | ||
|
||
/** | ||
* @constructor | ||
* @param{number} a - Coefficient of the second order term | ||
* @param{number} b - Coefficient of the first order term | ||
* @param{number} c - Intercept of the curve | ||
*/ | ||
constructor(a: number, b: number, c: number) { | ||
this.a = a; | ||
this.b = b; | ||
this.c = c; | ||
} | ||
/** | ||
* @constructor | ||
* @param{number} a - Coefficient of the second order term | ||
* @param{number} b - Coefficient of the first order term | ||
* @param{number} c - Intercept of the curve | ||
*/ | ||
constructor(a: number, b: number, c: number) { | ||
this.a = a; | ||
this.b = b; | ||
this.c = c; | ||
} | ||
|
||
/** | ||
* Calculates the resulting y value given x | ||
* @param{number} x - the x value to use for calculation | ||
* @returns{number} y - the resulting y value | ||
*/ | ||
calc_y(x: number): number { | ||
return this.a*Math.pow(x, 2) + this.b*x + this.c; | ||
} | ||
} | ||
/** | ||
* Calculates the resulting y value given x | ||
* @param{number} x - the x value to use for calculation | ||
* @returns{number} y - the resulting y value | ||
*/ | ||
calc_y(x: number): number { | ||
return this.a * Math.pow(x, 2) + this.b * x + this.c; | ||
} | ||
} |