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

0.1.40 #38

Merged
merged 18 commits into from
Dec 20, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,356 changes: 910 additions & 446 deletions Cargo.lock

Large diffs are not rendered by default.

33 changes: 22 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "curvo"
version = "0.1.39"
version = "0.1.40"
authors = ["Masatatsu Nakamura <[email protected]"]
edition = "2021"
keywords = ["nurbs", "modeling", "graphics", "3d"]
Expand All @@ -24,13 +24,13 @@ easer = { version = "0.3.0", optional = true }
simba = { version = "0.9.0", default-features = false }
spade = { version = "2.12.1" }
gauss-quad = "0.2.1"
bevy = { version = "0.14.2", optional = true }
bevy_egui = { version = "0.30.0", optional = true }
bevy-inspector-egui = { version = "0.27.0", optional = true }
bevy_infinite_grid = { version = "0.13.0", optional = true }
bevy_normal_material = { version = "0.6.0", optional = true }
bevy_panorbit_camera = { version = "0.19.4", optional = true }
bevy_points = { version = "0.6.0", optional = true }
bevy = { version = "0.15.0", optional = true }
bevy_egui = { version = "0.31.1", optional = true }
bevy-inspector-egui = { version = "0.28.0", optional = true }
bevy_infinite_grid = { git = "https://github.com/ForesightMiningSoftwareCorporation/bevy_infinite_grid.git", rev = "1b27619cc5c44d4e939e63345cddc1954e4123db", optional = true }
bevy_normal_material = { version = "0.7.0", optional = true }
bevy_panorbit_camera = { version = "0.21.1", optional = true }
bevy_points = { version = "0.7.0", optional = true }
argmin = "0.10.0"
itertools = "0.13.0"
log = { version = "0.4.22", optional = true }
Expand All @@ -56,7 +56,7 @@ bevy = [
"dep:bevy_normal_material",
"dep:bevy_panorbit_camera",
"dep:bevy_points",
"nalgebra/convert-glam027"
"nalgebra/convert-glam029"
]
log = ["dep:log"]
serde = ["dep:serde"]
Expand Down Expand Up @@ -87,8 +87,8 @@ path = "examples/polyline_curve.rs"
required-features = ["bevy"]

[[example]]
name = "trim_curve"
path = "examples/trim_curve.rs"
name = "split_curve"
path = "examples/split_curve.rs"
required-features = ["bevy"]

[[example]]
Expand All @@ -106,6 +106,11 @@ name = "revolve_surface"
path = "examples/revolve_surface.rs"
required-features = ["bevy"]

# [[example]]
# name = "trimmed_surface"
# path = "examples/trimmed_surface.rs"
# required-features = ["bevy"]

[[example]]
name = "frenet_frame"
path = "examples/frenet_frame.rs"
Expand Down Expand Up @@ -155,3 +160,9 @@ required-features = ["bevy"]
name = "closest_point_on_surface"
path = "examples/closest_point_on_surface.rs"
required-features = ["bevy"]

[[example]]
name = "split_surface"
path = "examples/split_surface.rs"
required-features = ["bevy"]

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ The supported features also include finding the closest point on NURBS curves, f

<img src="https://github.com/mattatz/curvo/assets/1085910/55f214ec-668a-4d18-8fa8-bfa5ca23b3a2" width="360px" alt="Iso-curves on a surface" />

<img src="https://github.com/user-attachments/assets/3b739a9f-531c-4264-90ce-a65e426439b3" width="360px" alt="Closest point on surface" />
<img src="https://github.com/user-attachments/assets/3b739a9f-531c-4264-90ce-a65e426439b3" width="360px" alt="Closest point on a surface" />

<img src="https://github.com/user-attachments/assets/6dc44288-1b21-4040-a49c-fc41d4ca3f45" width="360px" alt="Split a surface" />

## Usage

Expand Down
2 changes: 2 additions & 0 deletions examples/boolean/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

