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 56 57 58 59 60 61 62 | import { SurfaceData, Point3, ISurface, Color, RGB } from '../../types'; type SurfaceProps = { id: string; data: SurfaceData; frameOfReferenceUID: string; color?: Point3; }; /** * Surface class for storing surface data */ export class Surface implements ISurface { readonly id: string; readonly sizeInBytes: number; readonly frameOfReferenceUID: string; private color: RGB = [200, 0, 0]; // default color private points: number[]; private polys: number[]; constructor(props: SurfaceProps) { this.id = props.id; this.points = props.data.points; this.polys = props.data.polys; this.color = props.color ?? this.color; this.frameOfReferenceUID = props.frameOfReferenceUID; this.sizeInBytes = this._getSizeInBytes(); } _getSizeInBytes(): number { return this.points.length * 4 + this.polys.length * 4; } public getColor(): RGB { return this.color; } public getPoints(): number[] { return this.points; } public getPolys(): number[] { return this.polys; } public setColor(color: RGB): void { this.color = color; } public setPoints(points: number[]): void { this.points = points; } public setPolys(polys: number[]): void { this.polys = polys; } public getSizeInBytes(): number { return this.sizeInBytes; } } |