RegionPointer.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // -----------------------------------------------------------------------
  2. // <copyright file="RegionPointer.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. /// Pointer to a region in the mesh geometry. A region is a well-defined
  13. /// subset of the geomerty (enclosed by subsegments).
  14. /// </summary>
  15. internal class RegionPointer
  16. {
  17. internal Point point;
  18. internal int id;
  19. internal double area;
  20. /// <summary>
  21. /// Gets or sets a region area constraint.
  22. /// </summary>
  23. public double Area
  24. {
  25. get { return area; }
  26. set
  27. {
  28. if (value < 0.0)
  29. {
  30. throw new ArgumentException("Area constraints must not be negative.");
  31. }
  32. area = value;
  33. }
  34. }
  35. /// <summary>
  36. /// Initializes a new instance of the <see cref="RegionPointer" /> class.
  37. /// </summary>
  38. /// <param name="x">X coordinate of the region.</param>
  39. /// <param name="y">Y coordinate of the region.</param>
  40. /// <param name="id">Region id.</param>
  41. public RegionPointer(double x, double y, int id)
  42. : this(x, y, id, 0.0)
  43. {
  44. }
  45. /// <summary>
  46. /// Initializes a new instance of the <see cref="RegionPointer" /> class.
  47. /// </summary>
  48. /// <param name="x">X coordinate of the region.</param>
  49. /// <param name="y">Y coordinate of the region.</param>
  50. /// <param name="id">Region id.</param>
  51. /// <param name="area">Area constraint.</param>
  52. public RegionPointer(double x, double y, int id, double area)
  53. {
  54. this.point = new Point(x, y);
  55. this.id = id;
  56. this.area = area;
  57. }
  58. }
  59. }