pub mod scenario;
use curvo::prelude::{
operation::BooleanOperation, Boolean, Clip, CompoundCurve, CurveIntersectionSolverOptions,
Expand Down
108 changes: 66 additions & 42 deletions examples/boolean/scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ pub fn island_case() -> CurveVariants {
}

pub fn compound_circle_x_rectangle_case() -> CurveVariants {
let rectangle = NurbsCurve2D::polyline(&[
Point2::new(0., 2.),
Point2::new(0., -2.),
Point2::new(2., -2.),
Point2::new(2., 2.),
Point2::new(0., 2.),
]);
let rectangle = NurbsCurve2D::polyline(
&[
Point2::new(0., 2.),
Point2::new(0., -2.),
Point2::new(2., -2.),
Point2::new(2., 2.),
Point2::new(0., 2.),
],
false,
);
(compound_circle(), rectangle.into())
}

Expand Down Expand Up @@ -97,13 +100,16 @@ pub fn rectangular_annulus_x_rectangular_annulus_case() -> CurveVariants {
fn rectangle(width: f64, height: f64) -> CurveVariant {
let dx = width * 0.5;
let dy = height * 0.5;
NurbsCurve2D::polyline(&[
Point2::new(-dx, -dy),
Point2::new(dx, -dy),
Point2::new(dx, dy),
Point2::new(-dx, dy),
Point2::new(-dx, -dy),
])
NurbsCurve2D::polyline(
&[
Point2::new(-dx, -dy),
Point2::new(dx, -dy),
Point2::new(dx, dy),
Point2::new(-dx, dy),
Point2::new(-dx, -dy),
],
false,
)
.into()
}

Expand Down Expand Up @@ -133,7 +139,10 @@ fn compound_rounded_rectangle() -> CurveVariant {
FRAC_PI_2,
)
.unwrap(),
NurbsCurve2D::polyline(&[Point2::new(length, radius), Point2::new(-length, radius)]),
NurbsCurve2D::polyline(
&[Point2::new(length, radius), Point2::new(-length, radius)],
false,
),
NurbsCurve2D::try_arc(
&Point2::new(-length, 0.),
&dx,
Expand All @@ -143,7 +152,10 @@ fn compound_rounded_rectangle() -> CurveVariant {
PI + FRAC_PI_2,
)
.unwrap(),
NurbsCurve2D::polyline(&[Point2::new(-length, -radius), Point2::new(length, -radius)]),
NurbsCurve2D::polyline(
&[Point2::new(-length, -radius), Point2::new(length, -radius)],
false,
),
])
.into()
}
Expand All @@ -164,10 +176,13 @@ fn compound_rounded_t_shape() -> CurveVariant {
FRAC_PI_2,
)
.unwrap(),
NurbsCurve2D::polyline(&[
Point2::new(w_length, radius),
Point2::new(-w_length, radius),
]),
NurbsCurve2D::polyline(
&[
Point2::new(w_length, radius),
Point2::new(-w_length, radius),
],
false,
),
NurbsCurve2D::try_arc(
&Point2::new(-w_length, 0.),
&dx,
Expand All @@ -177,14 +192,17 @@ fn compound_rounded_t_shape() -> CurveVariant {
PI + FRAC_PI_2,
)
.unwrap(),
NurbsCurve2D::polyline(&[
Point2::new(-w_length, -radius),
Point2::new(-radius, -radius),
Point2::new(-radius, -h_length),
Point2::new(radius, -h_length),
Point2::new(radius, -radius),
Point2::new(w_length, -radius),
]),
NurbsCurve2D::polyline(
&[
Point2::new(-w_length, -radius),
Point2::new(-radius, -radius),
Point2::new(-radius, -h_length),
Point2::new(radius, -h_length),
Point2::new(radius, -radius),
Point2::new(w_length, -radius),
],
false,
),
])
.into()
}
Expand All @@ -194,21 +212,27 @@ fn rectangular_annulus(width: f64, height: f64, square_size: f64) -> CurveVarian
let dy = height * 0.5;
let size = (square_size * 0.5).min(dx).min(dy);
Region::new(
NurbsCurve2D::polyline(&[
Point2::new(-dx, -dy),
Point2::new(dx, -dy),
Point2::new(dx, dy),
Point2::new(-dx, dy),
Point2::new(-dx, -dy),
])
NurbsCurve2D::polyline(
&[
Point2::new(-dx, -dy),
Point2::new(dx, -dy),
Point2::new(dx, dy),
Point2::new(-dx, dy),
Point2::new(-dx, -dy),
],
false,
)
.into(),
vec![NurbsCurve2D::polyline(&[
Point2::new(-size, -size),
Point2::new(size, -size),
Point2::new(size, size),
Point2::new(-size, size),
Point2::new(-size, -size),
])
vec![NurbsCurve2D::polyline(
&[
Point2::new(-size, -size),
Point2::new(size, -size),
Point2::new(size, size),
Point2::new(-size, size),
Point2::new(-size, -size),
],
false,
)
.into()],
)
.into()
Expand Down
Loading
Loading