Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
tri.h
Go to the documentation of this file.
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
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#include <pathgeom.h>
18
19#ifdef GVDLL
20#ifdef PATHPLAN_EXPORTS
21#define TRI_API __declspec(dllexport)
22#else
23#define TRI_API __declspec(dllimport)
24#endif
25#endif
26
27#ifndef TRI_API
28#define TRI_API /* nothing */
29#endif
30
31/* Points in polygon must be in CCW order */
33 void (*fn)(void *closure, Ppoint_t tri[]), void *vc);
34
35#undef TRI_API
36
38enum {
39 ISCCW = 1,
40 ISCW = 2,
41 ISON = 3,
42};
43
45int ccw(Ppoint_t p1, Ppoint_t p2, Ppoint_t p3);
46
48bool between(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc);
49
51bool intersects(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc, Ppoint_t pd);
52
53typedef Ppoint_t (*indexer_t)(void *base, int index);
54
56bool isdiagonal(int i, int ip2, void *pointp, int pointn, indexer_t indexer);
57
58#ifdef __cplusplus
59}
60#endif
struct Pxy_t Ppoint_t
Definition pathgeom.h:41
bool intersects(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc, Ppoint_t pd)
line to line intersection
Definition triang.c:124
bool between(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc)
is pb between pa and pc?
Definition triang.c:142
Ppoint_t(* indexer_t)(void *base, int index)
Definition tri.h:53
@ ISON
co-linear
Definition tri.h:41
@ ISCW
clockwise
Definition tri.h:40
@ ISCCW
counter-clockwise
Definition tri.h:39
TRI_API int Ptriangulate(Ppoly_t *polygon, void(*fn)(void *closure, Ppoint_t tri[]), void *vc)
int ccw(Ppoint_t p1, Ppoint_t p2, Ppoint_t p3)
are the given points counter-clockwise, clockwise, or co-linear?
Definition triang.c:24
#define TRI_API
Definition tri.h:28
bool isdiagonal(int i, int ip2, void *pointp, int pointn, indexer_t indexer)
is (i, i + 2) a diagonal?
Definition triang.c:95