Skip to content

Commit 1ae3f87

Browse files
committed
Update levelset example
1 parent 9d0cc73 commit 1ae3f87

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

splashsurf_lib/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ serde_json = { version = "1.0", optional = true }
6060

6161
[dev-dependencies]
6262
criterion = "0.5.1"
63-
ultraviolet = "0.9"
63+
ultraviolet = "0.10"
6464
sdfu = { git = "https://github.com/w1th0utnam3/sdfu", features = [
6565
"ultraviolet",
66-
], rev = "e39a4a8685a56a3430218b9f2dfd546ab2dbe2d6" }
66+
], rev = "74856c41aaace7cf12e21b41bd0007f1363fea45" }
6767

6868
[[bench]]
6969
name = "splashsurf_lib_benches"

splashsurf_lib/examples/minimal_levelset.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn marching_cubes<R: Real, L: MarchingCubesLevelSet<R>>(
6868
for local_point_index in 0..8 {
6969
let point = cell
7070
.global_point_index_of(local_point_index)
71-
.ok_or(anyhow!("Missing point!"))?;
71+
.ok_or_else(|| anyhow!("Missing point!"))?;
7272
let coords = grid.point_coordinates(&point);
7373

7474
match level_set.evaluate_sign(&coords) {
@@ -84,7 +84,7 @@ pub fn marching_cubes<R: Real, L: MarchingCubesLevelSet<R>>(
8484
for (v_idx, local_edge_index) in triangle.iter().copied().enumerate() {
8585
let edge = cell
8686
.global_edge_index_of(local_edge_index as usize)
87-
.ok_or(anyhow!("Missing edge!"))?;
87+
.ok_or_else(|| anyhow!("Missing edge!"))?;
8888
let vertex_index = *edge_to_vertex.entry(edge).or_insert_with(|| {
8989
let vertex_index = vertices.len();
9090

@@ -117,7 +117,7 @@ pub fn marching_cubes<R: Real, L: MarchingCubesLevelSet<R>>(
117117
}
118118

119119
/// Wrapper for an SDF from sdfu
120-
pub struct SdfuLevelSet<S: sdfu::SDF<f32, Vec3>> {
120+
pub struct SdfuLevelSet<S: SDF<f32, Vec3>> {
121121
sdf: S,
122122
}
123123

@@ -128,7 +128,7 @@ fn vec_na_to_uv(vec: &Vector3<f32>) -> Vec3 {
128128

129129
impl<S> MarchingCubesLevelSet<f32> for SdfuLevelSet<S>
130130
where
131-
S: sdfu::SDF<f32, Vec3>,
131+
S: SDF<f32, Vec3>,
132132
{
133133
fn is_region_supported(&self, aabb: &Aabb3d<f32>) -> bool {
134134
let min = aabb.min();
@@ -160,7 +160,7 @@ where
160160
}
161161

162162
/// Builds an example level set function to reconstruct
163-
fn example_level_set() -> SdfuLevelSet<impl sdfu::SDF<f32, Vec3>> {
163+
fn example_level_set() -> SdfuLevelSet<impl SDF<f32, Vec3>> {
164164
let sdf = sdfu::Sphere::new(0.5f32)
165165
.union_smooth(
166166
sdfu::Sphere::new(0.3).translate(Vec3::new(-0.3, 0.3, 0.0)),

0 commit comments

Comments
 (0)