Bicycle comparison

Published

July 23, 2023

The three bikes

Points to be represented

  • front axis
  • back axis
  • front beginning of tire
  • back beginning of tire
  • handlebar low
  • handlebar high
  • saddle front
  • saddle back
  • pedals

Coordinate system: Point 1 is front axis, point 2 is back of saddle.

loc_names <- c('front_axis',
               'back_axis',
               'front_beginning_of_tire',
               'back_beginning_of_tire',
               'handlebar_low',
               'handlebar_high',
               'saddle_front',
               'saddle_back',
               'pedals')

library('digitize')
load('not_yet_formatted.Rdata')
# save(list = c('koga_new', 'koga_old', 'hammerbacher'), file = 'not_yet_formatted.Rdata')
# help(package = 'digitize')
# koga_old <- digitize('koga_old.jpeg')
# koga_new <- digitize('koga_new.jpeg')
# hammerbacher <- digitize('hammerbacher.jpeg')
# 


tidy_digit <- function(dat) {
  var_name <-deparse(substitute(dat))
  dat |> 
    as_tibble() |> 
    mutate(var_name = var_name,
           loc = loc_names)
}


tidy_digit(koga_new)
# A tibble: 9 × 4
         x        y var_name loc                    
     <dbl>    <dbl> <chr>    <chr>                  
1 -0.00334 -0.00309 koga_new front_axis             
2  1.07     0.0401  koga_new back_axis              
3 -0.321   -0.0679  koga_new front_beginning_of_tire
4  1.08    -0.383   koga_new back_beginning_of_tire 
5  0.207    1.02    koga_new handlebar_low          
6  0.0870   1.12    koga_new handlebar_high         
7  0.722    0.978   koga_new saddle_front           
8  0.997    0.994   koga_new saddle_back            
9  0.622   -0.0432  koga_new pedals                 
tidy_digit(koga_old)
# A tibble: 9 × 4
          x        y var_name loc                    
      <dbl>    <dbl> <chr>    <chr>                  
1  3.33e-16 -0.00317 koga_old front_axis             
2  1.14e+ 0  0.0190  koga_old back_axis              
3 -3.33e- 1  0.0254  koga_old front_beginning_of_tire
4  1.15e+ 0 -0.410   koga_old back_beginning_of_tire 
5  2.46e- 1  1.03    koga_old handlebar_low          
6  1.01e- 1  1.19    koga_old handlebar_high         
7  7.25e- 1  0.952   koga_old saddle_front           
8  9.96e- 1  0.997   koga_old saddle_back            
9  6.63e- 1 -0.0698  koga_old pedals                 
tidy_digit(hammerbacher)
# A tibble: 9 × 4
         x        y var_name     loc                    
     <dbl>    <dbl> <chr>        <chr>                  
1  0.00376  0.00599 hammerbacher front_axis             
2  1.20     0.0659  hammerbacher back_axis              
3 -0.331   -0.150   hammerbacher front_beginning_of_tire
4  0.932   -0.275   hammerbacher back_beginning_of_tire 
5  0.256    1.32    hammerbacher handlebar_low          
6  0.256    1.32    hammerbacher handlebar_high         
7  0.737    0.946   hammerbacher saddle_front           
8  0.996    0.994   hammerbacher saddle_back            
9  0.695   -0.0419  hammerbacher pedals                 
dd <- bind_rows(tidy_digit(koga_old), 
          tidy_digit(koga_new),
          tidy_digit(hammerbacher))

dd |> 
  ggplot(aes(x, y, color = var_name)) +
  geom_point()

write_csv(dd, 'bikes.csv')

Todo:

  • measure distance between axes
  • measure distance between