src/ccstruct/coutln.cpp
int16_t C_OUTLINE::turn_direction() const { // winding number
  DIR128 prevdir;                           // previous direction
  DIR128 dir;                               // current direction
  int16_t stepindex;                        // index to cstep
  int8_t dirdiff;                           // direction difference
  int16_t count;                            // winding count

  if (stepcount == 0) {
    return 128;
  }
  count = 0;
  prevdir = step_dir(stepcount - 1);
  for (stepindex = 0; stepindex < stepcount; stepindex++) {
    dir = step_dir(stepindex);
    dirdiff = dir - prevdir;
    ASSERT_HOST(dirdiff == 0 || dirdiff == 32 || dirdiff == -32);
    count += dirdiff;
    prevdir = dir;
  }
  ASSERT_HOST(count == 128 || count == -128);
  return count; // winding number
}
/**
 * C_OUTLINE::turn_direction
 *
 * @return the sum direction delta of the outline.
 */
:turn_direction
@return the sum direction delta of the outline.
: turn_direction @return the sum direction delta of the outline .
int16_t C_OUTLINE::turn_direction() const { 
  DIR128 prevdir;                           
  DIR128 dir;                               
  int16_t stepindex;                        
  int8_t dirdiff;                           
  int16_t count;                            
  if (stepcount == 0) {
    return 128;
  }
  count = 0;
  prevdir = step_dir(stepcount - 1);
  for (stepindex = 0; stepindex < stepcount; stepindex++) {
    dir = step_dir(stepindex);
    dirdiff = dir - prevdir;
    ASSERT_HOST(dirdiff == 0 || dirdiff == 32 || dirdiff == -32);
    count += dirdiff;
    prevdir = dir;
  }
  ASSERT_HOST(count == 128 || count == -128);
  return count; 
}
int16_t C_OUTLINE :: turn_direction ( ) const { DIR128 prevdir ; DIR128 dir ; int16_t stepindex ; int8_t dirdiff ; int16_t count ; if ( stepcount == 0 ) { return 128 ; } count = 0 ; prevdir = step_dir ( stepcount - 1 ) ; for ( stepindex = 0 ; stepindex < stepcount ; stepindex ++ ) { dir = step_dir ( stepindex ) ; dirdiff = dir - prevdir ; ASSERT_HOST ( dirdiff == 0 || dirdiff == 32 || dirdiff == -32 ) ; count += dirdiff ; prevdir = dir ; } ASSERT_HOST ( count == 128 || count == -128 ) ; return count ; }
C_OUTLINE::turn_direction
 @return the sum direction delta of the outline.
C_OUTLINE :: turn_direction @return the sum direction delta of the outline .
// winding number // previous direction // current direction // index to cstep // direction difference // winding count // winding number