Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

This is a port of inkandswitch/interactive-shape-recognition, an implementation of "A Simple Approach to Recognise Geometric Shapes Interactively" by Joaquim A. Jorge and Manuel J. Fonseca.

License

Notifications You must be signed in to change notification settings

adil192/interactive_shape_recognition

Repository files navigation

This is a port of inkandswitch/interactive-shape-recognition, an implementation of "A Simple Approach to Recognise Geometric Shapes Interactively" by Joaquim A. Jorge and Manuel J. Fonseca.

See the online demo to see this plugin in action.

Replacement package

I recommend using my new package one_dollar_unistroke_recognizer instead of this one. It is more accurate, faster, and can detect more shapes.

Usage

final List<Offset> points = [
  // your points here, e.g.
  Offset(0, 0),
  Offset(0, 1),
  Offset(0, 2),
];

final DetectedShape detectedShape = detectShape(points);

switch (detectedShape.shape) {
  case Shape.line:
    print('Detected a line');
    final (Offset startPoint, Offset endPoint) = detectedShape.generateLine();
  case Shape.circle:
    print('Detected a circle');
    final (double radius, Offset center) = detectedShape.generateCircle();
  case Shape.rectangle:
    print('Detected a rectangle');
    final Rect rect = detectedShape.generateRectangle();
  case Shape.unknown:
    print('Detected an unknown shape');
}

About

This is a port of inkandswitch/interactive-shape-recognition, an implementation of "A Simple Approach to Recognise Geometric Shapes Interactively" by Joaquim A. Jorge and Manuel J. Fonseca.

Topics

Resources

License

Stars

Watchers

Forks