Skip to content

Bevy curve - #25380

Merged
alice-i-cecile merged 7 commits into
bevyengine:mainfrom
JasmineLowen:bevy-curve
Sep 1, 2026
Merged

Bevy curve#25380
alice-i-cecile merged 7 commits into
bevyengine:mainfrom
JasmineLowen:bevy-curve

Conversation

@JasmineLowen

@JasmineLowen JasmineLowen commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Objective

Following some discussions in the discord math-dev chat, there were multiple voices raising the idea of a split-off of the curves from the bevy_math crate:

  • a bevy_curve crate has been desired for quite some time yeah
  • bevy_curve is definitely a crate I would split off from bevy_math as well 👍

Hence this PR tries to achive exactly this and nothing more while making (hopefully) only a minimal set of moves/changes.

Solution

  • bevy_curve crate was created. It was already reserved by cart, which is nice ✅
  • move curves and cubic_splines to bevy_curve. Mostly just code moving, with some minimal fixups
  • fixup all other bevy internal crates that made use of curves
  • remove curve feature from bevy_math
  • I also had to introduce one (1) indirection trait to make everything work (highlighted in self-review)

Testing

  • Running most of the CI checks manually and making sure they still work should cover everything here

ToDos

  • write migration guide

@JasmineLowen
JasmineLowen force-pushed the bevy-curve branch 2 times, most recently from 48879ba to e393a3b Compare August 12, 2026 18:09
@JaySpruce JaySpruce added C-Code-Quality A section of code that is hard to understand or change A-Math Fundamental domain-agnostic mathematical operations S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Aug 12, 2026
@JasmineLowen
JasmineLowen marked this pull request as ready for review August 14, 2026 06:35
@JasmineLowen
JasmineLowen force-pushed the bevy-curve branch 2 times, most recently from f3a60ce to b10a77f Compare August 14, 2026 07:53
@github-actions

Copy link
Copy Markdown
Contributor

You added a new feature but didn't update the readme. Please run cargo run -p build-templated-pages -- update features to update it, and commit the file change.

Comment thread crates/bevy_curve/Cargo.toml Outdated
@Zeophlite Zeophlite added the S-Merge-Conflicts Merge conflicts :( Add this label on top of other S- labels. label Aug 22, 2026
@JasmineLowen

Copy link
Copy Markdown
Contributor Author

Alrighty for the afterworld here's the explanation how I resolved the heavy issues with the no_std stuff not passing the CI checks.

So what's failing is

cargo check -p bevy --no-default-features --features default_no_std --target thumbv6m-none-eabi --jobs 1 (--jobs 1 to fail reproducible at the first spot that errors)

So basically what solved it was

cargo tree -e features -p bevy --no-default-features --features default_no_std --target thumbv6m-none-eabi

which revealed:

    │   ├── bevy_color v0.20.0-dev (/home/aviac/repos/github/RobWalt/bevy/crates/bevy_color)
    │   │   └── bevy_curve feature "default"
    │   │       ├── bevy_curve v0.20.0-dev (/home/aviac/repos/github/RobWalt/bevy/crates/bevy_curve)
    │   │       └── bevy_curve feature "std"
    │   │           ├── bevy_reflect feature "std"
    │   │           │   ├── bevy_platform feature "std"
    │   │           │   │   ├── critical-section feature "std"
    │   │           │   │   │   ├── critical-section v1.2.0
    │   │           │   │   │   └── critical-section feature "restore-state-bool"

Which means I forgot to disable default-features in the bevy_curve depenency of bevy_color which dragged in critical-sections std feature.

@JasmineLowen
JasmineLowen force-pushed the bevy-curve branch 3 times, most recently from 9eb461d to 06fc4f3 Compare August 23, 2026 06:43
@Zeophlite Zeophlite added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged S-Merge-Conflicts Merge conflicts :( Add this label on top of other S- labels. labels Aug 25, 2026
@Zeophlite Zeophlite added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 30, 2026
@alice-i-cecile alice-i-cecile added the X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers label Aug 31, 2026
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Aug 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 31, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

Merge conflicts, unsurprisingly.

@alice-i-cecile alice-i-cecile added the S-Merge-Conflicts Merge conflicts :( Add this label on top of other S- labels. label Aug 31, 2026
@JasmineLowen
JasmineLowen force-pushed the bevy-curve branch 3 times, most recently from ef38525 to f0b322e Compare September 1, 2026 17:41
This was a problem since the prelude included itself because it
re-exported: `crate::*`
@JasmineLowen JasmineLowen mentioned this pull request Sep 1, 2026
2 tasks
This lead to issues in CI that were only uncovered after doing this in
two crates, see:

https://github.com/bevyengine/bevy/actions/runs/33535695284/job/99949477868?pr=25380
@JasmineLowen

Copy link
Copy Markdown
Contributor Author

I just want to highlight 950a35e which fixes stuff in the previously merged bevy_shape (mentioned in the commit description)

let reparametrized_curve = curve
.by_ref()
.reparametrize(interval(0.0, f32::INFINITY).unwrap(), ops::exp2);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(3.5), 3.5);
.by_ref()
.reparametrize(interval(0.0, f32::INFINITY).unwrap(), ops::exp2);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(3.5), 3.5);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(100.0), 100.0);
);

