UNPKG

1.16 kBJavaScriptView Raw
1import {ccw} from '../counter-clockwise';
2import {centroid} from '../centroid';
3import {rotateRzRyRx} from '../rotation';
4
5export function plane(planes, options, point, angles){
6
7 for (var i = planes.length - 1; i >= 0; i--) {
8
9 var plane = planes[i];
10
11 var p1 = plane[0];
12 var p2 = plane[1];
13 var p3 = plane[2];
14 var p4 = plane[3];
15
16 p1.rotated = rotateRzRyRx({x : point.x(p1), y : point.y(p1), z : point.z(p1)}, angles);
17 p2.rotated = rotateRzRyRx({x : point.x(p2), y : point.y(p2), z : point.z(p2)}, angles);
18 p3.rotated = rotateRzRyRx({x : point.x(p3), y : point.y(p3), z : point.z(p3)}, angles);
19 p4.rotated = rotateRzRyRx({x : point.x(p4), y : point.y(p4), z : point.z(p4)}, angles);
20
21 p1.projected = options.project(p1.rotated, options);
22 p2.projected = options.project(p2.rotated, options);
23 p3.projected = options.project(p3.rotated, options);
24 p4.projected = options.project(p4.rotated, options);
25
26 plane.ccw = ccw(plane);
27 plane.centroid = centroid(plane);
28 }
29 return planes;
30}