All files / src/elements/polyhedron PyramidElement.ts

100% Statements 34/34
100% Branches 2/2
100% Functions 1/1
100% Lines 34/34

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 351x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 30x 30x 30x 30x 30x 30x 104x 104x 30x 1x  
/*----------------------------------------------------------------------+
|    Title:	PyramidElement.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:    May, 1997.                                                |
|    TypeScript Port: 2026, Nelson Brown, brownnrl@gmail.com            |
|                           https://www.nelsonbrown.net/                |
+----------------------------------------------------------------------*/
 
import {PolyhedronElement} from "./PolyhedronElement";
import {PolygonElement} from "../polygon/PolygonElement";
import {PointElement} from "../point/PointElement";
 
export class PyramidElement extends PolyhedronElement {
 
    constructor(Base: PolygonElement, Apex: PointElement) {
        super();
        this.dimension = 2;
        let n = 1 + Base.V.length;
        this.P = new Array(n);
        this.P[0] = Base;
        for (let i = 1; i < n; ++i) {
            this.P[i] = new PolygonElement([Apex, Base.V[i - 1], Base.V[i % Base.V.length]]);
        }
    }
}