UNPKG

686 BJavaScriptView Raw
1import {centroid} from '../centroid';
2import {rotateRzRyRx} from '../rotation';
3
4export function line(lines, options, point, angles){
5
6 for (var i = lines.length - 1; i >= 0; i--) {
7
8 var line = lines[i];
9
10 var p1 = line[0];
11 var p2 = line[1];
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
16 p1.projected = options.project(p1.rotated, options);
17 p2.projected = options.project(p2.rotated, options);
18
19 line.centroid = centroid(line);
20 }
21 return lines;
22}