IPolygon.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // -----------------------------------------------------------------------
  2. // <copyright file="IPolygon.cs" company="">
  3. // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
  4. // </copyright>
  5. // -----------------------------------------------------------------------
  6. namespace UnityEngine.U2D.Animation.TriangleNet
  7. .Geometry
  8. {
  9. using System;
  10. using System.Collections.Generic;
  11. /// <summary>
  12. /// Polygon interface.
  13. /// </summary>
  14. internal interface IPolygon
  15. {
  16. /// <summary>
  17. /// Gets the vertices of the polygon.
  18. /// </summary>
  19. List<Vertex> Points { get; }
  20. /// <summary>
  21. /// Gets the segments of the polygon.
  22. /// </summary>
  23. List<ISegment> Segments { get; }
  24. /// <summary>
  25. /// Gets a list of points defining the holes of the polygon.
  26. /// </summary>
  27. List<Point> Holes { get; }
  28. /// <summary>
  29. /// Gets a list of pointers defining the regions of the polygon.
  30. /// </summary>
  31. List<RegionPointer> Regions { get; }
  32. /// <summary>
  33. /// Gets or sets a value indicating whether the vertices have marks or not.
  34. /// </summary>
  35. bool HasPointMarkers { get; set; }
  36. /// <summary>
  37. /// Gets or sets a value indicating whether the segments have marks or not.
  38. /// </summary>
  39. bool HasSegmentMarkers { get; set; }
  40. [Obsolete("Use polygon.Add(contour) method instead.")]
  41. void AddContour(IEnumerable<Vertex> points, int marker, bool hole, bool convex);
  42. [Obsolete("Use polygon.Add(contour) method instead.")]
  43. void AddContour(IEnumerable<Vertex> points, int marker, Point hole);
  44. /// <summary>
  45. /// Compute the bounds of the polygon.
  46. /// </summary>
  47. /// <returns>Rectangle defining an axis-aligned bounding box.</returns>
  48. Rectangle Bounds();
  49. /// <summary>
  50. /// Add a vertex to the polygon.
  51. /// </summary>
  52. /// <param name="vertex">The vertex to insert.</param>
  53. void Add(Vertex vertex);
  54. /// <summary>
  55. /// Add a segment to the polygon.
  56. /// </summary>
  57. /// <param name="segment">The segment to insert.</param>
  58. /// <param name="insert">If true, both endpoints will be added to the points list.</param>
  59. void Add(ISegment segment, bool insert = false);
  60. /// <summary>
  61. /// Add a segment to the polygon.
  62. /// </summary>
  63. /// <param name="segment">The segment to insert.</param>
  64. /// <param name="index">The index of the segment endpoint to add to the points list (must be 0 or 1).</param>
  65. void Add(ISegment segment, int index);
  66. /// <summary>
  67. /// Add a contour to the polygon.
  68. /// </summary>
  69. /// <param name="contour">The contour to insert.</param>
  70. /// <param name="hole">Treat contour as a hole.</param>
  71. void Add(Contour contour, bool hole = false);
  72. /// <summary>
  73. /// Add a contour to the polygon.
  74. /// </summary>
  75. /// <param name="contour">The contour to insert.</param>
  76. /// <param name="hole">Point inside the contour, making it a hole.</param>
  77. void Add(Contour contour, Point hole);
  78. }
  79. }