java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Gradient
- All Implemented Interfaces:
ConstGradient,ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
Parameterize the variation (along a hair strand) of some value, such as
compliance or friction. (native type: HairSettings::Gradient)
-
Constructor Summary
ConstructorsConstructorDescriptionGradient()Instantiate a default gradient.Gradient(float min, float max) Instantiate a gradient between the specified parameter values.Gradient(float min, float max, float minFraction) Instantiate a gradient between the specified parameter values.Gradient(float min, float max, float minFraction, float maxFraction) Instantiate a gradient between the specified parameter values.Gradient(ConstGradient original) Instantiate a copy of the specified gradient. -
Method Summary
Modifier and TypeMethodDescriptionfloatgetMax()Return the parameter value when the fraction ismaxFraction.floatReturn the fraction at which the parameter value ismax.floatgetMin()Return the parameter value when the fraction isminFraction.floatReturn the fraction at which the parameter value ismin.voidrestoreBinaryState(StreamIn stream) Read the state of this object from the specified stream.voidsaveBinaryState(StreamOut stream) Write the state of this gradient to the specified stream.setMax(float max) Alter the parameter value when the fraction ismaxFraction.setMaxFraction(float fraction) Alter the fraction at which the parameter value reachesmax.setMin(float min) Alter the parameter value when the fraction isminFraction.setMinFraction(float fraction) Alter the fraction at which the parameter value ismin.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
Gradient
public Gradient()Instantiate a default gradient. -
Gradient
Instantiate a copy of the specified gradient.- Parameters:
original- the gradient to copy (notnull, unaffected)
-
Gradient
public Gradient(float min, float max) Instantiate a gradient between the specified parameter values.- Parameters:
min- the parameter value when the fraction is zero (default=0)max- the parameter value when the fraction is one (default=1)
-
Gradient
public Gradient(float min, float max, float minFraction) Instantiate a gradient between the specified parameter values.- Parameters:
min- the parameter value when the fraction isminFraction(default=0)max- the parameter value when the fraction is one (default=1)minFraction- the fraction at which the parameter value ismin(default=0)
-
Gradient
public Gradient(float min, float max, float minFraction, float maxFraction) Instantiate a gradient between the specified parameter values.- Parameters:
min- the parameter value when the fraction isminFraction(default=0)max- the parameter value when the fraction ismaxFraction(default=1)minFraction- the fraction at which the value ismin(default=0)maxFraction- the fraction at which the value ismax(default=1)
-
-
Method Details
-
restoreBinaryState
Read the state of this object from the specified stream.- Parameters:
stream- where to read from (notnull)
-
setMax
Alter the parameter value when the fraction ismaxFraction. (native member: mMax)- Parameters:
max- the desired parameter value (default=1)- Returns:
- the modified settings, for chaining
-
setMaxFraction
Alter the fraction at which the parameter value reachesmax. (native member: mMaxFraction)- Parameters:
fraction- the desired fraction (default=1)- Returns:
- the modified settings, for chaining
-
setMin
Alter the parameter value when the fraction isminFraction. (native member: mMin)- Parameters:
min- the desired parameter value (default=0)- Returns:
- the modified settings, for chaining
-
setMinFraction
Alter the fraction at which the parameter value ismin. (native member: mMinFraction)- Parameters:
fraction- the desired fraction (default=0)- Returns:
- the modified settings, for chaining
-
getMax
public float getMax()Return the parameter value when the fraction ismaxFraction. The gradient is unaffected. (native member: mMax)- Specified by:
getMaxin interfaceConstGradient- Returns:
- the parameter value
-
getMaxFraction
public float getMaxFraction()Return the fraction at which the parameter value ismax. The gradient is unaffected. (native member: mMaxFraction)- Specified by:
getMaxFractionin interfaceConstGradient- Returns:
- the fraction
-
getMin
public float getMin()Return the parameter value when the fraction isminFraction. The gradient is unaffected. (native member: mMin)- Specified by:
getMinin interfaceConstGradient- Returns:
- the parameter value
-
getMinFraction
public float getMinFraction()Return the fraction at which the parameter value ismin. The gradient is unaffected. (native member: mMinFraction)- Specified by:
getMinFractionin interfaceConstGradient- Returns:
- the fraction
-
saveBinaryState
Write the state of this gradient to the specified stream. The gradient is unaffected.- Specified by:
saveBinaryStatein interfaceConstGradient- Parameters:
stream- where to write objects (notnull)
-