public class Scaler extends Object
ScaleFactor
.Modifier and Type | Method and Description |
---|---|
static double |
deriveScalingFactor(int numerator,
int denominator)
Calculates a scaling-factor (for one dimension) by doing a floating point division of two
integers.
|
static Point3i |
scale(ScaleFactor scalingFactor,
Point3i point)
Scales a point in XY by multiplying each dimension by its corresponding scaling-factor.
|
static int |
scaleCeil(double scalingFactor,
int quantity)
Multiplies a quantity (integer) by a scaling-factor, returning it as an integer via
ceil.
|
static Point3i |
scaleCeil(ScaleFactor scalingFactor,
Point3i point)
Scales a point in XY by multiplying each dimension by its corresponding scaling-factor.
|
static int |
scaleFloor(double scalingFactor,
int quantity)
Multiplies a quantity (integer) by a scaling-factor, returning it as an integer via
floor.
|
static int |
scaleMultiplex(double scalingFactor,
int quantity,
boolean round)
|
static int |
scaleRound(double scalingFactor,
int quantity)
Multiplies a quantity (integer) by a scaling-factor, returning it as an integer via
rounding.
|
public static Point3i scale(ScaleFactor scalingFactor, Point3i point)
This is an immutable operation.
Each dimension is rounded to it's nearest value after scaling.
scalingFactor
- the factor to use for scaling.point
- the point to scale.scalingFactor
and the z-dimension value is identical.public static Point3i scaleCeil(ScaleFactor scalingFactor, Point3i point)
This is an immutable operation.
Each dimension is scaled to it's nearest value after scaling.
scalingFactor
- the factor to use for scaling.point
- the point to scale.scalingFactor
and the z-dimension value is identical.public static int scaleMultiplex(double scalingFactor, int quantity, boolean round)
scaleRound(double, int)
and scaleCeil(org.anchoranalysis.spatial.scale.ScaleFactor, org.anchoranalysis.spatial.point.Point3i)
.scalingFactor
- quantity
- round
- if true, scaleRound(double, int)
is called, otherwise scaleCeil(double, int)
.public static int scaleRound(double scalingFactor, int quantity)
Refuses to return 0 or any negative value, making 1 the minimum return value.
scalingFactor
- the scaling-factor.quantity
- the quantity.public static int scaleCeil(double scalingFactor, int quantity)
Refuses to return 0 or any negative value, making 1 the minimum return value.
scalingFactor
- the scaling-factor.quantity
- the quantity.public static int scaleFloor(double scalingFactor, int quantity)
Refuses to return 0 or any negative value, making 1 the minimum return value.
scalingFactor
- the scaling-factor.quantity
- the quantity.public static double deriveScalingFactor(int numerator, int denominator)
numerator
- to divide by.denominator
- divider.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.