MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / MakeRandomRectangle

Function MakeRandomRectangle

CPP/Examples/RectClipping/RectClipping.cpp:72–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72Path64 MakeRandomRectangle(int minWidth, int minHeight, int maxWidth, int maxHeight,
73 int maxRight, int maxBottom)
74{
75 int w = maxWidth > minWidth ? minWidth + rand() % (maxWidth - minWidth): minWidth;
76 int h = maxHeight > minHeight ? minHeight + rand() % (maxHeight - minHeight): minHeight;
77 int l = rand() % (maxRight - w);
78 int t = rand() % (maxBottom - h);
79 Path64 result;
80 result.reserve(4);
81 result.push_back(Point64(l, t));
82 result.push_back(Point64(l+w, t));
83 result.push_back(Point64(l+w, t+h));
84 result.push_back(Point64(l, t+h));
85 return result;
86}
87
88void DoRectangles(int cnt)
89{

Callers 1

DoRectanglesFunction · 0.85

Calls 1

Point64Class · 0.85

Tested by

no test coverage detected