add gear generator to mesh tool
This commit is contained in:
parent
7988abcb37
commit
cc93c9a6e9
6 changed files with 143 additions and 2 deletions
|
|
@ -21,9 +21,10 @@
|
|||
gapp.main("mesh.work", [], (root) => {
|
||||
|
||||
const { Matrix4, Vector3, BufferGeometry, BufferAttribute, computeFaceNormal } = THREE;
|
||||
const { mesh, moto } = root;
|
||||
const { base, mesh, moto } = root;
|
||||
const { client, worker } = moto;
|
||||
const { util } = mesh;
|
||||
const { newPolygon } = base;
|
||||
const cache = {};
|
||||
|
||||
// add scoped access to cache
|
||||
|
|
@ -397,6 +398,14 @@ let model = {
|
|||
log(`${id} | rebuild complete`);
|
||||
send.done({ lines: layers });
|
||||
});;
|
||||
},
|
||||
|
||||
gen_gear(data, send) {
|
||||
const { teeth, module, angle, z } = data;
|
||||
let points = new mesh.tool().generateGear(teeth, module, angle);
|
||||
let verts = points.map(v => [...v, 0]).flat();
|
||||
let poly = newPolygon().addVerts(verts).extrude(z || 10);
|
||||
send.done(poly);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue