overlap.h 939 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * overlap.h - Test for overlaps
  3. *
  4. * Written 2009, 2010 by Werner Almesberger
  5. * Copyright 2009, 2010 by Werner Almesberger
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #ifndef OVERLAP_H
  13. #define OVERLAP_H
  14. enum allow_overlap {
  15. ao_none,
  16. ao_touch,
  17. ao_any,
  18. };
  19. /*
  20. * Avoid inst.h -> layer.h -> overlay.h -> inst.h loop
  21. */
  22. struct inst;
  23. /*
  24. * "inside" returns 1 if "a" is completely enclosed by "b". If "a" == "b",
  25. * that also counts as "a" being inside "b".
  26. */
  27. int inside(const struct inst *a, const struct inst *b);
  28. /*
  29. * "overlap" returns 1 if "a" and "b" have at least one point in common.
  30. */
  31. int overlap(const struct inst *a, const struct inst *b,
  32. enum allow_overlap allow);
  33. #endif /* !OVERLAP_H */