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