mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-23 17:04:00 +01:00
21 lines
No EOL
448 B
JavaScript
21 lines
No EOL
448 B
JavaScript
import * as define from './define.js'
|
|
|
|
export class Shell {
|
|
constructor() {
|
|
this.faces = [];
|
|
define.iterable(this, 'vertices', () => verticesGenerator(this));
|
|
}
|
|
}
|
|
|
|
export function* verticesGenerator(shell) {
|
|
const seen = new Set();
|
|
for (let face of shell.faces) {
|
|
for (let edge of face.outerLoop.halfEdges) {
|
|
if (!seen.has(edge.vertexA)) {
|
|
seen.add(edge.vertexA);
|
|
yield edge.vertexA;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|