Skip to content

Use Rotating Calipers algorithm to compute the diameter or minimum area rect of a set of points

Notifications You must be signed in to change notification settings

DreamVersion/RotatingCalipers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RotatingCalipers

Use Rotating Calipers algorithm to compute the diameter or minimum area rect of a set of points.

Usage: diameter

Use Rotating Calipers to compute the diameter of a set of points. Find two points in the set of points which have the longest distance. Using Rotating Calipers can be faster.

	vector<Point> pts;
	double diameter = RotatingCalipers::diameter(pts);

Usage: min area rect

Minimum area rectangle or oriented minimum bounding box, is to find a rectangle to contains all points;

Use the code in opencv.

	vector<Point> pts;
	MinAreaRect res = RotatingCalipers::minAreaRect(its);

MinAreaRect

	struct MinAreaRect
	{
	    double width;
	    double height;
	    double area;
	    double angle_width; 
	    double angle_height;
	    Point center;
	    Point corner;
	    Point vector_width;
	    Point vector_height;
	    vector<Point> rect;
	};

Usage: convexHull

Because Rotating Calipers is based on convexHull, we achieve the convexHull functions.

	vector<Point> pts;
	vector<Point> convex_hull = RotatingCalipers::convexHull(pts);

show

We also write python to show whether the result is right. You need to copy the points to the show.py

About

Use Rotating Calipers algorithm to compute the diameter or minimum area rect of a set of points

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages