| 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 |
|
| 11 |
#include <stdbool.h> |
| 12 |
#include <stddef.h> |
| 13 |
|
| 14 |
#ifdef __cplusplus |
| 15 |
extern "C" { |
| 16 |
#endif |
| 17 |
|
| 18 |
#include <pathgeom.h> |
| 19 |
|
| 20 |
#ifdef GVDLL |
| 21 |
#ifdef PATHPLAN_EXPORTS |
| 22 |
#define TRI_API __declspec(dllexport) |
| 23 |
#else |
| 24 |
#define TRI_API __declspec(dllimport) |
| 25 |
#endif |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifndef TRI_API |
| 29 |
#define TRI_API /* nothing */ |
| 30 |
#endif |
| 31 |
|
| 32 |
/* Points in polygon must be in CCW order */ |
| 33 |
TRI_API int Ptriangulate(Ppoly_t *polygon, |
| 34 |
void (*fn)(void *closure, const Ppoint_t tri[]), |
| 35 |
void *vc); |
| 36 |
|
| 37 |
#undef TRI_API |
| 38 |
|
| 39 |
/// return value from `ccw` |
| 40 |
enum { |
| 41 |
ISCCW = 1, ///< counter-clockwise |
| 42 |
ISCW = 2, ///< clockwise |
| 43 |
ISON = 3, ///< co-linear |
| 44 |
}; |
| 45 |
|
| 46 |
/// are the given points counter-clockwise, clockwise, or co-linear? |
| 47 |
int ccw(Ppoint_t p1, Ppoint_t p2, Ppoint_t p3); |
| 48 |
|
| 49 |
typedef Ppoint_t (*indexer_t)(void *base, size_t index); |
| 50 |
|
| 51 |
/// is (i, i + 2) a diagonal? |
| 52 |
bool isdiagonal(size_t i, size_t ip2, void *pointp, size_t pointn, |
| 53 |
indexer_t indexer); |
| 54 |
|
| 55 |
#ifdef __cplusplus |
| 56 |
} |
| 57 |
#endif |