Package snap.geom

Class SegmentPath

java.lang.Object
snap.geom.Shape
snap.geom.SegmentPath

public class SegmentPath extends Shape
A Shape containing a list of Segment shapes (Line, Quad, Cubic) to facilitate complex shape operations like constructive area geometry (CAG) operations (add, subtract, intersect paths).
  • Constructor Details

    • SegmentPath

      public SegmentPath()
      Constructor.
    • SegmentPath

      public SegmentPath(Shape aShape)
      Constructor for given shape.
  • Method Details

    • getSegs

      public List<Segment> getSegs()
      Returns the list of segments.
    • getSegCount

      public int getSegCount()
      Returns the number of segments.
    • getSeg

      public Segment getSeg(int anIndex)
      Returns the individual segment at given index.
    • addSeg

      public void addSeg(Segment aSeg)
      Adds the given segment.
    • addSeg

      public void addSeg(Segment aSeg, int anIndex)
      Adds the given segment.
    • removeSeg

      public Segment removeSeg(int anIndex)
      Removes a given segment.
    • contains

      public boolean contains(double aX, double aY)
      Returns whether this SegmentPath contains given point.
      Overrides:
      contains in class Shape
    • containsSegMid

      public boolean containsSegMid(Segment aSeg)
      Returns whether this SegmentPath contains given point.
    • containsEndPoint

      public boolean containsEndPoint(double x, double y)
      Returns whether given SegmentPath contains given point.
    • hasSeg

      public boolean hasSeg(Segment aSeg)
      Returns whether segment list contains segment (regardless of direction).
    • getFirstSegOutside

      public Segment getFirstSegOutside(SegmentPath aShape)
      Returns the first Segment from this SegmentList outside of given SegmentPath.
    • getFirstSegInside

      public Segment getFirstSegInside(SegmentPath aShape)
      Returns the first Segment from this SegmentList outside of given SegmentPath.
    • getSegmentsThatStartOrEndAtSegmentEndPoint

      public List<Segment> getSegmentsThatStartOrEndAtSegmentEndPoint(Segment aSeg)
      Returns the segments from list for end point of given seg.
    • isSelfIntersecting

      public boolean isSelfIntersecting()
      Returns whether this SegmentPath has any intersecting segments.
      Overrides:
      isSelfIntersecting in class Shape
    • makeNotSelfIntersecting

      public void makeNotSelfIntersecting()
      Makes the SegmentPath not intersecting by turning intersection areas into separate cycles.
    • splitIntersectingSegmentsAtIntersectionPoints

      public boolean splitIntersectingSegmentsAtIntersectionPoints()
      Splits the segments in this SegmentPath wherever it intersects itself.
    • splitIntersectingSegmentsAtIntersectionPoints

      public void splitIntersectingSegmentsAtIntersectionPoints(SegmentPath aSegmentPath)
      Splits the segments for this and given SegmentPath for every intersection of the two.
    • getPathIter

      public PathIter getPathIter(Transform aTrans)
      Returns a path iterator.
      Specified by:
      getPathIter in class Shape