@@ -7,7 +7,7 @@ use parry3d::math::{Point, Real, Vector};
77use parry3d:: query:: Ray ;
88use parry3d:: shape:: ConvexPolyhedron ;
99use parry3d:: shape:: { Ball , Capsule , Cone , Cuboid , Cylinder , Segment , Triangle } ;
10- use rand:: distributions :: { Distribution , Standard } ;
10+ use rand:: distr :: { Distribution , StandardUniform } ;
1111use rand:: Rng ;
1212
1313pub trait DefaultGen {
@@ -22,7 +22,7 @@ macro_rules! impl_rand_default_gen (
2222 ( $t: ty) => {
2323 impl DefaultGen for $t {
2424 fn generate<R : Rng >( rng: & mut R ) -> $t {
25- rng. gen :: <$t>( )
25+ rng. random :: <$t>( )
2626 }
2727 }
2828 }
@@ -56,101 +56,101 @@ impl_rand_default_gen!(bool);
5656
5757impl DefaultGen for Ball
5858where
59- Standard : Distribution < Real > ,
59+ StandardUniform : Distribution < Real > ,
6060{
6161 fn generate < R : Rng > ( rng : & mut R ) -> Ball {
62- Ball :: new ( rng. gen :: < f32 > ( ) . abs ( ) )
62+ Ball :: new ( rng. random :: < f32 > ( ) . abs ( ) )
6363 }
6464}
6565
6666impl DefaultGen for Cuboid
6767where
68- Standard : Distribution < Vector < Real > > ,
68+ StandardUniform : Distribution < Vector < Real > > ,
6969{
7070 fn generate < R : Rng > ( rng : & mut R ) -> Cuboid {
71- Cuboid :: new ( rng. gen :: < Vector < Real > > ( ) . abs ( ) )
71+ Cuboid :: new ( rng. random :: < Vector < Real > > ( ) . abs ( ) )
7272 }
7373}
7474
7575impl DefaultGen for Capsule
7676where
77- Standard : Distribution < Real > ,
77+ StandardUniform : Distribution < Real > ,
7878{
7979 fn generate < R : Rng > ( rng : & mut R ) -> Capsule {
8080 Capsule :: new (
81- rng. gen :: < Point < Real > > ( ) ,
82- rng. gen :: < Point < Real > > ( ) ,
83- rng. gen :: < Real > ( ) . abs ( ) ,
81+ rng. random :: < Point < Real > > ( ) ,
82+ rng. random :: < Point < Real > > ( ) ,
83+ rng. random :: < Real > ( ) . abs ( ) ,
8484 )
8585 }
8686}
8787
8888impl DefaultGen for Cone
8989where
90- Standard : Distribution < Real > ,
90+ StandardUniform : Distribution < Real > ,
9191{
9292 fn generate < R : Rng > ( rng : & mut R ) -> Cone {
93- Cone :: new ( rng. gen :: < Real > ( ) . abs ( ) , rng. gen :: < Real > ( ) . abs ( ) )
93+ Cone :: new ( rng. random :: < Real > ( ) . abs ( ) , rng. random :: < Real > ( ) . abs ( ) )
9494 }
9595}
9696
9797impl DefaultGen for Cylinder
9898where
99- Standard : Distribution < Real > ,
99+ StandardUniform : Distribution < Real > ,
100100{
101101 fn generate < R : Rng > ( rng : & mut R ) -> Cylinder {
102- Cylinder :: new ( rng. gen :: < Real > ( ) . abs ( ) , rng. gen :: < Real > ( ) . abs ( ) )
102+ Cylinder :: new ( rng. random :: < Real > ( ) . abs ( ) , rng. random :: < Real > ( ) . abs ( ) )
103103 }
104104}
105105
106106impl DefaultGen for Segment
107107where
108- Standard : Distribution < Point < Real > > ,
108+ StandardUniform : Distribution < Point < Real > > ,
109109{
110110 fn generate < R : Rng > ( rng : & mut R ) -> Segment {
111- Segment :: new ( rng. gen ( ) , rng. gen ( ) )
111+ Segment :: new ( rng. random ( ) , rng. random ( ) )
112112 }
113113}
114114
115115impl DefaultGen for Triangle
116116where
117- Standard : Distribution < Point < Real > > ,
117+ StandardUniform : Distribution < Point < Real > > ,
118118{
119119 fn generate < R : Rng > ( rng : & mut R ) -> Triangle {
120- Triangle :: new ( rng. gen ( ) , rng. gen ( ) , rng. gen ( ) )
120+ Triangle :: new ( rng. random ( ) , rng. random ( ) , rng. random ( ) )
121121 }
122122}
123123
124124impl DefaultGen for ConvexPolyhedron
125125where
126- Standard : Distribution < Real > ,
126+ StandardUniform : Distribution < Real > ,
127127{
128128 fn generate < R : Rng > ( rng : & mut R ) -> ConvexPolyhedron {
129129 // It is recommended to have at most 100 points.
130130 // Otherwise, a smarter structure like the DK hierarchy would be needed.
131- let pts: Vec < _ > = ( 0 ..100 ) . map ( |_| rng. gen ( ) ) . collect ( ) ;
131+ let pts: Vec < _ > = ( 0 ..100 ) . map ( |_| rng. random ( ) ) . collect ( ) ;
132132 ConvexPolyhedron :: from_convex_hull ( & pts) . unwrap ( )
133133 }
134134}
135135
136136impl DefaultGen for Ray
137137where
138- Standard : Distribution < Vector < Real > > ,
138+ StandardUniform : Distribution < Vector < Real > > ,
139139{
140140 fn generate < R : Rng > ( rng : & mut R ) -> Ray {
141141 // The generate ray will always point to the origin.
142- let shift = rng. gen :: < Vector < Real > > ( ) * na:: convert :: < _ , Real > ( 10.0f64 ) ;
142+ let shift = rng. random :: < Vector < Real > > ( ) * na:: convert :: < _ , Real > ( 10.0f64 ) ;
143143 Ray :: new ( Point :: origin ( ) + shift, -shift)
144144 }
145145}
146146
147147impl DefaultGen for Aabb
148148where
149- Standard : Distribution < Vector < Real > > ,
149+ StandardUniform : Distribution < Vector < Real > > ,
150150{
151151 fn generate < R : Rng > ( rng : & mut R ) -> Aabb {
152152 // an Aabb centered at the origin.
153- let half_extents = rng. gen :: < Vector < Real > > ( ) . abs ( ) ;
153+ let half_extents = rng. random :: < Vector < Real > > ( ) . abs ( ) ;
154154 Aabb :: new (
155155 Point :: origin ( ) + ( -half_extents) ,
156156 Point :: origin ( ) + half_extents,
@@ -160,10 +160,10 @@ where
160160
161161impl DefaultGen for BoundingSphere
162162where
163- Standard : Distribution < Real > ,
163+ StandardUniform : Distribution < Real > ,
164164{
165165 fn generate < R : Rng > ( rng : & mut R ) -> BoundingSphere {
166166 // a bounding sphere centered at the origin.
167- BoundingSphere :: new ( Point :: origin ( ) , rng. gen :: < Real > ( ) . abs ( ) )
167+ BoundingSphere :: new ( Point :: origin ( ) , rng. random :: < Real > ( ) . abs ( ) )
168168 }
169169}
0 commit comments