From fdb337df28b987dea280ba674e7952c3c64dafc9 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 12 Jan 2022 23:19:24 -0500 Subject: [PATCH] document vertex/line/face selection algorithm --- src/mesh/model.js | 5 +++-- src/mesh/work.js | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mesh/model.js b/src/mesh/model.js index 0ca8d637..233fa149 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -259,10 +259,11 @@ mesh.model = class MeshModel extends mesh.object { let material = new MeshPhongMaterial( { color: 0x777777, transparent: true, opacity: 0.25 } ); let sphere = new Mesh( geometry, material ); let { x, y, z } = point; + let { a, b, c } = face; sphere.position.set(x,y,z); space.scene.add(sphere); - worker.model_locate({ - id: this.id, x, y:-z, z:y, matrix: this.matrix + worker.model_select({ + id: this.id, x, y:-z, z:y, a, b, c, matrix: this.matrix }).then(data => { console.log('located', data); }); diff --git a/src/mesh/work.js b/src/mesh/work.js index 759ce8b1..3bff726d 100644 --- a/src/mesh/work.js +++ b/src/mesh/work.js @@ -101,11 +101,13 @@ let model = { }, // given model and point, locate matching vertices, lines, and faces - locate(data) { - let { id, x, y, z, matrix } = data; + select(data) { + let { id, x, y, z, a, b, c, matrix } = data; let arr = translate_encode(id, matrix); let eps = 2; for (let i=0, l=arr.length; i