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

New circular primitives: Arc2d, CircularSector, CircularSegment #11748

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f637de3
Add `Arc` and `CircularSector` math primitives.
spectria-limina Feb 15, 2024
9b88d45
Add `CircularSegment` primitve as well.
spectria-limina Feb 15, 2024
c36edb5
Fix doc errors.
spectria-limina Feb 7, 2024
1947ac0
Review feedback and other minor improvements.
spectria-limina Feb 15, 2024
33e2dd2
Change the orientation of arc primitives to vertically symmetrical.
spectria-limina Feb 13, 2024
971f9b0
Fix Circular{Sector,Segment} UV-mapping and add an example.
spectria-limina Feb 14, 2024
609d238
Allow the apothem to be negative to simplify much of the math.
spectria-limina Feb 15, 2024
faabb28
Some more small cleanups.
spectria-limina Feb 15, 2024
41806b7
Update examples page.
spectria-limina Feb 15, 2024
9240e7e
Rename CircularShapeUvMode to CircularMeshUvMode.
spectria-limina Feb 15, 2024
ac33ec6
Add tests to primitive math.
spectria-limina Feb 15, 2024
a4fc07f
Add tests for arc bounding shapes.
spectria-limina Feb 16, 2024
fa6c681
Add tests to bounding shapes for CircularSector.
spectria-limina Feb 16, 2024
efb0515
Silence clippy and CI.
spectria-limina Feb 16, 2024
3d47652
Merge branch 'main' into arc
alice-i-cecile Feb 29, 2024
552aea5
Apply suggestions from code review
spectria-limina Mar 9, 2024
31b2be3
Merge branch 'main' into arc
spectria-limina Mar 9, 2024
9353ad0
Review changes
spectria-limina Mar 9, 2024
1c31b1a
More review comments
spectria-limina Mar 24, 2024
4cd5957
Merge remote-tracking branch 'origin/main' into arc
spectria-limina Mar 24, 2024
2e0740c
Merge remote-tracking branch 'origin/main' into arc
spectria-limina Mar 26, 2024
fb29d40
Fixups for review & compile fixes
spectria-limina Mar 26, 2024
1eaf343
Fix failing build stuff
spectria-limina Mar 26, 2024
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
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ description = "Renders a 2d mesh"
category = "2D Rendering"
wasm = true

[[example]]
name = "mesh2d_arcs"
path = "examples/2d/mesh2d_arcs.rs"
doc-scrape-examples = true

[package.metadata.example.mesh2d_arcs]
name = "Arc 2D Meshes"
description = "Demonstrates UV-mapping of the circular segment and sector primitives"
category = "2D Rendering"
wasm = true

[[example]]
name = "mesh2d_manual"
path = "examples/2d/mesh2d_manual.rs"
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ approx = { version = "0.5", optional = true }
rand = { version = "0.8", features = [
"alloc",
], default-features = false, optional = true }
smallvec = { version = "1.11" }

[dev-dependencies]
approx = "0.5"
# Supply rngs for examples and tests
glam = { version = "0.25", features = ["approx"] }
rand = "0.8"
rand_chacha = "0.3"

Expand Down
418 changes: 414 additions & 4 deletions crates/bevy_math/src/bounding/bounded2d/primitive_impls.rs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/bevy_math/src/direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl std::ops::Mul<Dir2> for Rotation2d {
}
}

#[cfg(feature = "approx")]
#[cfg(any(feature = "approx", test))]
impl approx::AbsDiffEq for Dir2 {
type Epsilon = f32;
fn default_epsilon() -> f32 {
Expand All @@ -213,7 +213,7 @@ impl approx::AbsDiffEq for Dir2 {
}
}

#[cfg(feature = "approx")]
#[cfg(any(feature = "approx", test))]
impl approx::RelativeEq for Dir2 {
fn default_max_relative() -> f32 {
f32::EPSILON
Expand All @@ -224,7 +224,7 @@ impl approx::RelativeEq for Dir2 {
}
}

#[cfg(feature = "approx")]
#[cfg(any(feature = "approx", test))]
impl approx::UlpsEq for Dir2 {
fn default_max_ulps() -> u32 {
4
Expand Down
Loading
Loading