java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.Patch
Direct Known Subclasses:
CoonsPatch, TensorPatch

abstract class Patch extends Object
Patch is extended by CoonsPatch and TensorPatch. This was done as part of GSoC2014, Tilman Hausherr is the mentor.
  • Field Details

    • controlPoints

      protected Point2D[][] controlPoints
    • cornerColor

      protected float[][] cornerColor
    • level

      protected int[] level
    • listOfTriangles

      protected List<ShadedTriangle> listOfTriangles
  • Constructor Details

    • Patch

      Patch(float[][] color)
      Constructor of Patch.
      Parameters:
      color - 4 corner's colors
  • Method Details

    • getFlag1Edge

      protected abstract Point2D[] getFlag1Edge()
      Get the implicit edge for flag = 1.
      Returns:
      implicit control points
    • getFlag2Edge

      protected abstract Point2D[] getFlag2Edge()
      Get the implicit edge for flag = 2.
      Returns:
      implicit control points
    • getFlag3Edge

      protected abstract 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(Point2D ps, Point2D pe)
      Calculate the distance from point ps to point pe.
      Parameters:
      ps - one end of a line
      pe - the other end of the line
      Returns:
      length of the line
    • isEdgeALine

      protected boolean isEdgeALine(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(Point2D p, Point2D p1, 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 point
      p1 - one end of a line
      p2 - the other end of a line
      Returns:
      calculated value
    • getShadedTriangles

      protected 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(Point2D p0, Point2D p1)