let reparametrized_curve = curve.by_ref().reparametrize(Interval::UNIT, |t| t + 1.0);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(0.0), 0.0);

let reparametrized_curve = curve.by_ref().reparametrize(Interval::UNIT, |t| t + 1.0);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(0.0), 0.0);
assert_abs_diff_eq!(reparametrized_curve.sample_unchecked(1.0), 1.0);
let curve = FunctionCurve::new(Interval::UNIT, ops::exp2);
let first_reparam = curve.reparametrize(interval(1.0, 2.0).unwrap(), ops::log2);
let second_reparam = first_reparam.reparametrize(Interval::UNIT, |t| t + 1.0);
assert_abs_diff_eq!(second_reparam.sample_unchecked(0.0), 1.0);
let first_reparam = curve.reparametrize(interval(1.0, 2.0).unwrap(), ops::log2);
let second_reparam = first_reparam.reparametrize(Interval::UNIT, |t| t + 1.0);
assert_abs_diff_eq!(second_reparam.sample_unchecked(0.0), 1.0);
assert_abs_diff_eq!(second_reparam.sample_unchecked(0.5), 1.5);
let second_reparam = first_reparam.reparametrize(Interval::UNIT, |t| t + 1.0);
assert_abs_diff_eq!(second_reparam.sample_unchecked(0.0), 1.0);
assert_abs_diff_eq!(second_reparam.sample_unchecked(0.5), 1.5);
assert_abs_diff_eq!(second_reparam.sample_unchecked(1.0), 2.0);
Comment on lines +1304 to +1306
resampled_curve.sample_unchecked(test_pt),
expected,
epsilon = 1e-6
Comment on lines +1316 to +1318
resampled_curve.sample_unchecked(test_pt),
expected,
epsilon = 1e-6
@JasmineLowen

JasmineLowen commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

bro is trippin ... 🙄

edit: snap 📸 that's going straight into my cringe collection

@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Sep 1, 2026
Merged via the queue into bevyengine:main with commit cdffa0d Sep 1, 2026
41 of 42 checks passed
@JasmineLowen
JasmineLowen deleted the bevy-curve branch September 2, 2026 14:50
ickshonpe pushed a commit to ickshonpe/bevy that referenced this pull request Sep 2, 2026
# Objective

- the bevy_curve / bevy_shape split (bevyengine#25380 / bevyengine#25302) had a few issues
- missing licenses files
- tool generating images didn't update path
- bevy_animation needs bevy_curve/reflect
- some alloc gates in bevy_curve seem wrong
- dependencies are not specified in the same order as other crates

## Solution

- fix them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations C-Code-Quality A section of code that is hard to understand or change S-Merge-Conflicts Merge conflicts :( Add this label on top of other S- labels. S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants