8000 Remove triProperties by elalish · Pull Request #1232 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove triProperties #1232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9f2040b
started adding halfedge prop support
elalish Apr 11, 2025
75e6227
Merge branch 'master' of github.com:elalish/manifold into removeTriProp
elalish Apr 12, 2025
09c2df1
fixed bugs
elalish Apr 13, 2025
4ca8e02
attempt to push props through triangulation
elalish Apr 20, 2025
43d294e
fixed a few bugs
elalish Apr 20, 2025
25fe04e
fixed MANIFOLD_ASSERT
elalish Apr 22, 2025
9fe00ff
fixed bug
elalish Apr 22, 2025
ed19846
updated edge_op
elalish Apr 22, 2025
b0eac3c
fixed sort
elalish Apr 22, 2025
7fd1503
fixed compactProps
elalish Apr 23, 2025
640c248
more updates
elalish Apr 24, 2025
476ffd7
a few more
elalish Apr 24, 2025
8add095
fixed a bug
elalish Apr 24, 2025
3b72ea2
fixed old bug
elalish Apr 24, 2025
2bb9ae1
fixed bug
elalish Apr 24, 2025
a58de47
fixed edge swap
elalish Apr 24, 2025
4a2ce54
small WASM update
elalish Apr 25, 2025
f84660f
updated boolean
elalish Apr 25, 2025
9b7cafe
Merge branch 'master' of github.com:elalish/manifold into removeTriProp
elalish Apr 26, 2025
9822492
updated smoothing
elalish Apr 26, 2025
d06ac8b
removed triProperties
elalish Apr 26, 2025
8333084
reduce test memory
elalish Apr 26, 2025
23ff480
format
elalish Apr 26, 2025
28fac2f
moved numProp out of meshRelation
elalish Apr 26, 2025
81e5e1c
moved properties out of meshRelation
elalish Apr 26, 2025
264c92e
harmonize includes
elalish Apr 26, 2025
e3ed696
remove unused
elalish Apr 26, 2025
7d18bcf
update test to check simplify with properties
elalish Apr 26, 2025
cdbe821
fix CI
elalish Apr 26, 2025
ae40eca
more CI fixes
elalish Apr 26, 2025
5051325
undo no-unused req
elalish Apr 27, 2025
23ba7b0
renamed internal faceID to coplanarID
elalish Apr 27, 2025
9ee3e42
fixed tests
elalish Apr 28, 2025
71287f1
updated quad short path
elalish Apr 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"configurations": [
{
"name": "manifold test",
"type": "cppdbg",
"type": "lldb-dap",
"MIMode": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/test/manifold_test",
"args": [
"--gtest_catch_exceptions=0",
"--gtest_filter=Properties.ToleranceSphere"
"--gtest_filter=Boolean.Tetra"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/test",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
6D4E
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"-DMANIFOLD_PYBIND=ON",
"-DMANIFOLD_EXPORT=ON",
"-DMANIFOLD_DEBUG=ON",
"-DMANIFOLD_ASSERT=OFF",
"-DMANIFOLD_ASSERT=ON",
"-DMANIFOLD_PAR=ON",
"-DCODE_COVERAGE=OFF",
"-DCMAKE_CXX_FLAGS=''" //'-fsanitize=address,undefined'"
Expand Down Expand Up @@ -161,4 +161,5 @@
"clangd.arguments": [
"--header-insertion=never"
],
"editor.defaultFormatter": "xaver.clang-format",
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ cd manifold
mkdir buildWASM
cd buildWASM
emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel .. && emmake make
node test/manifold_test.js
cd test
node ./manifold_test.js
```

### Python
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./conv.h"
#include "conv.h"
#include "manifold/common.h"
#include "manifold/types.h"

Expand Down
2 changes: 1 addition & 1 deletion bindings/c/conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./conv.h"
#include "conv.h"

#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion bindings/c/cross.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./conv.h"
#include "conv.h"
#include "manifold/common.h"
#include "manifold/cross_section.h"
#include "manifold/types.h"
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/manifoldc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <vector>

#include "./conv.h"
#include "conv.h"
#include "manifold/common.h"
#include "manifold/cross_section.h"
#include "manifold/manifold.h"
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/meshIOc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./conv.h"
#include "conv.h"
#include "manifold/meshIO.h"
#include "manifold/types.h"

Expand Down
2 changes: 1 addition & 1 deletion bindings/c/rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./conv.h"
#include "conv.h"
#include "manifold/common.h"
#include "manifold/types.h"

Expand Down
1 change: 1 addition & 0 deletions cmake/info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ message(STATUS "MANIFOLD_CROSS_SECTION: ${MANIFOLD_CROSS_SECTION}")
message(STATUS "MANIFOLD_EXPORT: ${MANIFOLD_EXPORT}")
message(STATUS "MANIFOLD_TEST: ${MANIFOLD_TEST}")
message(STATUS "MANIFOLD_DEBUG: ${MANIFOLD_DEBUG}")
message(STATUS "MANIFOLD_ASSERT: ${MANIFOLD_ASSERT}")
message(STATUS "MANIFOLD_CBIND: ${MANIFOLD_CBIND}")
message(STATUS "MANIFOLD_PYBIND: ${MANIFOLD_PYBIND}")
message(STATUS "MANIFOLD_JSBIND: ${MANIFOLD_JSBIND}")
Expand Down
2 changes: 1 addition & 1 deletion include/manifold/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ class Quality {
int nSegL = 2.0 * radius * kPi / circularEdgeLength_;
int nSeg = fmin(nSegA, nSegL) + 3;
nSeg -= nSeg % 4;
return std::max(nSeg, 3);
return std::max(nSeg, 4);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions samples/src/condensed_matter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ constexpr double AtomicRadiusSi = 1.1;
constexpr double LatticeCellSizeSi = 5.4309;
constexpr double fccOffset = 0.25;
constexpr double AtomicRadiusC = 0.7;
constexpr double LatticeCellSizeC = 3.65;
constexpr double cellLenA = 2.464;
constexpr double cellLenB = cellLenA;
constexpr double cellLenC = 6.711;
constexpr double cellAngleA = 90;
constexpr double cellAngleB = cellAngleA;
constexpr double cellAngleC = 120;
constexpr double LayerSeperationC = 3.364;

Manifold bond(int fn, vec3 p1 = {0, 0, 0}, vec3 p2 = {1, 1, 1},
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ target_compile_features(manifold PUBLIC cxx_std_17)
set(
OPTIONS
MANIFOLD_DEBUG
MANIFOLD_ASSERT
MANIFOLD_CROSS_SECTION
MANIFOLD_EXPORT
TRACY_ENABLE
Expand Down
4 changes: 2 additions & 2 deletions src/boolean3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./boolean3.h"
#include "boolean3.h"

#include <limits>

#include "./parallel.h"
#include "parallel.h"

#if (MANIFOLD_PAR == 1)
#include <tbb/combinable.h>
Expand Down
2 changes: 1 addition & 1 deletion src/boolean3.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#pragma once
#include "./impl.h"
#include "impl.h"

#ifdef MANIFOLD_DEBUG
#define PRINT(msg) \
Expand Down
43 changes: 20 additions & 23 deletions src/boolean_result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include <array>
#include <map>

#include "./boolean3.h"
#include "./parallel.h"
#include "./utils.h"
#include "boolean3.h"
#include "parallel.h"
#include "utils.h"

#if (MANIFOLD_PAR == 1) && __has_include(<tbb/concurrent_map.h>)
#define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 1
Expand Down Expand Up @@ -503,7 +503,7 @@ struct MapTriRef {
const int offsetQ;

void operator()(TriRef& triRef) {
const int tri = triRef.tri;
const int tri = triRef.faceID;
const bool PQ = triRef.meshID == 0;
triRef = PQ ? triRefP[tri] : triRefQ[tri];
if (!PQ) triRef.meshID += offsetQ;
Expand Down Expand Up @@ -543,7 +543,7 @@ struct Barycentric {
const TriRef refPQ = ref[tri];
if (halfedgeR[3 * tri].startVert < 0) return;

const int triPQ = refPQ.tri;
const int triPQ = refPQ.faceID;
const bool PQ = refPQ.meshID == 0;
const auto& vertPos = PQ ? vertPosP : vertPosQ;
const auto& halfedge = PQ ? halfedgeP : halfedgeQ;
Expand All @@ -565,12 +565,10 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
const int numPropP = inP.NumProp();
const int numPropQ = inQ.NumProp();
const int numProp = std::max(numPropP, numPropQ);
outR.meshRelation_.numProp = numProp;
outR.numProp_ = numProp;
if (numProp == 0) return;

const int numTri = outR.NumTri();
outR.meshRelation_.triProperties.resize_nofill(numTri);

Vec<vec3> bary(outR.halfedge_.size());
for_each_n(autoPolicy(numTri, 1e4), countAt(0), numTri,
Barycentric({bary, outR.meshRelation_.triRef, inP.vertPos_,
Expand All @@ -584,7 +582,7 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
propMissIdx[0].resize(inQ.NumPropVert(), -1);
propMissIdx[1].resize(inP.NumPropVert(), -1);

outR.meshRelation_.properties.reserve(outR.NumVert() * numProp);
outR.properties_.reserve(outR.NumVert() * numProp);
int idx = 0;

for (int tri = 0; tri < numTri; ++tri) {
Expand All @@ -594,11 +592,8 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
const TriRef ref = outR.meshRelation_.triRef[tri];
const bool PQ = ref.meshID == 0;
const int oldNumProp = PQ ? numPropP : numPropQ;
const auto& properties =
PQ ? inP.meshRelation_.properties : inQ.meshRelation_.properties;
const ivec3& triProp = oldNumProp == 0 ? ivec3(-1)
: PQ ? inP.meshRelation_.triProperties[ref.tri]
: inQ.meshRelation_.triProperties[ref.tri];
const auto& properties = PQ ? inP.properties_ : inQ.properties_;
const auto& halfedge = PQ ? inP.halfedge_ : inQ.halfedge_;

for (const int i : {0, 1, 2}) {
const int vert = outR.halfedge_[3 * tri + i].startVert;
Expand All @@ -610,16 +605,16 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
for (const int j : {0, 1, 2}) {
if (uvw[j] == 1) {
// On a retained vert, the propVert must also match
key[2] = triProp[j];
key[2] = halfedge[3 * ref.faceID + j].propVert;
edge = -1;
break;
}
if (uvw[j] == 0) edge = j;
}
if (edge >= 0) {
// On an edge, both propVerts must match
const int p0 = triProp[Next3(edge)];
const int p1 = triProp[Prev3(edge)];
const int p0 = halfedge[3 * ref.faceID + Next3(edge)].propVert;
const int p1 = halfedge[3 * ref.faceID + Prev3(edge)].propVert;
key[1] = vert;
key[2] = std::min(p0, p1);
key[3] = std::max(p0, p1);
Expand All @@ -632,7 +627,7 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
// only key.x/key.z matters
auto& entry = propMissIdx[key.x][key.z];
if (entry >= 0) {
outR.meshRelation_.triProperties[tri][i] = entry;
outR.halfedge_[3 * tri + i].propVert = entry;
continue;
}
entry = idx;
Expand All @@ -642,23 +637,25 @@ void CreateProperties(Manifold::Impl& outR, const Manifold::Impl& inP,
for (const auto& b : bin) {
if (b.first == ivec3(key.x, key.z, key.w)) {
bFound = true;
outR.meshRelation_.triProperties[tri][i] = b.second;
outR.halfedge_[3 * tri + i].propVert = b.second;
break;
}
}
if (bFound) continue;
bin.push_back(std::make_pair(ivec3(key.x, key.z, key.w), idx));
}

outR.meshRelation_.triProperties[tri][i] = idx++;
outR.halfedge_[3 * tri + i].propVert = idx++;
for (int p = 0; p < numProp; ++p) {
if (p < oldNumProp) {
vec3 oldProps;
for (const int j : {0, 1, 2})
oldProps[j] = properties[oldNumProp * triProp[j] + p];
outR.meshRelation_.properties.push_back(la::dot(uvw, oldProps));
oldProps[j] =
properties[oldNumProp * halfedge[3 * ref.faceID + j].propVert +
p];
outR.properties_.push_back(la::dot(uvw, oldProps));
} else {
outR.meshRelation_.properties.push_back(0);
outR.properties_.push_back(0);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/collider.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// limitations under the License.

#pragma once
#include "./parallel.h"
#include "./utils.h"
#include "./vec.h"
#include "manifold/common.h"
#include "parallel.h"
#include "utils.h"
#include "vec.h"

#ifdef _MSC_VER
#include <intrin.h>
Expand Down
10 changes: 5 additions & 5 deletions src/constructors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "./csg_tree.h"
#include "./impl.h"
#include "./parallel.h"
#include "csg_tree.h"
#include "impl.h"
#include "manifold/manifold.h"
#include "manifold/polygon.h"
#include "parallel.h"

namespace manifold {
/**
Expand Down Expand Up @@ -277,7 +277,7 @@ Manifold Manifold::Extrude(const Polygons& crossSection, double height,
pImpl_->CreateHalfedges(triVertsDH);
pImpl_->Finish();
pImpl_->InitializeOriginal();
pImpl_->CreateFaces();
pImpl_->MarkCoplanar();
return Manifold(pImpl_);
}

Expand Down Expand Up @@ -420,7 +420,7 @@ Manifold Manifold::Revolve(const Polygons& crossSection, int circularSegments,
pImpl_->CreateHalfedges(triVertsDH);
pImpl_->Finish();
pImpl_->InitializeOriginal();
pImpl_->CreateFaces();
pImpl_->MarkCoplanar();
return Manifold(pImpl_);
}

Expand Down
Loading
Loading
0