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

NURBS spline for generating CubicCurve #10220

Closed
JohnTheCoolingFan opened this issue Oct 21, 2023 · 1 comment · Fixed by #10701
Closed

NURBS spline for generating CubicCurve #10220

JohnTheCoolingFan opened this issue Oct 21, 2023 · 1 comment · Fixed by #10701
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Feature A new feature, making something new possible S-Needs-Design This issue requires design work to think about how it would best be accomplished

Comments

@JohnTheCoolingFan
Copy link
Contributor

What problem does this solve or what need does it fill?

NURBS (Non-Uniform rational B-spline) is a variation of b-spline that allows specifying weights to control points to control how much that point influences the curve. One particular use case for this would be making ends of a curve composed of multiple segments actually go go through the start and end control points.

What solution would you like?

A new type of spline in bevy::math::cubic_splines that allows generating curves via NURBS.

What alternative(s) have you considered?

Custom implementation based on the code for BSpline already in the engine but altered to allow setting weights directly instead of being constant

Additional context

Example of a NURBS curve:
image

@JohnTheCoolingFan JohnTheCoolingFan added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Oct 21, 2023
@JohnTheCoolingFan
Copy link
Contributor Author

After researching/obsessing more about splines, I think I ned to rewrite this feature request, as I've discovered terms such as knots, knot values, etc.

@alice-i-cecile alice-i-cecile added A-Math Fundamental domain-agnostic mathematical operations S-Needs-Design This issue requires design work to think about how it would best be accomplished and removed S-Needs-Triage This issue needs to be labelled labels Oct 23, 2023
@JohnTheCoolingFan JohnTheCoolingFan changed the title NURBS spline for generatic CubicCurve NURBS spline for generating CubicCurve Dec 2, 2023
github-merge-queue bot pushed a commit that referenced this issue Feb 28, 2024
# Objective

Improve the `bevy::math::cubic_splines` module by making it more
flexible and adding new curve types.
Closes #10220 

## Solution

Added new spline types and improved existing

---

## Changelog

### Added

- `CubicNurbs` rational cubic curve generator, allows setting the knot
vector and weights associated with every point
- `LinearSpline` curve generator, allows generating a linearly
interpolated curve segment
- Ability to push additional cubic segments to `CubicCurve`
- `IntoIterator` and `Extend` implementations for `CubicCurve`

### Changed

- `Point` trait has been implemented for more types: `Quat` and `Vec4`.
- `CubicCurve::coefficients` was moved to `CubicSegment::coefficients`
because the function returns `CubicSegment`, so it seems logical to be
associated with `CubicSegment` instead. The method is still not public.

### Fixed

- `CubicBSpline::new` was referencing Cardinal spline instead of
B-Spline

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: IQuick 143 <[email protected]>
Co-authored-by: Miles Silberling-Cook <[email protected]>
Co-authored-by: Joona Aalto <[email protected]>
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-Feature A new feature, making something new possible S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants