Class LinePath

java.lang.Object
processing.opengl.LinePath

public class LinePath extends Object
The LinePath class allows to represent polygonal paths, potentially composed by several disjoint polygonal segments. It can be iterated by the LinePath.PathIterator class including all of its segment types and winding rules
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Ends unclosed subpaths and dash segments with no added decoration.
    static final int
    Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.
    static final int
    Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.
    static final int
    Joins path segments by connecting the outer corners of their wide outlines with a straight segment.
    static final int
    Joins path segments by extending their outside edges until they meet.
    static final int
    Joins path segments by rounding off the corner at a radius of half the line width.
    static final byte
    Closes segment at current position.
    static final byte
    Extends segment by adding a line to a given position.
    static final byte
    Starts segment at a given position.
    static final int
    The winding rule constant for specifying an even-odd rule for determining the interior of a path.
    static final int
    The winding rule constant for specifying a non-zero rule for determining the interior of a path.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new empty single precision LinePath object with a default winding rule of WIND_NON_ZERO.
    LinePath(int rule)
    Constructs a new empty single precision LinePath object with the specified winding rule to control operations that require the interior of the path to be defined.
    LinePath(int rule, int initialCapacity)
    Constructs a new LinePath object from the given specified initial values.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo.
    static byte[]
    copyOf(byte[] source, int length)
     
    static float[]
    copyOf(float[] source, int length)
     
    static int[]
    copyOf(int[] source, int length)
     
    static LinePath
    createStrokedPath(LinePath src, float weight, int caps, int join)
     
    static LinePath
    createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit)
     
    static LinePath
    createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit, PMatrix2D transform)
    Constructs a solid LinePath with the specified attributes.
    The iterator for this class is not multi-threaded safe, which means that the LinePath class does not guarantee that modifications to the geometry of this LinePath object do not affect any iterations of that geometry that are already in process.
    final int
    Returns the fill style winding rule.
    static double
    hypot(double x, double y)
     
    static int
    hypot(int x, int y)
     
    static long
    hypot(long x, long y)
     
    static int
    isqrt(int x)
     
    final void
    lineTo(float x, float y, int c)
    Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in float precision.
    static long
    lsqrt(long x)
     
    final void
    moveTo(float x, float y, int c)
    Adds a point to the path by moving to the specified coordinates specified in float precision.
    final void
    Resets the path to empty.
    final void
    setWindingRule(int rule)
    Sets the winding rule for this path to the specified value.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WIND_EVEN_ODD

      public static final int WIND_EVEN_ODD
      The winding rule constant for specifying an even-odd rule for determining the interior of a path. The even-odd rule specifies that a point lies inside the path if a ray drawn in any direction from that point to infinity is crossed by path segments an odd number of times.
      See Also:
    • WIND_NON_ZERO

      public static final int WIND_NON_ZERO
      The winding rule constant for specifying a non-zero rule for determining the interior of a path. The non-zero rule specifies that a point lies inside the path if a ray drawn in any direction from that point to infinity is crossed by path segments a different number of times in the counter-clockwise direction than the clockwise direction.
      See Also:
    • SEG_MOVETO

      public static final byte SEG_MOVETO
      Starts segment at a given position.
      See Also:
    • SEG_LINETO

      public static final byte SEG_LINETO
      Extends segment by adding a line to a given position.
      See Also:
    • SEG_CLOSE

      public static final byte SEG_CLOSE
      Closes segment at current position.
      See Also:
    • JOIN_MITER

      public static final int JOIN_MITER
      Joins path segments by extending their outside edges until they meet.
      See Also:
    • JOIN_ROUND

      public static final int JOIN_ROUND
      Joins path segments by rounding off the corner at a radius of half the line width.
      See Also:
    • JOIN_BEVEL

      public static final int JOIN_BEVEL
      Joins path segments by connecting the outer corners of their wide outlines with a straight segment.
      See Also:
    • CAP_BUTT

      public static final int CAP_BUTT
      Ends unclosed subpaths and dash segments with no added decoration.
      See Also:
    • CAP_ROUND

      public static final int CAP_ROUND
      Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.
      See Also:
    • CAP_SQUARE

      public static final int CAP_SQUARE
      Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width.
      See Also:
  • Constructor Details

    • LinePath

      public LinePath()
      Constructs a new empty single precision LinePath object with a default winding rule of WIND_NON_ZERO.
    • LinePath

      public LinePath(int rule)
      Constructs a new empty single precision LinePath object with the specified winding rule to control operations that require the interior of the path to be defined.
      Parameters:
      rule - the winding rule
      See Also:
    • LinePath

      public LinePath(int rule, int initialCapacity)
      Constructs a new LinePath object from the given specified initial values. This method is only intended for internal use and should not be made public if the other constructors for this class are ever exposed.
      Parameters:
      rule - the winding rule
      initialCapacity - the size to make the initial array to store the path segment types
  • Method Details

    • moveTo

      public final void moveTo(float x, float y, int c)
      Adds a point to the path by moving to the specified coordinates specified in float precision.

      This method provides a single precision variant of the double precision moveTo() method on the base LinePath class.

      Parameters:
      x - the specified X coordinate
      y - the specified Y coordinate
      See Also:
    • lineTo

      public final void lineTo(float x, float y, int c)
      Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in float precision.

      This method provides a single precision variant of the double precision lineTo() method on the base LinePath class.

      Parameters:
      x - the specified X coordinate
      y - the specified Y coordinate
      See Also:
    • getPathIterator

      public LinePath.PathIterator getPathIterator()
      The iterator for this class is not multi-threaded safe, which means that the LinePath class does not guarantee that modifications to the geometry of this LinePath object do not affect any iterations of that geometry that are already in process.
    • closePath

      public final void closePath()
      Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo. If the path is already closed then this method has no effect.
    • getWindingRule

      public final int getWindingRule()
      Returns the fill style winding rule.
      Returns:
      an integer representing the current winding rule.
      See Also:
    • setWindingRule

      public final void setWindingRule(int rule)
      Sets the winding rule for this path to the specified value.
      Parameters:
      rule - an integer representing the specified winding rule
      Throws:
      IllegalArgumentException - if rule is not either WIND_EVEN_ODD or WIND_NON_ZERO
      See Also:
    • reset

      public final void reset()
      Resets the path to empty. The append position is set back to the beginning of the path and all coordinates and point types are forgotten.
    • createStrokedPath

      public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join)
    • createStrokedPath

      public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit)
    • createStrokedPath

      public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit, PMatrix2D transform)
      Constructs a solid LinePath with the specified attributes.
      Parameters:
      src - the original path to be stroked
      weight - the weight of the stroked path
      caps - the decoration of the ends of the segments in the path
      join - the decoration applied where path segments meet
      miterlimit -
      transform -
    • copyOf

      public static float[] copyOf(float[] source, int length)
    • copyOf

      public static byte[] copyOf(byte[] source, int length)
    • copyOf

      public static int[] copyOf(int[] source, int length)
    • isqrt

      public static int isqrt(int x)
    • lsqrt

      public static long lsqrt(long x)
    • hypot

      public static double hypot(double x, double y)
    • hypot

      public static int hypot(int x, int y)
    • hypot

      public static long hypot(long x, long y)