src/classify/mfoutline.cpp
void ComputeDirection(MFEDGEPT *Start, MFEDGEPT *Finish, float MinSlope, float MaxSlope) {
  FVECTOR Delta;

  Delta.x = Finish->Point.x - Start->Point.x;
  Delta.y = Finish->Point.y - Start->Point.y;
  if (Delta.x == 0) {
    if (Delta.y < 0) {
      Start->Slope = -FLT_MAX;
      Start->Direction = south;
    } else {
      Start->Slope = FLT_MAX;
      Start->Direction = north;
    }
  } else {
    Start->Slope = Delta.y / Delta.x;
    if (Delta.x > 0) {
      if (Delta.y > 0) {
        if (Start->Slope > MinSlope) {
          if (Start->Slope < MaxSlope) {
            Start->Direction = northeast;
          } else {
            Start->Direction = north;
          }
        } else {
          Start->Direction = east;
        }
      } else if (Start->Slope < -MinSlope) {
        if (Start->Slope > -MaxSlope) {
          Start->Direction = southeast;
        } else {
          Start->Direction = south;
        }
      } else {
        Start->Direction = east;
      }
    } else if (Delta.y > 0) {
      if (Start->Slope < -MinSlope) {
        if (Start->Slope > -MaxSlope) {
          Start->Direction = northwest;
        } else {
          Start->Direction = north;
        }
      } else {
        Start->Direction = west;
      }
    } else if (Start->Slope > MinSlope) {
      if (Start->Slope < MaxSlope) {
        Start->Direction = southwest;
      } else {
        Start->Direction = south;
      }
    } else {
      Start->Direction = west;
    }
  }
  Finish->PreviousDirection = Start->Direction;
}
/**
 * This routine computes the slope from Start to Finish and
 * and then computes the approximate direction of the line
 * segment from Start to Finish.  The direction is quantized
 * into 8 buckets:
 *  N, S, E, W, NE, NW, SE, SW
 * Both the slope and the direction are then stored into
 * the appropriate fields of the Start edge point.  The
 * direction is also stored into the PreviousDirection field
 * of the Finish edge point.
 * @param Start   starting point to compute direction from
 * @param Finish    finishing point to compute direction to
 * @param MinSlope  slope below which lines are horizontal
 * @param MaxSlope  slope above which lines are vertical
 */
This routine computes the slope from Start to Finish and
and then computes the approximate direction of the line
segment from Start to Finish.  The direction is quantized
into 8 buckets:
N, S, E, W, NE, NW, SE, SW
Both the slope and the direction are then stored into
the appropriate fields of the Start edge point.  The
direction is also stored into the PreviousDirection field
of the Finish edge point.
@param Start   starting point to compute direction from
@param Finish    finishing point to compute direction to
@param MinSlope  slope below which lines are horizontal
@param MaxSlope  slope above which lines are vertical
This routine computes the slope from Start to Finish and and then computes the approximate direction of the line segment from Start to Finish . The direction is quantized into 8 buckets : N S E W NE NW SE SW Both the slope and the direction are then stored into the appropriate fields of the Start edge point . The direction is also stored into the PreviousDirection field of the Finish edge point . @param Start starting point to compute direction from @param Finish finishing point to compute direction to @param MinSlope slope below which lines are horizontal @param MaxSlope slope above which lines are vertical
void ComputeDirection(MFEDGEPT *Start, MFEDGEPT *Finish, float MinSlope, float MaxSlope) {
  FVECTOR Delta;
  Delta.x = Finish->Point.x - Start->Point.x;
  Delta.y = Finish->Point.y - Start->Point.y;
  if (Delta.x == 0) {
    if (Delta.y < 0) {
      Start->Slope = -FLT_MAX;
      Start->Direction = south;
    } else {
      Start->Slope = FLT_MAX;
      Start->Direction = north;
    }
  } else {
    Start->Slope = Delta.y / Delta.x;
    if (Delta.x > 0) {
      if (Delta.y > 0) {
        if (Start->Slope > MinSlope) {
          if (Start->Slope < MaxSlope) {
            Start->Direction = northeast;
          } else {
            Start->Direction = north;
          }
        } else {
          Start->Direction = east;
        }
      } else if (Start->Slope < -MinSlope) {
        if (Start->Slope > -MaxSlope) {
          Start->Direction = southeast;
        } else {
          Start->Direction = south;
        }
      } else {
        Start->Direction = east;
      }
    } else if (Delta.y > 0) {
      if (Start->Slope < -MinSlope) {
        if (Start->Slope > -MaxSlope) {
          Start->Direction = northwest;
        } else {
          Start->Direction = north;
        }
      } else {
        Start->Direction = west;
      }
    } else if (Start->Slope > MinSlope) {
      if (Start->Slope < MaxSlope) {
        Start->Direction = southwest;
      } else {
        Start->Direction = south;
      }
    } else {
      Start->Direction = west;
    }
  }
  Finish->PreviousDirection = Start->Direction;
}
void ComputeDirection ( MFEDGEPT * Start , MFEDGEPT * Finish , float MinSlope , float MaxSlope ) { FVECTOR Delta ; Delta . x = Finish -> Point . x - Start -> Point . x ; Delta . y = Finish -> Point . y - Start -> Point . y ; if ( Delta . x == 0 ) { if ( Delta . y < 0 ) { Start -> Slope = - FLT_MAX ; Start -> Direction = south ; } else { Start -> Slope = FLT_MAX ; Start -> Direction = north ; } } else { Start -> Slope = Delta . y / Delta . x ; if ( Delta . x > 0 ) { if ( Delta . y > 0 ) { if ( Start -> Slope > MinSlope ) { if ( Start -> Slope < MaxSlope ) { Start -> Direction = northeast ; } else { Start -> Direction = north ; } } else { Start -> Direction = east ; } } else if ( Start -> Slope < - MinSlope ) { if ( Start -> Slope > - MaxSlope ) { Start -> Direction = southeast ; } else { Start -> Direction = south ; } } else { Start -> Direction = east ; } } else if ( Delta . y > 0 ) { if ( Start -> Slope < - MinSlope ) { if ( Start -> Slope > - MaxSlope ) { Start -> Direction = northwest ; } else { Start -> Direction = north ; } } else { Start -> Direction = west ; } } else if ( Start -> Slope > MinSlope ) { if ( Start -> Slope < MaxSlope ) { Start -> Direction = southwest ; } else { Start -> Direction = south ; } } else { Start -> Direction = west ; } } Finish -> PreviousDirection = Start -> Direction ; }
This routine computes the slope from Start to Finish and
 and then computes the approximate direction of the line
 segment from Start to Finish.
This routine computes the slope from Start to Finish and and then computes the approximate direction of the line segment from Start to Finish .