convex_hull 1.1.2 copy "convex_hull: ^1.1.2" to clipboard
convex_hull: ^1.1.2 copied to clipboard

Calculates the convex hull of a given set of points. Monotone chain is used as algorithm.

example/convex_hull_example.dart

import 'package:convex_hull/convex_hull.dart';

class Example {
  final double xCoordinate;
  final double yCoordinate;
  final String info;

  const Example(this.xCoordinate, this.yCoordinate, this.info);
}

void main() {
  final points = <Example>[
    Example(0.0, 0.0, "1"),
    Example(2.0, 0.0, "2"),
    Example(2.0, 2.0, "3"),
    Example(0.0, 2.0, "6"),
    Example(1.0, 1.0, "f1"), // lies within convex hull
  ];

  convexHull<Example>(points, x: (e) => e.xCoordinate, y: (e) => e.yCoordinate);
  // > [Example(0.0, 0.0, "1"), Example(2.0, 0.0, "2"), Example(2.0, 2.0, "3"), Example(0.0, 2.0, "6")]
}
2
likes
160
pub points
77%
popularity

Publisher

unverified uploader

Calculates the convex hull of a given set of points. Monotone chain is used as algorithm.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

logging

More

Packages that depend on convex_hull