|
Graphviz 16.1.0~dev.20260902.0144
|
#include "config.h"#include <assert.h>#include <common/boxes.h>#include <common/geomprocs.h>#include <limits.h>#include <ortho/partition.h>#include <ortho/trap.h>#include <math.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <util/alloc.h>#include <util/bitarray.h>#include <util/gv_math.h>#include <util/list.h>#include <util/prisize_t.h>Go to the source code of this file.
Data Structures | |
| struct | monchain_t |
| struct | vertexchain_t |
Macros | |
| #define | DEBUG 0 |
| #define | NPOINTS 4 /* only rectangles */ |
| #define | TR_FROM_UP 1 /* for traverse-direction */ |
| #define | TR_FROM_DN 2 |
| #define | SP_SIMPLE_LRUP 1 /* for splitting trapezoids */ |
| #define | SP_SIMPLE_LRDN 2 |
| #define | SP_2UP_2DN 3 |
| #define | SP_2UP_LEFT 4 |
| #define | SP_2UP_RIGHT 5 |
| #define | SP_2DN_LEFT 6 |
| #define | SP_2DN_RIGHT 7 |
| #define | SP_NOSPLIT -1 |
| #define | DOT(v0, v1) ((v0).x * (v1).x + (v0).y * (v1).y) |
| #define | CROSS_SINE(v0, v1) ((v0).x * (v1).y - (v1).x * (v0).y) |
| #define | LENGTH(v0) hypot((v0).x, (v0).y) |
| #define | srand48 srand |
| #define | newmon() (++mon_idx) |
| #define | new_chain_element() (++chain_idx) |
Functions | |
| static void | convert (boxf bb, int flip, int ccw, pointf *pts) |
| static int | store (segment_t *seg, int first, pointf *pts) |
| static void | genSegments (cell *cells, size_t ncells, boxf bb, segment_t *seg, int flip) |
| static void | generateRandomOrdering (size_t n, int *permute) |
| static bool | inside_polygon (trap_t *t, segment_t *seg) |
| static double | get_angle (pointf vp0, pointf vpnext, pointf vp1) |
| static void | get_vertex_positions (const vertexchain_t *vert, int v0, int v1, int *ip, int *iq) |
| static size_t | make_new_monotone_poly (vertexchain_t *vert, monchain_t *chain, size_t mcur, int v0, int v1) |
| static void | traverse_polygon (vertexchain_t *vert, bitarray_t *visited, boxes_t *decomp, segment_t *seg, traps_t *tr, size_t mcur, size_t trnum, size_t from, int flip, int dir, monchain_t *chain) |
| static void | monotonate_trapezoids (int nsegs, segment_t *seg, traps_t *tr, int flip, boxes_t *decomp) |
| static bool | rectIntersect (boxf *d, const boxf r0, const boxf r1) |
| boxf * | partition (cell *cells, size_t ncells, size_t *nrects, boxf bb) |
| partitions space around cells (nodes) into rectangular tiles | |
Variables | |
| static int | chain_idx |
| static size_t | mon_idx |
| static int * | mon |
| #define CROSS_SINE | ( | v0, | |
| v1 | |||
| ) | ((v0).x * (v1).y - (v1).x * (v0).y) |
Definition at line 48 of file partition.c.
| #define DEBUG 0 |
Definition at line 30 of file partition.c.
| #define DOT | ( | v0, | |
| v1 | |||
| ) | ((v0).x * (v1).x + (v0).y * (v1).y) |
Definition at line 47 of file partition.c.
| #define LENGTH | ( | v0 | ) | hypot((v0).x, (v0).y) |
Definition at line 49 of file partition.c.
| #define new_chain_element | ( | ) | (++chain_idx) |
Definition at line 81 of file partition.c.
| #define newmon | ( | ) | (++mon_idx) |
Definition at line 79 of file partition.c.
| #define NPOINTS 4 /* only rectangles */ |
Definition at line 33 of file partition.c.
| #define SP_2DN_LEFT 6 |
Definition at line 43 of file partition.c.
| #define SP_2DN_RIGHT 7 |
Definition at line 44 of file partition.c.
| #define SP_2UP_2DN 3 |
Definition at line 40 of file partition.c.
| #define SP_2UP_LEFT 4 |
Definition at line 41 of file partition.c.
| #define SP_2UP_RIGHT 5 |
Definition at line 42 of file partition.c.
| #define SP_NOSPLIT -1 |
Definition at line 45 of file partition.c.
| #define SP_SIMPLE_LRDN 2 |
Definition at line 39 of file partition.c.
| #define SP_SIMPLE_LRUP 1 /* for splitting trapezoids */ |
Definition at line 38 of file partition.c.
| #define srand48 srand |
Definition at line 52 of file partition.c.
| #define TR_FROM_DN 2 |
Definition at line 36 of file partition.c.
| #define TR_FROM_UP 1 /* for traverse-direction */ |
Definition at line 35 of file partition.c.
Definition at line 84 of file partition.c.
References ccw(), boxf::LL, NPOINTS, perp(), boxf::UR, pointf_s::x, and pointf_s::y.
Referenced by genSegments().
|
static |
Definition at line 147 of file partition.c.
References drand48(), and SWAP.
Referenced by partition().
Definition at line 133 of file partition.c.
References convert(), and store().
Referenced by partition().
Definition at line 179 of file partition.c.
References CROSS_SINE, DOT, LENGTH, and sub_pointf().
Referenced by get_vertex_positions().
|
static |
(v0, v1) is the new diagonal to be added to the polygon. Find which chain to use and return the positions of v0 and v1 in p and q
| vert | Chain initial information |
Definition at line 192 of file partition.c.
References get_angle(), vertexchain_t::pt, and vertexchain_t::vnext.
Referenced by make_new_monotone_poly().
Definition at line 163 of file partition.c.
References trap_t::d0, trap_t::d1, greater_than(), trap_t::is_valid, is_valid_trap(), trap_t::lseg, trap_t::rseg, trap_t::u0, and trap_t::u1.
Referenced by monotonate_trapezoids().
|
static |
Definition at line 243 of file partition.c.
References get_vertex_positions(), mon, new_chain_element, newmon, monchain_t::next, vertexchain_t::nextfree, monchain_t::prev, PRISIZE_T, vertexchain_t::vnext, monchain_t::vnum, and vertexchain_t::vpos.
Referenced by traverse_polygon().
|
static |
Definition at line 569 of file partition.c.
References bitarray_new(), bitarray_reset(), chain_idx, free(), gv_calloc(), inside_polygon(), is_valid_trap(), LIST_AT, LIST_GET, LIST_SIZE, mon, mon_idx, monchain_t::next, segment_t::next, vertexchain_t::nextfree, monchain_t::prev, segment_t::prev, vertexchain_t::pt, TR_FROM_DN, TR_FROM_UP, traverse_polygon(), segment_t::v0, vertexchain_t::vnext, monchain_t::vnum, and vertexchain_t::vpos.
Referenced by partition().
| [in] | cells | rectangular borders of user's input graph's nodes |
| [in] | bb | range of the space to partition |
| [out] | nrects | number of tiles |
Definition at line 666 of file partition.c.
References construct_trapezoids(), DEBUG, free(), generateRandomOrdering(), genSegments(), gv_calloc(), LIST_APPEND, LIST_DETACH, LIST_FREE, LIST_GET, LIST_SIZE, monotonate_trapezoids(), NULL, PRISIZE_T, rectIntersect(), srand48, segment_t::v0, and pointf_s::y.
Referenced by mkMaze().
Definition at line 623 of file partition.c.
References boxf::LL, boxf::UR, pointf_s::x, and pointf_s::y.
Referenced by partition().
Definition at line 109 of file partition.c.
References segment_t::is_inserted, last, segment_t::next, NPOINTS, segment_t::prev, segment_t::v0, and segment_t::v1.
Referenced by genSegments(), update_tree(), and update_tree_store().
|
static |
recursively visit all the trapezoids
| vert | Chain initial information |
| chain | Monotone polygon chain to operate on |
Definition at line 305 of file partition.c.
References bitarray_get(), bitarray_set(), C_EPS, trap_t::d0, trap_t::d1, equal_to(), fp_equal(), trap_t::hi, is_valid_trap(), LIST_APPEND, LIST_AT, LIST_GET, boxf::LL, trap_t::lo, trap_t::lseg, make_new_monotone_poly(), segment_t::next, trap_t::rseg, TR_FROM_DN, TR_FROM_UP, traverse_polygon(), trap_t::u0, trap_t::u1, boxf::UR, segment_t::v0, segment_t::v1, pointf_s::x, and pointf_s::y.
Referenced by monotonate_trapezoids(), and traverse_polygon().
|
static |
Definition at line 72 of file partition.c.
Referenced by monotonate_trapezoids().
|
static |
Definition at line 76 of file partition.c.
Referenced by make_new_monotone_poly(), and monotonate_trapezoids().
|
static |
Definition at line 73 of file partition.c.
Referenced by monotonate_trapezoids().