Class BoxAligner
Aligns a smaller
BoundingBox
to fit inside a larger BoundingBox
.
The smaller box may also be identically sized as the larger.
This is useful for implementing different methods for aligning / growing a smaller image to occupy a larger space. But it is not specific to images, and can be applied to any bounding-boxes.
Growth never occurs in the z-dimension, and the size in this dimension should be equal for
both smaller
and larger
.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalign
(BoundingBox smaller, BoundingBox larger) align
(Extent smaller, BoundingBox larger) protected abstract BoundingBox
alignAfterCheck
(BoundingBox smaller, BoundingBox larger) protected abstract BoundingBox
alignAfterCheck
(Extent smaller, BoundingBox larger) protected abstract BoundingBox
alignAfterCheck
(Extent smaller, Extent larger) Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
BoxAligner
public BoxAligner()
-
-
Method Details
-
align
Determines aBoundingBox
to use forsmaller
BoundingBox
so that it fits insidelarger
BoundingBox
.The position and size of
smaller
andlarger
must be identical in the z-dimension.- Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if the z-dimensions are not equal, or if an unrecognized parameter or illegal state exists preventing successful alignment.
-
align
Determines aBoundingBox
to use for asmaller
Extent
so that it fits insidelarger
Extent
.The position and size of
smaller
andlarger
must be identical in the z-dimension.- Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if the z-dimensions are not equal, or if an unrecognized parameter or illegal state exists preventing successful alignment.
-
align
Determines aBoundingBox
to use for asmaller
Extent
so that it fits insidelarger
BoundingBox
.The position and size of
smaller
andlarger
must be identical in the z-dimension.- Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if the z-dimensions are not equal, or if an unrecognized parameter or illegal state exists preventing successful alignment.
-
alignAfterCheck
protected abstract BoundingBox alignAfterCheck(BoundingBox smaller, BoundingBox larger) throws OperationFailedException - Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if an unrecognized parameter or illegal state exists preventing successful alignment.
-
alignAfterCheck
protected abstract BoundingBox alignAfterCheck(Extent smaller, Extent larger) throws OperationFailedException - Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if an unrecognized parameter or illegal state exists preventing successful alignment.
-
alignAfterCheck
protected abstract BoundingBox alignAfterCheck(Extent smaller, BoundingBox larger) throws OperationFailedException - Parameters:
smaller
- the smaller bounding-box, relative to the minimum-corner oflarger
. Often this is(0, 0, 0)
if it sits at the minimum corner oflarger
.larger
- the larger bounding-box absolute coordinates.- Returns:
- absolute coordinates for
smaller
, while remaining insidelarger
. - Throws:
OperationFailedException
- if an unrecognized parameter or illegal state exists preventing successful alignment.
-