Graphviz 13.0.0~dev.20241220.2304
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#include <stddef.h>
13
14#ifdef __cplusplus
15extern "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 */
34 void (*fn)(void *closure, const Ppoint_t tri[]),
35 void *vc);
36
37#undef TRI_API
38
40enum {
41 ISCCW = 1,
42 ISCW = 2,
43 ISON = 3,
44};
45
47int ccw(Ppoint_t p1, Ppoint_t p2, Ppoint_t p3);
48
50bool between(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc);
51
53bool intersects(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc, Ppoint_t pd);
54
55typedef Ppoint_t (*indexer_t)(void *base, size_t index);
56
58bool isdiagonal(size_t i, size_t ip2, void *pointp, size_t pointn,
59 indexer_t indexer);
60
61#ifdef __cplusplus
62}
63#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:121
bool isdiagonal(size_t i, size_t ip2, void *pointp, size_t pointn, indexer_t indexer)
is (i, i + 2) a diagonal?
Definition triang.c:91
bool between(Ppoint_t pa, Ppoint_t pb, Ppoint_t pc)
is pb between pa and pc?
Definition triang.c:139
int ccw(Ppoint_t p1, Ppoint_t p2, Ppoint_t p3)
are the given points counter-clockwise, clockwise, or co-linear?
Definition triang.c:23
#define TRI_API
Definition tri.h:29
TRI_API int Ptriangulate(Ppoly_t *polygon, void(*fn)(void *closure, const Ppoint_t tri[]), void *vc)
@ ISON
co-linear
Definition tri.h:43
@ ISCW
clockwise
Definition tri.h:42
@ ISCCW
counter-clockwise
Definition tri.h:41
Ppoint_t(* indexer_t)(void *base, size_t index)
Definition tri.h:55