Skip to content
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

Lazy boolean #131

Merged
merged 17 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/manifold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
cuda_support: [ON, OFF]
parallel_backend: [NONE, OMP, TBB]
runs-on: ubuntu-20.04
if: github.event.pull_request.draft == false
container:
image: docker://nvidia/cuda:11.6.0-devel-ubuntu20.04
steps:
Expand Down Expand Up @@ -47,6 +48,7 @@ jobs:

build_wasm:
runs-on: ubuntu-20.04
if: github.event.pull_request.draft == false
steps:
- name: Install dependencies
run: |
Expand Down Expand Up @@ -83,6 +85,7 @@ jobs:
cuda_support: [OFF]
max-parallel: 1
runs-on: windows-2019
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -126,6 +129,7 @@ jobs:
matrix:
variant: [none, omp, tbb, none-cuda, omp-cuda, tbb-cuda, js]
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v15
Expand Down
7 changes: 6 additions & 1 deletion clang-format.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env -S bash -e
for f in {collider,manifold,meshIO,polygon,samples,utilities}/**/*.{h,cpp} {test,tools}/*.cpp; do
clang-format --dry-run --Werror $f
clang-format --dry-run --Werror $f &
pids[${i}]=$!
done

for pid in ${pids[*]}; do
wait $pid
done
4 changes: 2 additions & 2 deletions manifold/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ project (manifold)

add_library(${PROJECT_NAME} src/manifold.cpp src/constructors.cpp src/impl.cpp
src/properties.cpp src/sort.cpp src/edge_op.cpp src/face_op.cpp
src/smoothing.cpp src/boolean3.cpp src/boolean_result.cpp
src/smoothing.cpp src/boolean3.cpp src/boolean_result.cpp src/csg_tree.cpp
)

if(MANIFOLD_USE_CUDA)
set_source_files_properties(
src/manifold.cpp src/constructors.cpp src/impl.cpp
src/properties.cpp src/sort.cpp src/edge_op.cpp src/face_op.cpp
src/smoothing.cpp src/boolean3.cpp src/boolean_result.cpp
src/manifold_set.cpp
src/manifold_set.cpp src/csg_tree.cpp

PROPERTIES LANGUAGE CUDA
)
Expand Down
28 changes: 18 additions & 10 deletions manifold/include/manifold.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

namespace manifold {

class CsgNode;
class CsgLeafNode;

/** @defgroup Core
* @brief The central classes of the library
* @{
Expand Down Expand Up @@ -104,20 +107,19 @@ class Manifold {
///@{
MeshRelation GetMeshRelation() const;
std::vector<int> GetMeshIDs() const;
int SetAsOriginal();
Manifold AsOriginal() const;
///@}

/** @name Modification
* Change this manifold in-place.
*/
///@{
Manifold& Translate(glm::vec3);
Manifold& Scale(glm::vec3);
Manifold& Rotate(float xDegrees, float yDegrees = 0.0f,
float zDegrees = 0.0f);
Manifold& Transform(const glm::mat4x3&);
Manifold& Warp(std::function<void(glm::vec3&)>);
Manifold& Refine(int);
Manifold Translate(glm::vec3) const;
Manifold Scale(glm::vec3) const;
Manifold Rotate(float xDegrees, float yDegrees = 0.0f,
float zDegrees = 0.0f) const;
Manifold Transform(const glm::mat4x3&) const;
Manifold Warp(std::function<void(glm::vec3&)>) const;
Manifold Refine(int) const;
// Manifold RefineToLength(float);
// Manifold RefineToPrecision(float);
///@}
Expand Down Expand Up @@ -157,7 +159,13 @@ class Manifold {
struct Impl;

private:
std::unique_ptr<Impl> pImpl_;
Manifold(std::shared_ptr<CsgNode> pNode_);
Manifold(std::shared_ptr<Impl> pImpl_);

mutable std::shared_ptr<CsgNode> pNode_;

CsgLeafNode& GetCsgLeafNode() const;

static int circularSegments_;
static float circularAngle_;
static float circularEdgeLength_;
Expand Down