public class GouraudTriangle
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected float[] |
colorA
the color of point A.
|
protected float[] |
colorB
the color of point B.
|
protected float[] |
colorC
the color of point C.
|
protected java.awt.geom.Point2D |
pointA
point A of the triangle.
|
protected java.awt.geom.Point2D |
pointB
point B of the triangle.
|
protected java.awt.geom.Point2D |
pointC
point C of the triangle.
|
Constructor and Description |
---|
GouraudTriangle(java.awt.geom.Point2D a,
float[] aColor,
java.awt.geom.Point2D b,
float[] bColor,
java.awt.geom.Point2D c,
float[] cColor)
Constructor for using 3 points and their colors.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.awt.geom.Point2D p)
Check whether the point is within the triangle.
|
double[] |
getWeights(java.awt.geom.Point2D p)
calculate color weights with barycentric interpolation.
|
protected final java.awt.geom.Point2D pointA
protected final java.awt.geom.Point2D pointB
protected final java.awt.geom.Point2D pointC
protected final float[] colorA
protected final float[] colorB
protected final float[] colorC
public GouraudTriangle(java.awt.geom.Point2D a, float[] aColor, java.awt.geom.Point2D b, float[] bColor, java.awt.geom.Point2D c, float[] cColor)
a
- point A of the triangleaColor
- color of point Ab
- point B of the trianglebColor
- color of point Bc
- point C of the trianglecColor
- color of point Cpublic boolean contains(java.awt.geom.Point2D p)
p
- Pointpublic double[] getWeights(java.awt.geom.Point2D p)
p
- Point within triangle