Class Barycentrics
java.lang.Object
io.github.shimeoki.jfx.rasterization.triangle.Barycentrics
A class that represents barycentric coordinates using floats.
The main usage is to act as a data object for the Filler.
The coordinates are mutable for the usage of the same object instead of
creating a new one everytime. It can be seen in
Barycentricser.
It is recommended to keep the coordinates normalized (based on the theory). Documentation: Wikipedia.
- Since:
- 2.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBarycentrics(float lambda1, float lambda2, float lambda3) Creates a newBarycentricsinstance with initial values. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninside()Gets the boolean value of the statement "are these barycentrics inside of a triangle?".floatlambda1()Gets the first barycentric coordinate.floatlambda2()Gets the second barycentric coordinate.floatlambda3()Gets the third barycentric coordinate.booleanGets the boolean value of the statement "are these barycentrics normalized?".voidsetLambda1(float v) Sets the value of the first barycentric coordinate.voidsetLambda2(float v) Sets the value of the second barycentric coordinate.voidsetLambda3(float v) Sets the value of the third barycentric coordinate.
-
Constructor Details
-
Barycentrics
public Barycentrics(float lambda1, float lambda2, float lambda3) Creates a newBarycentricsinstance with initial values.- Parameters:
lambda1- initial value of the first barycentric coordinatelambda2- initial value of the second barycentric coordinatelambda3- initial value of the third barycentric coordinate- Since:
- 2.0.0
-
-
Method Details
-
lambda1
public float lambda1()Gets the first barycentric coordinate.- Returns:
- the first barycentric coordinate.
- Since:
- 2.0.0
-
setLambda1
public void setLambda1(float v) Sets the value of the first barycentric coordinate.- Parameters:
v- new value of the first barycentric coordinate- Since:
- 2.0.0
-
lambda2
public float lambda2()Gets the second barycentric coordinate.- Returns:
- the second barycentric coordinate.
- Since:
- 2.0.0
-
setLambda2
public void setLambda2(float v) Sets the value of the second barycentric coordinate.- Parameters:
v- new value of the second barycentric coordinate- Since:
- 2.0.0
-
lambda3
public float lambda3()Gets the third barycentric coordinate.- Returns:
- the third barycentric coordinate.
- Since:
- 2.0.0
-
setLambda3
public void setLambda3(float v) Sets the value of the third barycentric coordinate.- Parameters:
v- new value of the third barycentric coordinate- Since:
- 2.0.0
-
inside
public boolean inside()Gets the boolean value of the statement "are these barycentrics inside of a triangle?".Equals to the boolean value of the statement "are all the barycentric coordinates not negative?".
Uses
Floats.moreThan(float, float)internally.- Returns:
trueif these barycentric coordinates are inside of the triangle;falseotherwise- Since:
- 2.0.0
- See Also:
-
normalized
public boolean normalized()Gets the boolean value of the statement "are these barycentrics normalized?".Equals to
trueis the sum of all coordinates is 1.Uses
Floats.equals(float, float)internally.- Returns:
trueif the sum of these barycentric coordinates is equal to 1;falseotherwise- Since:
- 2.0.0
- See Also:
-