geometry.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #pragma once
  11. #include <stddef.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifdef HAVE_POINTF_S
  16. typedef pointf Point;
  17. #else
  18. typedef struct Point {
  19. double x, y;
  20. } Point;
  21. #endif
  22. extern double xmin, xmax, ymin, ymax; /* extreme x,y values of sites */
  23. extern double deltax; // xmax - xmin
  24. extern size_t nsites; // Number of sites
  25. extern int sqrt_nsites;
  26. extern void geominit(void);
  27. extern double dist_2(Point, Point); ///< distance squared between two points
  28. extern void subpt(Point * a, Point b, Point c);
  29. extern void addpt(Point * a, Point b, Point c);
  30. extern double area_2(Point a, Point b, Point c);
  31. extern int leftOf(Point a, Point b, Point c);
  32. extern int intersection(Point a, Point b, Point c, Point d, Point * p);
  33. #ifdef __cplusplus
  34. }
  35. #endif