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

Scrape examples #242

Merged
merged 8 commits into from
Aug 2, 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
23 changes: 20 additions & 3 deletions crates/parry2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,28 @@ workspace = true
[features]
default = ["required-features", "std"]
required-features = ["dim2", "f64"]
std = ["nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "spade", "thiserror"]
std = [
"nalgebra/std",
"slab",
"rustc-hash",
"simba/std",
"arrayvec/std",
"spade",
"thiserror",
]
dim2 = []
f64 = []
serde-serialize = ["serde", "nalgebra/serde-serialize", "arrayvec/serde", "bitflags/serde"]
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
serde-serialize = [
"serde",
"nalgebra/serde-serialize",
"arrayvec/serde",
"bitflags/serde",
]
rkyv-serialize = [
"rkyv/validation",
"nalgebra/rkyv-serialize",
"simba/rkyv-serialize",
]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
Expand Down
118 changes: 114 additions & 4 deletions crates/parry2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,28 @@ workspace = true
[features]
default = ["required-features", "std"]
required-features = ["dim2", "f32"]
std = ["nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "spade", "thiserror"]
std = [
"nalgebra/std",
"slab",
"rustc-hash",
"simba/std",
"arrayvec/std",
"spade",
"thiserror",
]
dim2 = []
f32 = []
serde-serialize = ["serde", "nalgebra/serde-serialize", "arrayvec/serde", "bitflags/serde"]
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
serde-serialize = [
"serde",
"nalgebra/serde-serialize",
"arrayvec/serde",
"bitflags/serde",
]
rkyv-serialize = [
"rkyv/validation",
"nalgebra/rkyv-serialize",
"simba/rkyv-serialize",
]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
Expand Down Expand Up @@ -73,4 +90,97 @@ simba = { version = "0.9", default-features = false }
oorandom = "11"
ptree = "0.4.0"
rand = { version = "0.8" }
macroquad = "0.4"
macroquad = "0.4"

[package.metadata.docs.rs]
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
Vrixyz marked this conversation as resolved.
Show resolved Hide resolved

# The following listing is to allow for examples to be scraped,
# see https://doc.rust-lang.org/rustdoc/scraped-examples.html#scraped-examples for details.
# To help with generating this list, see the script `write_examples.sh`

[[example]]
name = "aabb2d"
path = "examples/aabb2d.rs"
doc-scrape-examples = true
Vrixyz marked this conversation as resolved.
Show resolved Hide resolved

[[example]]
name = "ball2d"
path = "examples/ball2d.rs"
doc-scrape-examples = true

[[example]]
name = "bounding_sphere2d"
path = "examples/bounding_sphere2d.rs"
doc-scrape-examples = true

[[example]]
name = "contact_query2d"
path = "examples/contact_query2d.rs"
doc-scrape-examples = true

[[example]]
name = "convex2d"
path = "examples/convex2d.rs"
doc-scrape-examples = true

[[example]]
name = "convex_hull2d"
path = "examples/convex_hull2d.rs"
doc-scrape-examples = true

[[example]]
name = "convex_try_new2d"
path = "examples/convex_try_new2d.rs"
doc-scrape-examples = true

[[example]]
name = "cuboid2d"
path = "examples/cuboid2d.rs"
doc-scrape-examples = true

[[example]]
name = "distance_query2d"
path = "examples/distance_query2d.rs"
doc-scrape-examples = true

[[example]]
name = "plane2d"
path = "examples/plane2d.rs"
doc-scrape-examples = true

[[example]]
name = "point_in_poly2d"
path = "examples/point_in_poly2d.rs"
doc-scrape-examples = true

[[example]]
name = "polygons_intersection2d"
path = "examples/polygons_intersection2d.rs"
doc-scrape-examples = true

[[example]]
name = "polyline2d"
path = "examples/polyline2d.rs"
doc-scrape-examples = true

[[example]]
name = "proximity_query2d"
path = "examples/proximity_query2d.rs"
doc-scrape-examples = true

[[example]]
name = "solid_point_query2d"
path = "examples/solid_point_query2d.rs"
doc-scrape-examples = true

[[example]]
name = "solid_ray_cast2d"
path = "examples/solid_ray_cast2d.rs"
doc-scrape-examples = true

[[example]]
name = "time_of_impact_query2d"
path = "examples/time_of_impact_query2d.rs"
doc-scrape-examples = true
2 changes: 1 addition & 1 deletion crates/parry2d/examples/ball2d.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use parry2d::shape::Ball;

fn main() {
let ball = Ball::new(1.0f32);
let ball = Ball::new(1.0);
assert!(ball.radius == 1.0);
}
2 changes: 1 addition & 1 deletion crates/parry2d/examples/convex2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use parry2d::shape::ConvexPolygon;

fn main() {
let points = [
Point2::new(-1.0f32, 1.0),
Point2::new(-1.0, 1.0),
Point2::new(-0.5, -0.5),
Point2::new(0.0, 0.5),
Point2::new(0.5, -0.5),
Expand Down
2 changes: 1 addition & 1 deletion crates/parry2d/examples/convex_try_new2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use parry2d::shape::ConvexPolygon;

fn main() {
let points = vec![
Point2::new(-1.0f32, 1.0),
Point2::new(-1.0, 1.0),
Point2::new(-0.5, -0.5),
Point2::new(0.5, -0.5),
Point2::new(1.0, 1.0),
Expand Down
2 changes: 1 addition & 1 deletion crates/parry2d/examples/cuboid2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use na::Vector2;
use parry2d::shape::Cuboid;

fn main() {
let cuboid = Cuboid::new(Vector2::new(2.0f32, 1.0));
let cuboid = Cuboid::new(Vector2::new(2.0, 1.0));

assert!(cuboid.half_extents.x == 2.0);
assert!(cuboid.half_extents.y == 1.0);
Expand Down
16 changes: 14 additions & 2 deletions crates/parry3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ workspace = true
[features]
default = ["required-features", "std"]
required-features = ["dim3", "f64"]
std = ["nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "spade", "thiserror"]
std = [
"nalgebra/std",
"slab",
"rustc-hash",
"simba/std",
"arrayvec/std",
"spade",
"thiserror",
]
dim3 = []
f64 = []
serde-serialize = ["serde", "nalgebra/serde-serialize", "bitflags/serde"]
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
rkyv-serialize = [
"rkyv/validation",
"nalgebra/rkyv-serialize",
"simba/rkyv-serialize",
]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
Expand Down
124 changes: 122 additions & 2 deletions crates/parry3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ workspace = true
[features]
default = ["required-features", "std"]
required-features = ["dim3", "f32"]
std = ["nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "spade", "thiserror"]
std = [
"nalgebra/std",
"slab",
"rustc-hash",
"simba/std",
"arrayvec/std",
"spade",
"thiserror",
]
dim3 = []
f32 = []
serde-serialize = ["serde", "nalgebra/serde-serialize", "bitflags/serde"]
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
rkyv-serialize = [
"rkyv/validation",
"nalgebra/rkyv-serialize",
"simba/rkyv-serialize",
]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]

simd-stable = ["simba/wide", "simd-is-enabled"]
Expand Down Expand Up @@ -76,3 +88,111 @@ obj = { version = "0.10.2", optional = true }
oorandom = "11"
ptree = "0.4.0"
rand = { version = "0.8" }

[package.metadata.docs.rs]
Vrixyz marked this conversation as resolved.
Show resolved Hide resolved
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

# The following listing is to allow for examples to be scraped,
# see https://doc.rust-lang.org/rustdoc/scraped-examples.html#scraped-examples for details.
# To help with generating this list, see the script `write_examples.sh`

[[example]]
name = "aabb3d"
path = "examples/aabb3d.rs"
doc-scrape-examples = true

[[example]]
name = "ball3d"
path = "examples/ball3d.rs"
doc-scrape-examples = true

[[example]]
name = "bounding_sphere3d"
path = "examples/bounding_sphere3d.rs"
doc-scrape-examples = true

[[example]]
name = "capsule"
path = "examples/capsule.rs"
doc-scrape-examples = true

[[example]]
name = "cone"
path = "examples/cone.rs"
doc-scrape-examples = true

[[example]]
name = "contact_query3d"
path = "examples/contact_query3d.rs"
doc-scrape-examples = true

[[example]]
name = "convex3d"
path = "examples/convex3d.rs"
doc-scrape-examples = true

[[example]]
name = "convex_hull3d"
path = "examples/convex_hull3d.rs"
doc-scrape-examples = true

[[example]]
name = "convex_try_new3d"
path = "examples/convex_try_new3d.rs"
doc-scrape-examples = true

[[example]]
name = "cuboid3d"
path = "examples/cuboid3d.rs"
doc-scrape-examples = true

[[example]]
name = "cylinder"
path = "examples/cylinder.rs"
doc-scrape-examples = true

[[example]]
name = "distance_query3d"
path = "examples/distance_query3d.rs"
doc-scrape-examples = true

[[example]]
name = "getting_started"
path = "examples/getting_started.rs"
doc-scrape-examples = true

[[example]]
name = "mesh3d"
path = "examples/mesh3d.rs"
doc-scrape-examples = true

[[example]]
name = "plane3d"
path = "examples/plane3d.rs"
doc-scrape-examples = true

[[example]]
name = "polyline3d"
path = "examples/polyline3d.rs"
doc-scrape-examples = true

[[example]]
name = "proximity_query3d"
path = "examples/proximity_query3d.rs"
doc-scrape-examples = true

[[example]]
name = "solid_point_query3d"
path = "examples/solid_point_query3d.rs"
doc-scrape-examples = true

[[example]]
name = "solid_ray_cast3d"
path = "examples/solid_ray_cast3d.rs"
doc-scrape-examples = true

[[example]]
name = "time_of_impact_query3d"
path = "examples/time_of_impact_query3d.rs"
doc-scrape-examples = true
4 changes: 4 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cp -r LICENSE README.md $tmp/.

### Publish the 2D version.
sed 's#\.\./\.\./src#src#g' crates/parry2d/Cargo.toml > $tmp/Cargo.toml
rm -rf $tmp/examples
cp -r crates/parry2d/examples $tmp/examples
currdir=`pwd`
cd $tmp && cargo publish
cd $currdir
Expand All @@ -21,6 +23,8 @@ cd $currdir

### Publish the 3D version.
sed 's#\.\./\.\./src#src#g' crates/parry3d/Cargo.toml > $tmp/Cargo.toml
rm -rf $tmp/examples
cp -r crates/parry3d/examples $tmp/examples
cp -r LICENSE README.md $tmp/.
cd $tmp && cargo publish
cd $currdir
Expand Down
1 change: 0 additions & 1 deletion src/utils/hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use indexmap::IndexMap as StdHashMap;
#[cfg(all(not(feature = "enhanced-determinism"), feature = "serde-serialize"))]
use std::collections::HashMap as StdHashMap;

use std::mem::size_of;

/// Serializes only the capacity of a hash-map instead of its actual content.
Expand Down
Loading