com.swfm.mica.core
Class MiBounds
java.lang.Object
com.swfm.mica.core.MiBounds
- All Implemented Interfaces:
- MiiTypes
- public class MiBounds
- extends java.lang.Object
- implements MiiTypes
This class represents a rectangular area and is heavily used by Mica, typically
whereever the dimensions of an area is needed.
The bounds of this class can be in an uninitilized state (reversed) in
which case xmin < xmax and ymin < ymax. This can be tested for by calling
the method #isReversed.
For very time or memory sensitive applications, there is a explicitly-accessed
allocation pool to prevent the inevitable overhead of allocating and deallocating
many instances of MiBounds (see #newBounds).
- Version:
- %I% %G%
- Author:
- Michael L. Davis
|
Method Summary |
void |
accumulateMaxWidthAndHeight(MiBounds bounds)
|
void |
accumulateMaxWidthAndHeight(MiSize size)
|
void |
addHeight(double h)
|
MiBounds |
addMargins(double margin)
|
MiBounds |
addMargins(double left,
double bottom,
double right,
double top)
|
MiBounds |
addMargins(MiMargins margin)
|
void |
addWidth(double w)
|
void |
assureMinsLessThanMaxs()
|
void |
confineInsideContainer(MiBounds container)
|
boolean |
confineInsideContainer(MiBounds container,
MiVector proposedDelta)
|
boolean |
contains(MiBounds part)
|
MiBounds |
copy(MiBounds ext)
|
boolean |
coversMoreAreaThan(MiBounds other)
|
boolean |
equals(double xmin,
double ymin,
double xmax,
double ymax)
|
boolean |
equals(MiBounds other)
|
boolean |
equalsIntegerSize(MiBounds other)
|
boolean |
equalsSize(MiBounds other)
|
MiBounds |
expandIntoASquare()
|
void |
getBounds(MiBounds bounds)
|
MiPoint |
getCenter()
|
MiPoint |
getCenter(MiPoint pt)
|
double |
getCenterX()
|
double |
getCenterY()
|
int |
getClosestCommonPoint(MiPoint location,
MiPoint connPtLocation)
|
double |
getDistanceSquaredToClosestEdge(MiPoint pt)
|
double |
getHeight()
|
boolean |
getIntersectionWithLine(MiPoint insidePoint,
MiPoint otherPoint,
MiPoint returnedIntersectionPoint)
|
MiPoint |
getLLCorner()
|
MiPoint |
getLLCorner(MiPoint ll)
|
MiPoint |
getLocationOfCommonPoint(int connPtNum,
MiPoint point)
|
MiPoint |
getLRCorner()
|
MiSize |
getSize()
|
MiPoint |
getULCorner()
|
MiPoint |
getURCorner()
|
MiPoint |
getURCorner(MiPoint ur)
|
double |
getWidth()
|
double |
getXmax()
|
double |
getXmin()
|
double |
getYmax()
|
double |
getYmin()
|
boolean |
intersectionWith(MiBounds bounds)
|
boolean |
intersects(double x,
double y)
|
boolean |
intersects(double xmin,
double ymin,
double xmax,
double ymax)
|
boolean |
intersects(MiBounds bounds)
|
boolean |
intersects(MiPoint point)
|
boolean |
intersectsIncludingEdges(MiBounds bounds)
|
boolean |
intersectsIncludingFuzzyEdges(MiBounds bounds)
|
boolean |
intersectsLine(double x1,
double y1,
double x2,
double y2)
|
boolean |
intersectsLine(double x1,
double y1,
double x2,
double y2,
double lWidth)
|
boolean |
isContainedIn(MiBounds container)
|
boolean |
isLargerSizeThan(MiBounds other)
|
boolean |
isLargerSizeThan(MiSize other)
|
boolean |
isReversed()
|
boolean |
isReversedHeight()
|
boolean |
isReversedWidth()
|
boolean |
isSmallerSizeThan(MiBounds other)
|
boolean |
isSmallerSizeThan(MiSize other)
|
boolean |
pointIsInside(MiPoint pt,
double amountInside)
|
void |
positionInsideContainer(MiBounds container)
|
void |
reverse()
|
void |
scale(double scalex,
double scaley)
|
void |
scale(MiScale scale)
|
void |
setBounds(double xmin,
double ymin,
double xmax,
double ymax)
|
void |
setBounds(MiBounds ext)
|
void |
setBounds(MiPoint pt)
|
void |
setBounds(MiPoint ll,
MiPoint ur)
|
void |
setCenter(double x,
double y)
|
void |
setCenter(MiPoint pt)
|
void |
setCenterX(double x)
|
void |
setCenterY(double y)
|
void |
setHeight(double h)
|
void |
setLLCorner(MiPoint pt)
|
void |
setLocationOfCommonPoint(int connPtNum,
MiPoint point)
|
void |
setSize(double width,
double height)
|
void |
setSize(MiBounds size)
|
void |
setSize(MiSize size)
|
void |
setURCorner(MiPoint pt)
|
void |
setWidth(double w)
|
void |
setXmax(double xmax)
|
void |
setXmin(double xmin)
|
void |
setYmax(double ymax)
|
void |
setYmin(double ymin)
|
MiBounds |
shrinkIntoASquare()
|
void |
subtractHeight(double h)
|
MiBounds |
subtractMargins(double margin)
|
MiBounds |
subtractMargins(MiMargins margin)
|
void |
subtractWidth(double w)
|
java.lang.String |
toSizeString()
|
java.lang.String |
toString()
|
MiBounds |
translate(double tx,
double ty)
|
MiBounds |
translate(MiVector v)
|
void |
translateCenterTo(MiPoint point)
|
void |
translateLLCornerTo(MiPoint point)
|
void |
translateLocationOfCommonPointTo(int connPtNum,
MiPoint point)
|
void |
translateLRCornerTo(MiPoint point)
|
void |
translateULCornerTo(MiPoint point)
|
void |
translateURCornerTo(MiPoint point)
|
void |
translateXmax(double tx)
|
void |
translateXmaxTo(double xmax)
|
void |
translateXmin(double tx)
|
void |
translateXminTo(double xmin)
|
void |
translateYmax(double ty)
|
void |
translateYmaxTo(double ymax)
|
void |
translateYmin(double ty)
|
void |
translateYminTo(double ymin)
|
MiBounds |
union(double x,
double y)
|
MiBounds |
union(double xmin,
double ymin,
double xmax,
double ymax)
|
MiBounds |
union(MiBounds bounds)
|
MiBounds |
union(MiPoint point)
|
boolean |
validate()
|
void |
zeroOut()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
xmin
public double xmin
ymin
public double ymin
xmax
public double xmax
ymax
public double ymax
MiBounds
public MiBounds()
MiBounds
public MiBounds(MiBounds bounds)
MiBounds
public MiBounds(MiPoint point)
MiBounds
public MiBounds(MiSize size)
MiBounds
public MiBounds(double x1,
double y1,
double x2,
double y2)
zeroOut
public void zeroOut()
getXmin
public double getXmin()
getYmin
public double getYmin()
getXmax
public double getXmax()
getYmax
public double getYmax()
setXmin
public void setXmin(double xmin)
setYmin
public void setYmin(double ymin)
setXmax
public void setXmax(double xmax)
setYmax
public void setYmax(double ymax)
translateXminTo
public void translateXminTo(double xmin)
translateYminTo
public void translateYminTo(double ymin)
translateXmaxTo
public void translateXmaxTo(double xmax)
translateYmaxTo
public void translateYmaxTo(double ymax)
translateXmin
public void translateXmin(double tx)
translateYmin
public void translateYmin(double ty)
translateXmax
public void translateXmax(double tx)
translateYmax
public void translateYmax(double ty)
getWidth
public final double getWidth()
getHeight
public final double getHeight()
setWidth
public void setWidth(double w)
addWidth
public void addWidth(double w)
subtractWidth
public void subtractWidth(double w)
setHeight
public void setHeight(double h)
addHeight
public void addHeight(double h)
subtractHeight
public void subtractHeight(double h)
getCenterX
public double getCenterX()
getCenterY
public double getCenterY()
getCenter
public MiPoint getCenter()
getCenter
public MiPoint getCenter(MiPoint pt)
setCenter
public void setCenter(double x,
double y)
setCenter
public void setCenter(MiPoint pt)
setCenterX
public void setCenterX(double x)
setCenterY
public void setCenterY(double y)
getLLCorner
public MiPoint getLLCorner()
getURCorner
public MiPoint getURCorner()
getLRCorner
public MiPoint getLRCorner()
getULCorner
public MiPoint getULCorner()
getLLCorner
public MiPoint getLLCorner(MiPoint ll)
getURCorner
public MiPoint getURCorner(MiPoint ur)
setLLCorner
public void setLLCorner(MiPoint pt)
setURCorner
public void setURCorner(MiPoint pt)
translateLRCornerTo
public void translateLRCornerTo(MiPoint point)
translateLLCornerTo
public void translateLLCornerTo(MiPoint point)
translateURCornerTo
public void translateURCornerTo(MiPoint point)
translateULCornerTo
public void translateULCornerTo(MiPoint point)
translateCenterTo
public void translateCenterTo(MiPoint point)
translate
public MiBounds translate(double tx,
double ty)
translate
public MiBounds translate(MiVector v)
coversMoreAreaThan
public boolean coversMoreAreaThan(MiBounds other)
setBounds
public void setBounds(double xmin,
double ymin,
double xmax,
double ymax)
setBounds
public void setBounds(MiPoint pt)
setBounds
public void setBounds(MiPoint ll,
MiPoint ur)
setBounds
public void setBounds(MiBounds ext)
setSize
public void setSize(double width,
double height)
setSize
public void setSize(MiBounds size)
setSize
public void setSize(MiSize size)
getSize
public MiSize getSize()
copy
public MiBounds copy(MiBounds ext)
getBounds
public void getBounds(MiBounds bounds)
addMargins
public MiBounds addMargins(MiMargins margin)
addMargins
public MiBounds addMargins(double left,
double bottom,
double right,
double top)
subtractMargins
public MiBounds subtractMargins(MiMargins margin)
addMargins
public MiBounds addMargins(double margin)
subtractMargins
public MiBounds subtractMargins(double margin)
intersects
public boolean intersects(MiBounds bounds)
intersects
public boolean intersects(double xmin,
double ymin,
double xmax,
double ymax)
intersectsIncludingEdges
public boolean intersectsIncludingEdges(MiBounds bounds)
intersectsIncludingFuzzyEdges
public boolean intersectsIncludingFuzzyEdges(MiBounds bounds)
intersects
public boolean intersects(double x,
double y)
intersects
public boolean intersects(MiPoint point)
intersectsLine
public boolean intersectsLine(double x1,
double y1,
double x2,
double y2)
intersectsLine
public boolean intersectsLine(double x1,
double y1,
double x2,
double y2,
double lWidth)
intersectionWith
public boolean intersectionWith(MiBounds bounds)
getIntersectionWithLine
public boolean getIntersectionWithLine(MiPoint insidePoint,
MiPoint otherPoint,
MiPoint returnedIntersectionPoint)
union
public MiBounds union(MiBounds bounds)
union
public MiBounds union(double xmin,
double ymin,
double xmax,
double ymax)
union
public MiBounds union(double x,
double y)
union
public MiBounds union(MiPoint point)
accumulateMaxWidthAndHeight
public void accumulateMaxWidthAndHeight(MiBounds bounds)
accumulateMaxWidthAndHeight
public void accumulateMaxWidthAndHeight(MiSize size)
expandIntoASquare
public MiBounds expandIntoASquare()
shrinkIntoASquare
public MiBounds shrinkIntoASquare()
toSizeString
public java.lang.String toSizeString()
toString
public java.lang.String toString()
reverse
public void reverse()
isReversed
public boolean isReversed()
isReversedWidth
public boolean isReversedWidth()
isReversedHeight
public boolean isReversedHeight()
scale
public void scale(MiScale scale)
scale
public void scale(double scalex,
double scaley)
equals
public final boolean equals(MiBounds other)
equals
public boolean equals(double xmin,
double ymin,
double xmax,
double ymax)
equalsSize
public boolean equalsSize(MiBounds other)
equalsIntegerSize
public boolean equalsIntegerSize(MiBounds other)
isSmallerSizeThan
public boolean isSmallerSizeThan(MiSize other)
isSmallerSizeThan
public boolean isSmallerSizeThan(MiBounds other)
isLargerSizeThan
public boolean isLargerSizeThan(MiBounds other)
isLargerSizeThan
public boolean isLargerSizeThan(MiSize other)
contains
public boolean contains(MiBounds part)
pointIsInside
public boolean pointIsInside(MiPoint pt,
double amountInside)
isContainedIn
public boolean isContainedIn(MiBounds container)
positionInsideContainer
public void positionInsideContainer(MiBounds container)
confineInsideContainer
public void confineInsideContainer(MiBounds container)
confineInsideContainer
public boolean confineInsideContainer(MiBounds container,
MiVector proposedDelta)
assureMinsLessThanMaxs
public void assureMinsLessThanMaxs()
validate
public boolean validate()
getLocationOfCommonPoint
public MiPoint getLocationOfCommonPoint(int connPtNum,
MiPoint point)
getClosestCommonPoint
public int getClosestCommonPoint(MiPoint location,
MiPoint connPtLocation)
setLocationOfCommonPoint
public void setLocationOfCommonPoint(int connPtNum,
MiPoint point)
translateLocationOfCommonPointTo
public void translateLocationOfCommonPointTo(int connPtNum,
MiPoint point)
getDistanceSquaredToClosestEdge
public double getDistanceSquaredToClosestEdge(MiPoint pt)