Class CenterOfGravity
Calculates the center of gravity of a single object along a specified axis.
This feature computes the center of gravity of an object along the X, Y, or Z axis.
-
Constructor Summary
ConstructorsConstructorDescriptionCenterOfGravity
(Axis axis) Creates a CenterOfGravity feature for a specific axis. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Calculates a value for some input.getAxis()
The axis along which to calculate the center of gravity.double
The value to return if the center of gravity calculation results in NaN.void
The axis along which to calculate the center of gravity.void
setEmptyValue
(double emptyValue) The value to return if the center of gravity calculation results in NaN.Methods inherited from class org.anchoranalysis.image.feature.bean.object.single.FeatureSingleObject
inputType
Methods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toString
Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
CenterOfGravity
Creates a CenterOfGravity feature for a specific axis.- Parameters:
axis
- the axis along which to calculate the center of gravity
-
CenterOfGravity
public CenterOfGravity()
-
-
Method Details
-
calculate
public double calculate(FeatureCalculationInput<FeatureInputSingleObject> input) throws FeatureCalculationException Description copied from class:Feature
Calculates a value for some input.- Specified by:
calculate
in classFeature<FeatureInputSingleObject>
- Parameters:
input
- the input to the calculation.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException
- if the calculation cannot successfully complete.
-
getAxis
The axis along which to calculate the center of gravity. Can be "x", "y", or "z". -
setAxis
The axis along which to calculate the center of gravity. Can be "x", "y", or "z". -
getEmptyValue
public double getEmptyValue()The value to return if the center of gravity calculation results in NaN. -
setEmptyValue
public void setEmptyValue(double emptyValue) The value to return if the center of gravity calculation results in NaN.
-