Class ShadedTriangle
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.ShadedTriangle
This is an assistant class for accomplishing type 4, 5, 6 and 7 shading. It
describes a triangle actually, which is used to compose a patch. It contains
the degenerated cases, a triangle degenerates to a line or to a point. This
was done as part of GSoC2014, Tilman Hausherr is the mentor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
Calculate the color of a point.private int
Calculate the degree value of a triangle.boolean
Whether a point is contained in this ShadedTriangle.private double
edgeEquationValue
(Point2D p, Point2D p1, Point2D p2) private double
int[]
get the boundary of a triangle.int
getDeg()
getLine()
Get the line of a triangle.private boolean
toString()
-
Field Details
-
corner
-
color
protected final float[][] color -
area
private final double area -
degree
private final int degree -
line
-
v0
private final double v0 -
v1
private final double v1 -
v2
private final double v2
-
-
Constructor Details
-
ShadedTriangle
ShadedTriangle(Point2D[] p, float[][] c) Constructor.- Parameters:
p
- an array of the 3 vertices of a triangle; the Point2D objects should not be modified by the caller.c
- an array of color corresponding the vertex array p
-
-
Method Details
-
calcDeg
Calculate the degree value of a triangle.- Parameters:
p
- 3 vertices coordinates- Returns:
- number of unique points in the 3 vertices of a triangle, 3, 2 or 1
-
getDeg
public int getDeg() -
getBoundary
public int[] getBoundary()get the boundary of a triangle.- Returns:
- {xmin, xmax, ymin, ymax}
-
getLine
Get the line of a triangle.- Returns:
- points of the line, or null if this triangle isn't a line
-
contains
Whether a point is contained in this ShadedTriangle.- Parameters:
p
- the target point- Returns:
- false if p is outside of this triangle, otherwise true
-
overlaps
-
edgeEquationValue
-
getArea
-
calcColor
Calculate the color of a point.- Parameters:
p
- the target point- Returns:
- an array denotes the point's color
-
toString
-