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 TypeMethodDescriptionboolean
int
hashCode()
boolean
Is 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.boolean
Does the scale-factor involve no scaling at all?double
Which is the minimum scaling-factor among all dimensions?void
Multiplies aPoint3d
by the respective scaling-factor in each X and Y dimensions.toString()
double
x()
How much to multiply the existing x-dimension by to create a scaled X-dimension.double
y()
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
ScaleFactor
where 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-3
precision.
-
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 aPoint3d
by 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()
-