circumference-model.js 654 B

1234567891011121314151617181920
  1. export class CircumferenceModel {
  2. constructor(center, radius) {
  3. this.center = center;
  4. this.radius = radius;
  5. this._coordinates = [];
  6. this._coordinates[0] = this.center.posX;
  7. this._coordinates[1] = this.center.posY;
  8. this._coordinates[2] = this.radius.posX;
  9. this._coordinates[3] = this.radius.posY;
  10. }
  11. update(aggregator, event) {
  12. }
  13. getRadius() {
  14. const legA = this._coordinates[2] - this._coordinates[0];
  15. const legB = this._coordinates[3] - this._coordinates[1];
  16. const radius = Math.sqrt(Math.pow(legA, 2) + Math.pow(legB, 2));
  17. return radius;
  18. }
  19. }