public class InnerPlacementBoundaryCalculator extends Object
Constructor and Description |
---|
InnerPlacementBoundaryCalculator() |
Modifier and Type | Method and Description |
---|---|
static Polygon2D |
innerPlacementBoundary(Polygon2D outer,
Polygon2D inner)
Calculates the boundary for placing the inner polygon within the outer polygon.
|
public static Polygon2D innerPlacementBoundary(Polygon2D outer, Polygon2D inner)
Consider an example: Outer is a rectangle with vertices (0, 0), (6, 0), (6, 5), (0, 5). Inner is a square with vertices (-1, -1), (1, -1), (1, 1), (-1, 1). The result would be a rectangle with vertices (1, 1), (5, 1), (5, 4), (1, 4).
If inner does not fit within outer null is returned.
If inner fits exactly within outer, ie. inner can be translated so it is equal to outer, then a 1-gon is returned.
If inner fits exactly within outer in only one of two dimensions, then a 2-gon is returned.
Both inner and outer must have at least three vertices, and must be convex.
outer
- The inner polygon.inner
- The outer polygon.Copyright © 2018. All rights reserved.