Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.shading

pack-priv Class ShadedTriangle

extends Object
Class Inheritance
Imports
java.awt.Point, java.awt.geom.Point2D, java.util.HashSet, .Set

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.
Author
Shaola Ren

Field Summary

Modifier and TypeField and Description
private final double
protected final float[][]
protected final Point2D[]
private final int
private final Line
private final double
private final double
private final double

Constructor Summary

AccessConstructor and Description
pack-priv
ShadedTriangle(Point2D[]
an array of the 3 vertices of a triangle
p
,
float[][]
an array of color corresponding the vertex array p
c
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public float[]

Returns:

an array denotes the point's color
calcColor
(Point2D
the target point
p
)

Calculate the color of a point.

private int

Returns:

number of unique points in the 3 vertices of a triangle, 3, 2 or 1
calcDeg
(Point2D[]
3 vertices coordinates
p
)

Calculate the degree value of a triangle.

public boolean

Returns:

false if p is outside of this triangle, otherwise true
contains
(Point2D
the target point
p
)

Whether a point is contained in this ShadedTriangle.

private double
private double
public int[]

Returns:

{xmin, xmax, ymin, ymax}
getBoundary
()

get the boundary of a triangle.

public int
public Line

Returns:

points of the line, or null if this triangle isn't a line
getLine
()

Get the line of a triangle.

private boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

areaback to summary
private final double area
colorback to summary
protected final float[][] color
cornerback to summary
protected final Point2D[] corner
degreeback to summary
private final int degree
lineback to summary
private final Line line
v0back to summary
private final double v0
v1back to summary
private final double v1
v2back to summary
private final double v2

Constructor Detail

ShadedTriangleback to summary
pack-priv ShadedTriangle(Point2D[] p, float[][] c)

Constructor.

Parameters
p:Point2D[]

an array of the 3 vertices of a triangle

c:float[][]

an array of color corresponding the vertex array p

Method Detail

calcColorback to summary
public float[] calcColor(Point2D p)

Calculate the color of a point.

Parameters
p:Point2D

the target point

Returns:float[]

an array denotes the point's color

calcDegback to summary
private int calcDeg(Point2D[] p)

Calculate the degree value of a triangle.

Parameters
p:Point2D[]

3 vertices coordinates

Returns:int

number of unique points in the 3 vertices of a triangle, 3, 2 or 1

containsback to summary
public boolean contains(Point2D p)

Whether a point is contained in this ShadedTriangle.

Parameters
p:Point2D

the target point

Returns:boolean

false if p is outside of this triangle, otherwise true

edgeEquationValueback to summary
private double edgeEquationValue(Point2D p, Point2D p1, Point2D p2)
getAreaback to summary
private double getArea(Point2D a, Point2D b, Point2D c)
getBoundaryback to summary
public int[] getBoundary()

get the boundary of a triangle.

Returns:int[]

{xmin, xmax, ymin, ymax}

getDegback to summary
public int getDeg()
getLineback to summary
public Line getLine()

Get the line of a triangle.

Returns:Line

points of the line, or null if this triangle isn't a line

overlapsback to summary
private boolean overlaps(Point2D p0, Point2D p1)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override