1 | import {ccw} from '../counter-clockwise';
|
2 | import {centroid} from '../centroid';
|
3 | import {point as pt} from './point';
|
4 |
|
5 | export function gridPlane(grid, options, point, angles){
|
6 |
|
7 | var points = pt(grid, options, point, angles);
|
8 | var cnt = 0, planes = [];
|
9 | var numPts = options.row;
|
10 | var numRow = points.length/numPts;
|
11 |
|
12 | for (var i = numRow - 1; i > 0; i--) {
|
13 | for (var j = numPts - 1; j > 0; j--) {
|
14 |
|
15 | var p1 = j + i * numPts, p4 = p1 - 1, p2 = p4 - numPts + 1, p3 = p2 - 1;
|
16 | var pl = [points[p1], points[p2], points[p3], points[p4]];
|
17 |
|
18 | pl.plane = 'plane_' + cnt++;
|
19 | pl.ccw = ccw(pl);
|
20 | pl.centroid = centroid(pl);
|
21 | planes.push(pl);
|
22 | }
|
23 | }
|
24 |
|
25 | return planes;
|
26 | }
|