Class Patch
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.shading.Patch
-
- Direct Known Subclasses:
CoonsPatch
,TensorPatch
abstract class Patch extends java.lang.Object
Patch is extended by CoonsPatch and TensorPatch. This was done as part of GSoC2014, Tilman Hausherr is the mentor.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.geom.Point2D[][]
controlPoints
protected float[][]
cornerColor
protected int[]
level
protected java.util.List<ShadedTriangle>
listOfTriangles
-
Constructor Summary
Constructors Constructor Description Patch(java.awt.geom.Point2D[] ctl, float[][] color)
Constructor of Patch.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected double
edgeEquationValue(java.awt.geom.Point2D p, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
A line from point p1 to point p2 defines an equation, adjust the form of the equation to let the rhs equals 0, then calculate the lhs value by plugging the coordinate of p in the lhs expression.protected float[][]
getFlag1Color()
Get the implicit color for flag = 1.protected abstract java.awt.geom.Point2D[]
getFlag1Edge()
Get the implicit edge for flag = 1.protected float[][]
getFlag2Color()
Get implicit color for flag = 2.protected abstract java.awt.geom.Point2D[]
getFlag2Edge()
Get the implicit edge for flag = 2.protected float[][]
getFlag3Color()
Get implicit color for flag = 3.protected abstract java.awt.geom.Point2D[]
getFlag3Edge()
Get the implicit edge for flag = 3.protected double
getLen(java.awt.geom.Point2D ps, java.awt.geom.Point2D pe)
Calculate the distance from point ps to point pe.protected java.util.List<ShadedTriangle>
getShadedTriangles(CoordinateColorPair[][] patchCC)
An assistant method to accomplish type 6 and type 7 shading.protected boolean
isEdgeALine(java.awt.geom.Point2D[] ctl)
Whether the for control points are on a line.private boolean
overlaps(java.awt.geom.Point2D p0, java.awt.geom.Point2D p1)
-
-
-
Field Detail
-
controlPoints
protected java.awt.geom.Point2D[][] controlPoints
-
cornerColor
protected float[][] cornerColor
-
level
protected int[] level
-
listOfTriangles
protected java.util.List<ShadedTriangle> listOfTriangles
-
-
Method Detail
-
getFlag1Edge
protected abstract java.awt.geom.Point2D[] getFlag1Edge()
Get the implicit edge for flag = 1.- Returns:
- implicit control points
-
getFlag2Edge
protected abstract java.awt.geom.Point2D[] getFlag2Edge()
Get the implicit edge for flag = 2.- Returns:
- implicit control points
-
getFlag3Edge
protected abstract java.awt.geom.Point2D[] getFlag3Edge()
Get the implicit edge for flag = 3.- Returns:
- implicit control points
-
getFlag1Color
protected float[][] getFlag1Color()
Get the implicit color for flag = 1.- Returns:
- color
-
getFlag2Color
protected float[][] getFlag2Color()
Get implicit color for flag = 2.- Returns:
- color
-
getFlag3Color
protected float[][] getFlag3Color()
Get implicit color for flag = 3.- Returns:
- color
-
getLen
protected double getLen(java.awt.geom.Point2D ps, java.awt.geom.Point2D pe)
Calculate the distance from point ps to point pe.- Parameters:
ps
- one end of a linepe
- the other end of the line- Returns:
- length of the line
-
isEdgeALine
protected boolean isEdgeALine(java.awt.geom.Point2D[] ctl)
Whether the for control points are on a line.- Parameters:
ctl
- an edge's control points, the size of ctl is 4- Returns:
- true when 4 control points are on a line, otherwise false
-
edgeEquationValue
protected double edgeEquationValue(java.awt.geom.Point2D p, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
A line from point p1 to point p2 defines an equation, adjust the form of the equation to let the rhs equals 0, then calculate the lhs value by plugging the coordinate of p in the lhs expression.- Parameters:
p
- target pointp1
- one end of a linep2
- the other end of a line- Returns:
- calculated value
-
getShadedTriangles
protected java.util.List<ShadedTriangle> getShadedTriangles(CoordinateColorPair[][] patchCC)
An assistant method to accomplish type 6 and type 7 shading.- Parameters:
patchCC
- all the crossing point coordinates and color of a grid- Returns:
- a ShadedTriangle list which can compose the grid patch
-
overlaps
private boolean overlaps(java.awt.geom.Point2D p0, java.awt.geom.Point2D p1)
-
-