-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* polymorphic device functions working * starting to flesh out algorithm * getting closer * fleshed out vert computation * more progress * BuildTris * fixed some syntax * updating to cpp * added VecDc * SDF compiles * SDF runs * fixed some bugs * manifold output * fixed out of memory bug * flattened sides * back to egg-crate * works with CUDA too * moved SDF * Revert "moved SDF" This reverts commit ba2348f. * added gyroid sample * added sdf_test * added SDF tests * tests pass * updated gyroid_module * fixed gyroid module * added docs * addressing feedback * fix cuda detection * clean up detect cuda * fixed CUDA failure * consistent execution policy in Boolean * remove SDF wrapper class * simplified tet logic * use NeighborInside() * optimized SDF * moved RemoveUnreferencedVerts * put printf statements behind MANIFOLD_DEBUG * enable hashtable resize * added test for hashtable resizing
- Loading branch information
Showing
25 changed files
with
871 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2022 The Manifold Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "samples.h" | ||
#include "sdf.h" | ||
|
||
namespace { | ||
|
||
struct Gyroid { | ||
__host__ __device__ float operator()(glm::vec3 p) const { | ||
p -= glm::pi<float>() / 4; | ||
return cos(p.x) * sin(p.y) + cos(p.y) * sin(p.z) + cos(p.z) * sin(p.x); | ||
} | ||
}; | ||
|
||
Manifold RhombicDodecahedron(float size) { | ||
Manifold box = | ||
Manifold::Cube(size * glm::sqrt(2.0f) * glm::vec3(1, 1, 2), true); | ||
Manifold result = box.Rotate(90, 45) ^ box.Rotate(90, 45, 90); | ||
return result ^ box.Rotate(0, 0, 45); | ||
} | ||
|
||
} // namespace | ||
|
||
namespace manifold { | ||
|
||
/** | ||
* Creates a rhombic dodecahedral module of a gyroid manifold, which can be | ||
* assembled together to tile space continuously. This one is designed to be | ||
* 3D-printable, as it is oriented with minimal overhangs. This sample | ||
* demonstrates the use of a Signed Distance Function (SDF) to create smooth, | ||
* complex manifolds. | ||
*/ | ||
Manifold GyroidModule(float size, int n) { | ||
auto gyroid = [&](float level) { | ||
const float period = glm::two_pi<float>(); | ||
return Manifold(LevelSet(Gyroid(), {glm::vec3(-period), glm::vec3(period)}, | ||
period / n, level)) | ||
.Scale(glm::vec3(size / period)); | ||
}; | ||
|
||
Manifold result = (RhombicDodecahedron(size) ^ gyroid(-0.4)) - gyroid(0.4); | ||
|
||
return result.Rotate(-45, 0, 90).Translate({0, 0, size / glm::sqrt(2.0f)}); | ||
} | ||
} // namespace manifold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.