1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use crate::geometry::shape_views::{CuboidView, CuboidViewMut, TriangleView, TriangleViewMut};
use rapier::geometry::{RoundCuboid, RoundTriangle};
#[cfg(feature = "dim2")]
use {
crate::geometry::shape_views::{ConvexPolygonView, ConvexPolygonViewMut},
rapier::geometry::RoundConvexPolygon,
};
#[cfg(feature = "dim3")]
use {
crate::geometry::shape_views::{
ConeView, ConeViewMut, ConvexPolyhedronView, ConvexPolyhedronViewMut, CylinderView,
CylinderViewMut,
},
rapier::geometry::{RoundCone, RoundConvexPolyhedron, RoundCylinder},
};
macro_rules! round_shape_view(
($RoundShape: ident, $RoundShapeView: ident, $ShapeView: ident, $RoundShapeViewMut: ident, $ShapeViewMut: ident) => {
pub struct $RoundShapeView<'a> {
pub raw: &'a $RoundShape,
}
impl<'a> $RoundShapeView<'a> {
pub fn border_radius(&self) -> f32 {
self.raw.border_radius
}
pub fn inner_shape(&self) -> $ShapeView {
$ShapeView {
raw: &self.raw.inner_shape,
}
}
}
pub struct $RoundShapeViewMut<'a> {
pub raw: &'a mut $RoundShape,
}
impl<'a> $RoundShapeViewMut<'a> {
pub fn border_radius(&self) -> f32 {
self.raw.border_radius
}
pub fn set_border_radius(&mut self, new_border_radius: f32) {
self.raw.border_radius = new_border_radius;
}
pub fn inner_shape(&mut self) -> $ShapeViewMut {
$ShapeViewMut {
raw: &mut self.raw.inner_shape,
}
}
}
}
);
round_shape_view!(
RoundCuboid,
RoundCuboidView,
CuboidView,
RoundCuboidViewMut,
CuboidViewMut
);
round_shape_view!(
RoundTriangle,
RoundTriangleView,
TriangleView,
RoundTriangleViewMut,
TriangleViewMut
);
#[cfg(feature = "dim2")]
round_shape_view!(
RoundConvexPolygon,
RoundConvexPolygonView,
ConvexPolygonView,
RoundConvexPolygonViewMut,
ConvexPolygonViewMut
);
#[cfg(feature = "dim3")]
round_shape_view!(
RoundCone,
RoundConeView,
ConeView,
RoundConeViewMut,
ConeViewMut
);
#[cfg(feature = "dim3")]
round_shape_view!(
RoundCylinder,
RoundCylinderView,
CylinderView,
RoundCylinderViewMut,
CylinderViewMut
);
#[cfg(feature = "dim3")]
round_shape_view!(
RoundConvexPolyhedron,
RoundConvexPolyhedronView,
ConvexPolyhedronView,
RoundConvexPolyhedronViewMut,
ConvexPolyhedronViewMut
);