edges
方法用于获取多面体的所有边。返回一个数组,数组中的每个元素都是代表一条边的数组。
polyhedron.edges()
返回一个数组,其中每个元素都是一个数组,代表一条边。每条边的数组由两个坐标点数组组成,每个坐标点数组由三个数字组成,分别代表坐标系中的 x、y、z 坐标。
const vertices = [
[0, 0, 0],
[0, 0, 1],
[0, 1, 0],
[0, 1, 1],
[1, 0, 0],
[1, 0, 1],
[1, 1, 0],
[1, 1, 1]
];
const faces = [
[0, 2, 3, 1],
[2, 6, 7, 3],
[6, 4, 5, 7],
[4, 0, 1, 5],
[0, 4, 6, 2],
[1, 3, 7, 5],
];
const polyhedron = new YUKA.Polyhedron(vertices, faces);
const edges = polyhedron.edges();
console.log(edges); // [[ [ 0, 0, 0 ], [ 0, 0, 1 ] ], [ [ 0, 0, 0 ], [ 0, 1, 0 ] ], ... ]
无
无