@@ -12,9 +12,9 @@ use rustc_hash::FxHashMap;
1212/// [`contour_rings`]: fn.contour_rings.html
1313pub struct ContourBuilder {
1414 /// The number of columns in the grid
15- dx : u32 ,
15+ dx : usize ,
1616 /// The number of rows in the grid
17- dy : u32 ,
17+ dy : usize ,
1818 /// Whether to smooth the contours
1919 smooth : bool ,
2020 /// The horizontal coordinate for the origin of the grid.
@@ -38,7 +38,7 @@ impl ContourBuilder {
3838 /// * `dx` - The number of columns in the grid.
3939 /// * `dy` - The number of rows in the grid.
4040 /// * `smooth` - Whether or not the generated rings will be smoothed using linear interpolation.
41- pub fn new ( dx : u32 , dy : u32 , smooth : bool ) -> Self {
41+ pub fn new ( dx : usize , dy : usize , smooth : bool ) -> Self {
4242 ContourBuilder {
4343 dx,
4444 dy,
@@ -83,8 +83,8 @@ impl ContourBuilder {
8383 . map ( |point| {
8484 let x = point. x ;
8585 let y = point. y ;
86- let xt = x. trunc ( ) as u32 ;
87- let yt = y. trunc ( ) as u32 ;
86+ let xt = x. trunc ( ) as usize ;
87+ let yt = y. trunc ( ) as usize ;
8888 let mut v0;
8989 let ix = ( yt * dx + xt) as usize ;
9090 if ix < len_values {
@@ -112,7 +112,7 @@ impl ContourBuilder {
112112 /// * `values` - The slice of values to be used.
113113 /// * `thresholds` - The slice of thresholds values to be used.
114114 pub fn lines ( & self , values : & [ Float ] , thresholds : & [ Float ] ) -> Result < Vec < Line > > {
115- if values. len ( ) as u32 != self . dx * self . dy {
115+ if values. len ( ) != self . dx * self . dy {
116116 return Err ( new_error ( ErrorKind :: BadDimension ) ) ;
117117 }
118118 let mut isoring = IsoRingBuilder :: new ( self . dx , self . dy ) ;
@@ -163,7 +163,7 @@ impl ContourBuilder {
163163 /// * `values` - The slice of values to be used.
164164 /// * `thresholds` - The slice of thresholds values to be used.
165165 pub fn contours ( & self , values : & [ Float ] , thresholds : & [ Float ] ) -> Result < Vec < Contour > > {
166- if values. len ( ) as u32 != self . dx * self . dy {
166+ if values. len ( ) != self . dx * self . dy {
167167 return Err ( new_error ( ErrorKind :: BadDimension ) ) ;
168168 }
169169 let mut isoring = IsoRingBuilder :: new ( self . dx , self . dy ) ;
@@ -232,7 +232,7 @@ impl ContourBuilder {
232232 // We will compute rings as previously, but we will
233233 // iterate over the contours in pairs and use the paths from the lower threshold
234234 // and the path from the upper threshold to create the isoband.
235- if values. len ( ) as u32 != self . dx * self . dy {
235+ if values. len ( ) != self . dx * self . dy {
236236 return Err ( new_error ( ErrorKind :: BadDimension ) ) ;
237237 }
238238 if thresholds. len ( ) < 2 {
0 commit comments