Skip to content

Commit

Permalink
Fix Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zalo committed Dec 5, 2023
1 parent 1b8ba7a commit 007acd9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bindings/c/include/manifoldc.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ManifoldManifold *manifold_hull_pts(void *mem, ManifoldVec3 *ps, size_t length);
// Sweeps

ManifoldManifold *manifold_sweep(void *mem, ManifoldManifold *m, float x,
float y, float z);
float y, float z);

// Manifold Transformations

Expand Down
4 changes: 3 additions & 1 deletion bindings/wasm/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ Manifold IntersectionN(const std::vector<Manifold>& manifolds) {
Manifold Sweep(Manifold& manifold, const val& v) {
std::vector<float> array = convertJSArrayToNumberVector<float>(v);
glm::vec3 offset;
offset[0] = array[0]; offset[1] = array[1]; offset[2] = array[2];
offset[0] = array[0];
offset[1] = array[1];
offset[2] = array[2];
return manifold.Sweep(offset);
}

Expand Down
2 changes: 1 addition & 1 deletion src/manifold/src/manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ Manifold Manifold::Sweep(glm::vec3 v) const {
glm::vec3 normal = glm::cross(
mesh.vertPos[mesh.triVerts[i].y] - mesh.vertPos[mesh.triVerts[i].x],
mesh.vertPos[mesh.triVerts[i].z] - mesh.vertPos[mesh.triVerts[i].x]);
if (glm::dot(normal, v) > -0.0001f) { // Only Sweep Forward Triangles
if (glm::dot(normal, v) > -0.0001f) { // Only Sweep Forward Triangles

Check warning on line 848 in src/manifold/src/manifold.cpp

View check run for this annotation

Codecov / codecov/patch

src/manifold/src/manifold.cpp#L846-L848

Added lines #L846 - L848 were not covered by tests
Manifold sweptTriangle = Hull({
mesh.vertPos[mesh.triVerts[i].x],
mesh.vertPos[mesh.triVerts[i].y],
Expand Down
4 changes: 2 additions & 2 deletions test/manifold_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ TEST(Manifold, EmptyHull) {

TEST(Manifold, SweptCube) {
std::vector<glm::vec3> cubePts = {
{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, // corners
{1, 1, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 1}, // corners
{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, // corners
{1, 1, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 1}, // corners
};
auto sweptCube = Manifold::Hull(cubePts).Sweep({1, 0, 0});
EXPECT_FLOAT_EQ(sweptCube.GetProperties().volume, 2);
Expand Down

0 comments on commit 007acd9

Please # to comment.