Skip to content

Commit

Permalink
fix: improve measurement face detection
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed May 1, 2024
1 parent fc953a6 commit 444e81a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openbim-components",
"version": "1.5.0",
"version": "1.5.1",
"main": "src/index.js",
"author": "harry collin, antonio gonzalez viegas",
"license": "MIT",
Expand Down
5 changes: 1 addition & 4 deletions resources/openbim-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -117103,6 +117103,7 @@ class MeasurementUtils {
];
const plane = new THREE$1.Plane();
plane.setFromNormalAndCoplanarPoint(faceNormal, p1);
plane.constant = Math.round(plane.constant * 10) / 10;
return { plane, edges };
}
static getVerticesAndNormal(mesh, faceIndex, instance) {
Expand All @@ -117125,9 +117126,6 @@ class MeasurementUtils {
const averageNy = (n1.y + n2.y + n3.y) / 3;
const averageNz = (n1.z + n2.z + n3.z) / 3;
const faceNormal = new THREE$1.Vector3(averageNx, averageNy, averageNz);
if (!faceNormal.x && !faceNormal.y && !faceNormal.z) {
console.log("hey");
}
// Apply instance transformation to vertex and normal
if (instance !== undefined && mesh instanceof THREE$1.InstancedMesh) {
const transform = new THREE$1.Matrix4();
Expand Down Expand Up @@ -117355,7 +117353,6 @@ class FaceMeasurement extends Component {
scene.add(this.preview);
const result = MeasurementUtils.getFace(mesh, faceIndex, instance);
if (result === null) {
console.log("Hey!");
return;
}
const area = this.regenerateHighlight(mesh, result.indices, instance);
Expand Down
1 change: 0 additions & 1 deletion src/measurement/FaceMeasurement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ export class FaceMeasurement

const result = MeasurementUtils.getFace(mesh, faceIndex, instance);
if (result === null) {
console.log("Hey!");
return;
}

Expand Down
5 changes: 1 addition & 4 deletions src/measurement/MeasurementUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export class MeasurementUtils {

const plane = new THREE.Plane();
plane.setFromNormalAndCoplanarPoint(faceNormal, p1);
plane.constant = Math.round(plane.constant * 10) / 10;
return { plane, edges };
}

Expand Down Expand Up @@ -263,10 +264,6 @@ export class MeasurementUtils {
const averageNz = (n1.z + n2.z + n3.z) / 3;
const faceNormal = new THREE.Vector3(averageNx, averageNy, averageNz);

if (!faceNormal.x && !faceNormal.y && !faceNormal.z) {
console.log("hey");
}

// Apply instance transformation to vertex and normal

if (instance !== undefined && mesh instanceof THREE.InstancedMesh) {
Expand Down

0 comments on commit 444e81a

Please sign in to comment.