All files / src/elements/plane ParallelPlane.ts

100% Statements 55/55
100% Branches 4/4
100% Functions 4/4
100% Lines 55/55

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 561x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 1x 1x 3x 3x 3x 1x 1x 2x 2x 2x 1x 1x 91x 91x 91x 1x  
/*----------------------------------------------------------------------+
|    Title:	ParallelPlane.ts                                            |
|    A port of the software Geometry Applet by                          |
|    Author:    David E. Joyce                                          |
|        Department of Mathematics and Computer Science                 |
|        Clark University                                               |
|        Worcester, MA 01610-1477                                       |
|        U.S.A.                                                         |
|                                                                       |
|        http://aleph0.clarku.edu/~djoyce/home.html                     |
|        djoyce@clarku.edu                                              |
|                                                                       |
|    Date:    February, 1996.   Version 2.0.0 May, 1997.                |
|    TypeScript Port: 2026, Nelson Brown, brownnrl@gmail.com            |
|                           https://www.nelsonbrown.net/                |
+----------------------------------------------------------------------*/
 
import {PlaneElement} from "./PlaneElement";
import {PointElement} from "../point/PointElement";
 
export class ParallelPlane extends PlaneElement {
  /*--------------------------------------------------------------------+
  | this is the plane parallel to the plane P passing through the       |
  | point A                                                             |
  +--------------------------------------------------------------------*/
 
  private _P: PlaneElement;
 
  constructor(P: PlaneElement, A: PointElement) {
    super();
    this.dimension = 2;
    this._P = P;
    this.A = A;
    this.B = new PointElement();
    this.C = new PointElement();
    this.S = P.S;
    this.T = P.T;
    this.U = P.U;
  }
 
  public translate(dx: number, dy: number) {
    this.B.translate(dx, dy);
    this.C.translate(dx, dy);
  }
 
  public rotate(pivot: PointElement, ac: number, as: number) {
    this.B.rotate(pivot, ac, as);
    this.C.rotate(pivot, ac, as);
  }
 
  public update() {
    this.B.to(this._P.B).minus(this._P.A).plus(this.A);
    this.C.to(this._P.C).minus(this._P.A).plus(this.A);
  }
}