Skip to content

Commit 7155e57

Browse files
authored
Merge pull request #149 from waywardmonkeys/doc-improvements
Doc improvements
2 parents 97fd1b2 + b973958 commit 7155e57

File tree

21 files changed

+82
-78
lines changed

21 files changed

+82
-78
lines changed

crates/parry2d/tests/geometry/ray_cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn collinear_raycast_starting_on_segment() {
3434
}
3535

3636
#[test]
37-
fn collinear_raycast_starting_bellow_segment() {
37+
fn collinear_raycast_starting_below_segment() {
3838
let m1 = Isometry2::identity();
3939
let ray = Ray::new(Point2::new(0.0, -2.0), Vector2::new(0.0, 1.0));
4040
let seg = Segment::new(Point2::new(0.0, 1.0), Point2::new(0.0, -1.0));
@@ -84,7 +84,7 @@ fn perpendicular_raycast_starting_above_segment() {
8484
}
8585

8686
#[test]
87-
fn perpendicular_raycast_starting_bellow_segment() {
87+
fn perpendicular_raycast_starting_below_segment() {
8888
let segment = Segment::new(Point2::new(0.0f32, -10.0), Point2::new(0.0, 10.0));
8989
let ray = Ray::new(Point2::new(0.0, -11.0), Vector2::new(1.0, 0.0));
9090
assert!(!segment.intersects_local_ray(&ray, std::f32::MAX));

src/bounding_volume/aabb.rs

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ pub struct Aabb {
3131
}
3232

3333
impl Aabb {
34-
/// The vertex indices of each edge of this Aabb.
34+
/// The vertex indices of each edge of this `Aabb`.
3535
///
36-
/// This gives, for each edge of this Aabb, the indices of its
36+
/// This gives, for each edge of this `Aabb`, the indices of its
3737
/// vertices when taken from the `self.vertices()` array.
3838
/// Here is how the faces are numbered, assuming
3939
/// a right-handed coordinate system:
4040
///
41+
/// ```text
4142
/// y 3 - 2
4243
/// | 7 − 6 |
43-
/// ___ x | | 1 (the zero is bellow 3 and on the left of 1, hidden by the 4-5-6-7 face.)
44-
/// / 4 - 5
44+
/// ___ x | | 1 (the zero is below 3 and on the left of 1,
45+
/// / 4 - 5 hidden by the 4-5-6-7 face.)
4546
/// z
47+
/// ```
4648
#[cfg(feature = "dim3")]
4749
pub const EDGES_VERTEX_IDS: [(usize, usize); 12] = [
4850
(0, 1),
@@ -59,18 +61,20 @@ impl Aabb {
5961
(3, 7),
6062
];
6163

62-
/// The vertex indices of each face of this Aabb.
64+
/// The vertex indices of each face of this `Aabb`.
6365
///
64-
/// This gives, for each face of this Aabb, the indices of its
66+
/// This gives, for each face of this `Aabb`, the indices of its
6567
/// vertices when taken from the `self.vertices()` array.
6668
/// Here is how the faces are numbered, assuming
6769
/// a right-handed coordinate system:
6870
///
71+
/// ```text
6972
/// y 3 - 2
7073
/// | 7 − 6 |
71-
/// ___ x | | 1 (the zero is bellow 3 and on the left of 1, hidden by the 4-5-6-7 face.)
72-
/// / 4 - 5
74+
/// ___ x | | 1 (the zero is below 3 and on the left of 1,
75+
/// / 4 - 5 hidden by the 4-5-6-7 face.)
7376
/// z
77+
/// ```
7478
#[cfg(feature = "dim3")]
7579
pub const FACES_VERTEX_IDS: [(usize, usize, usize, usize); 6] = [
7680
(1, 2, 6, 5),
@@ -92,9 +96,9 @@ impl Aabb {
9296
Aabb { mins, maxs }
9397
}
9498

95-
/// Creates an invalid Aabb with `mins` components set to `Real::max_values` and `maxs`components set to `-Real::max_values`.
99+
/// Creates an invalid `Aabb` with `mins` components set to `Real::max_values` and `maxs`components set to `-Real::max_values`.
96100
///
97-
/// This is often used as the initial values of some Aabb merging algorithms.
101+
/// This is often used as the initial values of some `Aabb` merging algorithms.
98102
#[inline]
99103
pub fn new_invalid() -> Self {
100104
Self::new(
@@ -103,34 +107,34 @@ impl Aabb {
103107
)
104108
}
105109

106-
/// Creates a new Aabb from its center and its half-extents.
110+
/// Creates a new `Aabb` from its center and its half-extents.
107111
#[inline]
108112
pub fn from_half_extents(center: Point<Real>, half_extents: Vector<Real>) -> Self {
109113
Self::new(center - half_extents, center + half_extents)
110114
}
111115

112-
/// Creates a new Aabb from a set of points.
116+
/// Creates a new `Aabb` from a set of points.
113117
pub fn from_points<'a, I>(pts: I) -> Self
114118
where
115119
I: IntoIterator<Item = &'a Point<Real>>,
116120
{
117121
super::aabb_utils::local_point_cloud_aabb(pts)
118122
}
119123

120-
/// The center of this Aabb.
124+
/// The center of this `Aabb`.
121125
#[inline]
122126
pub fn center(&self) -> Point<Real> {
123127
na::center(&self.mins, &self.maxs)
124128
}
125129

126-
/// The half extents of this Aabb.
130+
/// The half extents of this `Aabb`.
127131
#[inline]
128132
pub fn half_extents(&self) -> Vector<Real> {
129133
let half: Real = na::convert::<f64, Real>(0.5);
130134
(self.maxs - self.mins) * half
131135
}
132136

133-
/// The volume of this Aabb.
137+
/// The volume of this `Aabb`.
134138
#[inline]
135139
pub fn volume(&self) -> Real {
136140
let extents = self.extents();
@@ -140,19 +144,19 @@ impl Aabb {
140144
return extents.x * extents.y * extents.z;
141145
}
142146

143-
/// The extents of this Aabb.
147+
/// The extents of this `Aabb`.
144148
#[inline]
145149
pub fn extents(&self) -> Vector<Real> {
146150
self.maxs - self.mins
147151
}
148152

149-
/// Enlarges this Aabb so it also contains the point `pt`.
153+
/// Enlarges this `Aabb` so it also contains the point `pt`.
150154
pub fn take_point(&mut self, pt: Point<Real>) {
151155
self.mins = self.mins.coords.inf(&pt.coords).into();
152156
self.maxs = self.maxs.coords.sup(&pt.coords).into();
153157
}
154158

155-
/// Computes the Aabb bounding `self` transformed by `m`.
159+
/// Computes the `Aabb` bounding `self` transformed by `m`.
156160
#[inline]
157161
pub fn transform_by(&self, m: &Isometry<Real>) -> Self {
158162
let ls_center = self.center();
@@ -172,7 +176,7 @@ impl Aabb {
172176
}
173177
}
174178

175-
/// The smallest bounding sphere containing this Aabb.
179+
/// The smallest bounding sphere containing this `Aabb`.
176180
#[inline]
177181
pub fn bounding_sphere(&self) -> BoundingSphere {
178182
let center = self.center();
@@ -191,7 +195,7 @@ impl Aabb {
191195
true
192196
}
193197

194-
/// Computes the intersection of this Aabb and another one.
198+
/// Computes the intersection of this `Aabb` and another one.
195199
pub fn intersection(&self, other: &Aabb) -> Option<Aabb> {
196200
let result = Aabb {
197201
mins: Point::from(self.mins.coords.sup(&other.mins.coords)),
@@ -207,17 +211,17 @@ impl Aabb {
207211
Some(result)
208212
}
209213

210-
/// Returns the difference between this Aabb and `rhs`.
214+
/// Returns the difference between this `Aabb` and `rhs`.
211215
///
212-
/// Removing another Aabb from `self` will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
216+
/// Removing another `Aabb` from `self` will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
213217
/// new smaller Aabbs.
214218
pub fn difference(&self, rhs: &Aabb) -> ArrayVec<Self, TWO_DIM> {
215219
self.difference_with_cut_sequence(rhs).0
216220
}
217221

218-
/// Returns the difference between this Aabb and `rhs`.
222+
/// Returns the difference between this `Aabb` and `rhs`.
219223
///
220-
/// Removing another Aabb from `self` will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
224+
/// Removing another `Aabb` from `self` will result in zero, one, or up to 4 (in 2D) or 8 (in 3D)
221225
/// new smaller Aabbs.
222226
///
223227
/// # Return
@@ -272,7 +276,7 @@ impl Aabb {
272276
(result, cut_sequence)
273277
}
274278

275-
/// Computes the vertices of this Aabb.
279+
/// Computes the vertices of this `Aabb`.
276280
#[inline]
277281
#[cfg(feature = "dim2")]
278282
pub fn vertices(&self) -> [Point<Real>; 4] {
@@ -284,7 +288,7 @@ impl Aabb {
284288
]
285289
}
286290

287-
/// Computes the vertices of this Aabb.
291+
/// Computes the vertices of this `Aabb`.
288292
#[inline]
289293
#[cfg(feature = "dim3")]
290294
pub fn vertices(&self) -> [Point<Real>; 8] {
@@ -300,7 +304,7 @@ impl Aabb {
300304
]
301305
}
302306

303-
/// Splits this Aabb at its center, into four parts (as in a quad-tree).
307+
/// Splits this `Aabb` at its center, into four parts (as in a quad-tree).
304308
#[inline]
305309
#[cfg(feature = "dim2")]
306310
pub fn split_at_center(&self) -> [Aabb; 4] {
@@ -320,7 +324,7 @@ impl Aabb {
320324
]
321325
}
322326

323-
/// Splits this Aabb at its center, into height parts (as in an octree).
327+
/// Splits this `Aabb` at its center, into eight parts (as in an octree).
324328
#[inline]
325329
#[cfg(feature = "dim3")]
326330
pub fn split_at_center(&self) -> [Aabb; 8] {
@@ -362,7 +366,7 @@ impl Aabb {
362366
]
363367
}
364368

365-
/// Projects every point of Aabb on an arbitrary axis.
369+
/// Projects every point of `Aabb` on an arbitrary axis.
366370
pub fn project_on_axis(&self, axis: &UnitVector<Real>) -> (Real, Real) {
367371
let cuboid = Cuboid::new(self.half_extents());
368372
let shift = cuboid

src/bounding_volume/aabb_ball.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ pub fn local_ball_aabb(radius: Real) -> Aabb {
2020
}
2121

2222
impl Ball {
23-
/// Computes the world-space Aabb of this ball transformed by `pos`.
23+
/// Computes the world-space [`Aabb`] of this ball transformed by `pos`.
2424
#[inline]
2525
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
2626
ball_aabb(&Point::<Real>::from(pos.translation.vector), self.radius)
2727
}
2828

29-
/// Computes the local-space Aabb of this ball.
29+
/// Computes the local-space [`Aabb`] of this ball.
3030
#[inline]
3131
pub fn local_aabb(&self) -> Aabb {
3232
local_ball_aabb(self.radius)

src/bounding_volume/aabb_convex_polygon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use crate::math::{Isometry, Real};
33
use crate::shape::ConvexPolygon;
44

55
impl ConvexPolygon {
6-
/// Computes the world-space Aabb of this convex polygon, transformed by `pos`.
6+
/// Computes the world-space [`Aabb`] of this convex polygon, transformed by `pos`.
77
#[inline]
88
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
99
super::details::point_cloud_aabb(pos, self.points())
1010
}
1111

12-
/// Computes the local-space Aabb of this convex polygon.
12+
/// Computes the local-space [`Aabb`] of this convex polygon.
1313
#[inline]
1414
pub fn local_aabb(&self) -> Aabb {
1515
super::details::local_point_cloud_aabb(self.points())

src/bounding_volume/aabb_convex_polyhedron.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use crate::math::{Isometry, Real};
33
use crate::shape::ConvexPolyhedron;
44

55
impl ConvexPolyhedron {
6-
/// Computes the world-space Aabb of this convex polyhedron, transformed by `pos`.
6+
/// Computes the world-space [`Aabb`] of this convex polyhedron, transformed by `pos`.
77
#[inline]
88
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
99
super::details::point_cloud_aabb(pos, self.points())
1010
}
1111

12-
/// Computes the local-space Aabb of this convex polyhedron.
12+
/// Computes the local-space [`Aabb`] of this convex polyhedron.
1313
#[inline]
1414
pub fn local_aabb(&self) -> Aabb {
1515
super::details::local_point_cloud_aabb(self.points())

src/bounding_volume/aabb_cuboid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::shape::Cuboid;
44
use crate::utils::IsometryOps;
55

66
impl Cuboid {
7-
/// Computes the world-space Aabb of this cuboid, transformed by `pos`.
7+
/// Computes the world-space [`Aabb`] of this cuboid, transformed by `pos`.
88
#[inline]
99
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
1010
let center = Point::from(pos.translation.vector);
@@ -13,7 +13,7 @@ impl Cuboid {
1313
Aabb::from_half_extents(center, ws_half_extents)
1414
}
1515

16-
/// Computes the local-space Aabb of this cuboid.
16+
/// Computes the local-space [`Aabb`] of this cuboid.
1717
#[inline]
1818
pub fn local_aabb(&self) -> Aabb {
1919
let half_extents = Point::from(self.half_extents);

src/bounding_volume/aabb_halfspace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use crate::shape::HalfSpace;
55
use na;
66

77
impl HalfSpace {
8-
/// Computes the world-space Aabb of this half-space.
8+
/// Computes the world-space [`Aabb`] of this half-space.
99
#[inline]
1010
pub fn aabb(&self, _pos: &Isometry<Real>) -> Aabb {
1111
self.local_aabb()
1212
}
1313

14-
/// Computes the local-space Aabb of this half-space.
14+
/// Computes the local-space [`Aabb`] of this half-space.
1515
#[inline]
1616
pub fn local_aabb(&self) -> Aabb {
1717
// We divide by 2.0 so that we can still make some operations with it (like loosening)

src/bounding_volume/aabb_heightfield.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use crate::math::{Isometry, Real};
33
use crate::shape::{GenericHeightField, HeightFieldStorage};
44

55
impl<Storage: HeightFieldStorage> GenericHeightField<Storage> {
6-
/// Computes the world-space Aabb of this heightfield, transformed by `pos`.
6+
/// Computes the world-space [`Aabb`] of this heightfield, transformed by `pos`.
77
#[inline]
88
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
99
self.root_aabb().transform_by(pos)
1010
}
1111

12-
/// Computes the local-space Aabb of this heightfield.
12+
/// Computes the local-space [`Aabb`] of this heightfield.
1313
#[inline]
1414
pub fn local_aabb(&self) -> Aabb {
1515
self.root_aabb().clone()

src/bounding_volume/aabb_support_map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use crate::shape::{Cone, Cylinder};
77

88
#[cfg(feature = "dim3")]
99
impl Cone {
10-
/// Computes the world-space Aabb of this cone, transformed by `pos`.
10+
/// Computes the world-space [`Aabb`] of this cone, transformed by `pos`.
1111
#[inline]
1212
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
1313
bounding_volume::details::support_map_aabb(pos, self)
1414
}
1515

16-
/// Computes the local-space Aabb of this cone.
16+
/// Computes the local-space [`Aabb`] of this cone.
1717
#[inline]
1818
pub fn local_aabb(&self) -> Aabb {
1919
bounding_volume::details::local_support_map_aabb(self)
@@ -22,27 +22,27 @@ impl Cone {
2222

2323
#[cfg(feature = "dim3")]
2424
impl Cylinder {
25-
/// Computes the world-space Aabb of this cylinder, transformed by `pos`.
25+
/// Computes the world-space [`Aabb`] of this cylinder, transformed by `pos`.
2626
#[inline]
2727
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
2828
bounding_volume::details::support_map_aabb(pos, self)
2929
}
3030

31-
/// Computes the local-space Aabb of this cylinder.
31+
/// Computes the local-space [`Aabb`] of this cylinder.
3232
#[inline]
3333
pub fn local_aabb(&self) -> Aabb {
3434
bounding_volume::details::local_support_map_aabb(self)
3535
}
3636
}
3737

3838
impl Segment {
39-
/// Computes the world-space Aabb of this segment, transformed by `pos`.
39+
/// Computes the world-space [`Aabb`] of this segment, transformed by `pos`.
4040
#[inline]
4141
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
4242
self.transformed(pos).local_aabb()
4343
}
4444

45-
/// Computes the local-space Aabb of this segment.
45+
/// Computes the local-space [`Aabb`] of this segment.
4646
#[inline]
4747
pub fn local_aabb(&self) -> Aabb {
4848
bounding_volume::details::local_support_map_aabb(self)

src/bounding_volume/aabb_triangle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use crate::{
55
};
66

77
impl Triangle {
8-
/// Computes the world-space Aabb of this triangle, transformed by `pos`.
8+
/// Computes the world-space [`Aabb`] of this triangle, transformed by `pos`.
99
#[inline]
1010
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
1111
self.transformed(pos).local_aabb()
1212
}
1313

14-
/// Computes the local-space Aabb of this triangle.
14+
/// Computes the local-space [`Aabb`] of this triangle.
1515
#[inline]
1616
pub fn local_aabb(&self) -> Aabb {
1717
let a = self.a.coords;

0 commit comments

Comments
 (0)