InscribedRectangle(Edge[], Int32) Constructor

Definition

Finds a large inscribed rectangle. Tries to be maximal but this is best effort. The algorithm used was inspired by the blog post https://d3plus.org/blog/behind-the-scenes/2014/07/08/largest-rect/ Random points within the polygon are chosen, and then 2 lines are drawn through those points. The midpoints of those lines are used as the center of various rectangles, using a binary search to vary the size, until the largest fit-able rectangle is found. This is then repeated for predefined angles (0-180 in steps of 15) and aspect ratios (1 to 15 in steps of 0.5).

C++
public:
 InscribedRectangle(cli::array <Microsoft::MixedReality::Toolkit::Boundary::Edge> ^ geometryEdges, int randomSeed);

Parameters

geometryEdges
Edge[]

The boundary geometry.

randomSeed
Int32

Random number generator seed.

Remarks

For the most reproducible results, use the same randomSeed value each time this method is called.

Applies to

Produto Versións
MRTK2 Unity 2018 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0
MRTK2 Unity 2019 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0
MRTK2 Unity 2020 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0