Skip to content

Commit

Permalink
🐞 fix: Fixed the matrix transformation.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangechen committed Dec 13, 2024
1 parent c621c16 commit 075de46
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cpp/src/mesher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,27 @@ class FaceMesher

void generateFaceMeshs()
{
auto totleTransform = shape.Location().Transformation().Inverted();
auto inverted = shape.Location().Transformation().Inverted();
TopTools_IndexedMapOfShape faceMap;
TopExp::MapShapes(this->shape, TopAbs_FACE, faceMap);
for (TopTools_IndexedMapOfShape::Iterator anIt(faceMap); anIt.More(); anIt.Next())
{
auto face = TopoDS::Face(anIt.Value());
faces.push_back(face);
generateFaceMesh(face, totleTransform);
generateFaceMesh(face, inverted);
}
}

void generateFaceMesh(const TopoDS_Face &face, const gp_Trsf &totleTransform)
void generateFaceMesh(const TopoDS_Face &face, const gp_Trsf &inverted)
{
TopLoc_Location location;
auto handlePoly = BRep_Tool::Triangulation(face, location);
if (handlePoly.IsNull())
{
return;
}
auto trsf = inverted.Multiplied(location.Transformation());

auto trsf = location.Transformation();
trsf = trsf.Multiplied(totleTransform);
bool isMirrod = trsf.VectorialPart().Determinant() < 0;
auto orientation = face.Orientation();
auto groupStart = this->index.size();
Expand Down
1 change: 1 addition & 0 deletions packages/chili-core/src/model/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ export class EditableShapeNode extends ShapeNode {
} else {
this._shape = Result.ok(shape);
}
this.setPrivateValue("transform", this._shape.value.matrix);
}
}

Expand Down
Empty file modified packages/chili-wasm/lib/chili-wasm.js
100644 → 100755
Empty file.
Binary file modified packages/chili-wasm/lib/chili-wasm.wasm
Binary file not shown.

0 comments on commit 075de46

Please sign in to comment.