Package org.anchoranalysis.spatial.scale
Class ScaleFactor
Object
ScaleFactor
What to scale X and Y dimensions by.
This class is immutable.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionScaleFactor(double factor) Create with an identical scaling-factor for all dimensions.ScaleFactor(double x, double y) Create with specific scaling-factors for each dimension. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanIs the scale-factor identical in X and Y dimensions?invert()Build a new scale factor where each dimension is set to the reciprocal of its current value.booleanDoes the scale-factor involve no scaling at all?doubleWhich is the minimum scaling-factor among all dimensions?voidMultiplies aPoint3dby the respective scaling-factor in each X and Y dimensions.toString()doublex()How much to multiply the existing x-dimension by to create a scaled X-dimension.doubley()How much to multiply the existing y-dimension by to create a scaled Y-dimension.
-
Constructor Details
-
ScaleFactor
public ScaleFactor(double factor) Create with an identical scaling-factor for all dimensions.- Parameters:
factor- how much to multiply all existing dimensions by to create a scaled dimensions.
-
ScaleFactor
public ScaleFactor(double x, double y) Create with specific scaling-factors for each dimension.- Parameters:
x- how much to multiply the existing x-dimension by to create a scaled x-dimension.y- how much to multiply the existing x-dimension by to create a scaled x-dimension.
-
-
Method Details
-
invert
Build a new scale factor where each dimension is set to the reciprocal of its current value.This is an immutable operation.
- Returns:
- a newly created
ScaleFactorwhere each component is set to its reciprocal.
-
hasIdenticalXY
public boolean hasIdenticalXY()Is the scale-factor identical in X and Y dimensions?- Returns:
- true if the scale-factor and Y are identical within
1e-3precision.
-
isNoScale
public boolean isNoScale()Does the scale-factor involve no scaling at all?- Returns:
- true if the scale-factor is 1 in all dimensions, false otherwise.
-
minimumDimension
public double minimumDimension()Which is the minimum scaling-factor among all dimensions?- Returns:
- the minimum scaling-factor
-
scale
Multiplies aPoint3dby the respective scaling-factor in each X and Y dimensions.No scaling is applied in the Z dimension.
- Parameters:
point- the point to be scaled.
-
toString
-
x
public double x()How much to multiply the existing x-dimension by to create a scaled X-dimension. -
y
public double y()How much to multiply the existing y-dimension by to create a scaled Y-dimension. -
equals
-
hashCode
public int hashCode()
-