Contour.h 989 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <vector>
  3. #include "EdgeHolder.h"
  4. namespace msdfgen {
  5. /// A single closed contour of a shape.
  6. class Contour {
  7. public:
  8. /// The sequence of edges that make up the contour.
  9. std::vector<EdgeHolder> edges;
  10. /// Adds an edge to the contour.
  11. void addEdge(const EdgeHolder &edge);
  12. #ifdef MSDFGEN_USE_CPP11
  13. void addEdge(EdgeHolder &&edge);
  14. #endif
  15. /// Creates a new edge in the contour and returns its reference.
  16. EdgeHolder & addEdge();
  17. /// Adjusts the bounding box to fit the contour.
  18. void bound(double &l, double &b, double &r, double &t) const;
  19. /// Adjusts the bounding box to fit the contour border's mitered corners.
  20. void boundMiters(double &l, double &b, double &r, double &t, double border, double miterLimit, int polarity) const;
  21. /// Computes the winding of the contour. Returns 1 if positive, -1 if negative.
  22. int winding() const;
  23. /// Reverses the sequence of edges on the contour.
  24. void reverse();
  25. };
  26. }