Пример #1
0
        /// <summary>
        /// Performs the offset operation.
        /// Can be called multiple times, offsetting the same paths by different amounts (ie using different deltas).
        /// </summary>
        /// <param name="output">The List that will receive the result of the offset operation.</param>
        /// <param name="delta">
        /// The amount to which the supplied paths will be offset.
        /// Positive values expand polygons and negative values shrink them.
        /// Scaled by <see cref="ClipperUtility.ClipperScale"/>.
        /// </param>
        public void Offset(ref List <List <Vector2> > output, double delta)
        {
            var intOutput = new List <List <IntPoint> >();

            clipperOffset.Execute(ref intOutput, delta * ClipperUtility.ClipperScale);
            ClipperUtility.ToVector2Paths(intOutput, ref output);
        }
Пример #2
0
        /// <summary>
        /// Performs the clipping operation.
        /// Can be called multiple times without reassigning subject and clip polygons
        /// (ie when different clipping operations are required on the same polygon sets).
        /// </summary>
        /// <param name="clipType"> Type of the clipping operation. </param>
        /// <param name="output"> The List that will receive the result of the clipping operation. </param>
        /// <param name="subjectFillType"> Fill rule that will be applied to the subject paths. </param>
        /// <param name="clipFillType"> Fill rule that will be applied to the clip paths. </param>
        /// <returns> True if the operation was successful, false otherwise. </returns>
        public bool Clip(ClipType clipType, ref List <List <Vector2> > output, PolyFillType subjectFillType, PolyFillType clipFillType)
        {
            var  intOutput = new List <List <IntPoint> >();
            bool succeeded = clipper.Execute(clipType, intOutput, subjectFillType, clipFillType);

            ClipperUtility.ToVector2Paths(intOutput, ref output);
            return(succeeded);
        }
Пример #3
0
 /// <summary>
 /// Adds paths to a ClipperOffset object in preparation for offsetting.
 /// </summary>
 /// <param name="paths"> List of paths. </param>
 /// <param name="joinType"> See http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/JoinType.htm </param>
 /// <param name="endType"> See http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/EndType.htm </param>
 public void AddPaths(List <List <Vector2> > paths, JoinType joinType = JoinType.jtMiter, EndType endType = EndType.etClosedPolygon)
 {
     clipperOffset.AddPaths(ClipperUtility.ToIntPaths(paths), joinType, endType);
 }
Пример #4
0
 /// <summary>
 /// Adds paths to a Clipper object in preparation for clipping.
 /// </summary>
 /// <param name="paths"> List of paths. </param>
 /// <param name="polyType"> Type of the path (Subject or Clip). </param>
 /// <param name="closed"> Controls whether the path is closed. Clipping paths must always be closed. </param>
 /// <returns> False if all paths are invalid for clipping, true otherwise. </returns>
 public bool AddPaths(List <List <Vector2> > paths, PolyType polyType, bool closed = true)
 {
     return(clipper.AddPaths(ClipperUtility.ToIntPaths(paths), polyType, closed));
 }
Пример #5
0
 /// <summary>
 /// Adds a path to a Clipper object in preparation for clipping.
 /// </summary>
 /// <param name="path"> Vertices of the path. </param>
 /// <param name="polyType"> Type of the path (Subject or Clip). </param>
 /// <param name="closed"> Controls whether the path is closed. Clipping paths must always be closed. </param>
 /// <returns> False if the path is invalid for clipping, true otherwise. </returns>
 public bool AddPath(IList <Vector2> path, PolyType polyType, bool closed = true)
 {
     return(clipper.AddPath(ClipperUtility.ToIntPath(path), polyType, closed));
 }