public class GouraudTriangle extends 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 Point2D |
pointA
point A of the triangle.
|
protected Point2D |
pointB
point B of the triangle.
|
protected Point2D |
pointC
point C of the triangle.
|
Constructor and Description |
---|
GouraudTriangle(Point2D a,
float[] aColor,
Point2D b,
float[] bColor,
Point2D c,
float[] cColor)
Constructor for using 3 points and their colors.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point2D p)
Check whether the point is within the triangle.
|
double[] |
getWeights(Point2D p)
calculate color weights with barycentric interpolation.
|
protected final Point2D pointA
protected final Point2D pointB
protected final Point2D pointC
protected final float[] colorA
protected final float[] colorB
protected final float[] colorC
public GouraudTriangle(Point2D a, float[] aColor, Point2D b, float[] bColor, 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(Point2D p)
p
- Pointpublic double[] getWeights(Point2D p)
p
- Point within triangleCopyright © 2002-2014 The Apache Software Foundation. All Rights Reserved.