Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
site.c
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 <
neatogen/mem.h
>
12
#include <
neatogen/site.h
>
13
#include <math.h>
14
15
16
int
siteidx
;
17
Site
*
bottomsite
;
18
19
static
Freelist
sfl
;
20
static
size_t
nvertices
;
21
22
void
siteinit
(
void
)
23
{
24
freeinit
(&
sfl
,
sizeof
(
Site
));
25
nvertices
= 0;
26
}
27
28
29
Site
*
getsite
(
void
)
30
{
31
return
getfree
(&
sfl
);
32
}
33
34
double
dist
(
Site
*
s
,
Site
* t)
35
{
36
double
ans;
37
double
dx
,
dy
;
38
39
dx
=
s
->coord.x - t->
coord
.
x
;
40
dy
=
s
->coord.y - t->
coord
.
y
;
41
ans = hypot(
dx
,
dy
);
42
return
ans;
43
}
44
45
46
void
makevertex
(
Site
* v)
47
{
48
v->
sitenbr
=
nvertices
;
49
++
nvertices
;
50
}
51
52
void
deref
(
Site
* v)
53
{
54
--v->
refcnt
;
55
if
(v->
refcnt
== 0)
56
makefree
(v, &
sfl
);
57
}
58
59
void
ref
(
Site
* v)
60
{
61
++v->
refcnt
;
62
}
dy
static float dy
Definition
draw.c:38
dx
static float dx
Definition
draw.c:37
mem.h
getfree
void * getfree(Freelist *)
Definition
memory.c:60
makefree
void makefree(void *, Freelist *)
Definition
memory.c:83
freeinit
void freeinit(Freelist *, int)
Definition
memory.c:41
sfl
static Freelist sfl
Definition
site.c:19
siteidx
int siteidx
Definition
site.c:16
nvertices
static size_t nvertices
Definition
site.c:20
ref
void ref(Site *v)
Definition
site.c:59
siteinit
void siteinit(void)
Definition
site.c:22
deref
void deref(Site *v)
Definition
site.c:52
dist
double dist(Site *s, Site *t)
Definition
site.c:34
getsite
Site * getsite(void)
Definition
site.c:29
bottomsite
Site * bottomsite
Definition
site.c:17
makevertex
void makevertex(Site *v)
Definition
site.c:46
site.h
Point::x
double x
Definition
geometry.h:23
Point::y
double y
Definition
geometry.h:23
Site
Definition
site.h:22
Site::coord
Point coord
Definition
site.h:23
Site::sitenbr
size_t sitenbr
Definition
site.h:24
Site::refcnt
unsigned refcnt
Definition
site.h:25
freelist
Definition
mem.h:21
s
Definition
grammar.c:93
lib
neatogen
site.c
Generated by
1.9.8