Blender V4.3
BLI_scanfill.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11struct ScanFillVert;
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct ScanFillContext {
21
22 /* increment this value before adding each curve to skip having to calculate
23 * 'poly_nr' for edges and verts (which can take approx half scan-fill time) */
24 unsigned short poly_nr;
25
26 /* private */
27 struct MemArena *arena;
29
30#define BLI_SCANFILL_ARENA_SIZE MEM_SIZE_OPTIMAL(1 << 14)
31
37#define SF_POLY_UNSET ((unsigned short)-1)
38
39typedef struct ScanFillVert {
41 union {
42 struct ScanFillVert *v;
43 void *p;
44 int i;
45 unsigned int u;
46 } tmp;
48 float co[3];
50 float xy[2];
52 unsigned int keyindex;
53 unsigned short poly_nr;
55 unsigned char edge_count;
57 unsigned int f : 4;
59 unsigned int user_flag : 4;
61
62typedef struct ScanFillEdge {
64 struct ScanFillVert *v1, *v2;
65 unsigned short poly_nr;
66 unsigned int f : 4; /* edge status */
67 unsigned int user_flag : 4; /* flag callers can use as they like */
68 union {
69 unsigned char c;
70 } tmp;
72
73typedef struct ScanFillFace {
75 struct ScanFillVert *v1, *v2, *v3;
77
78/* scanfill.c */
79
80struct ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]);
82 struct ScanFillVert *v1,
83 struct ScanFillVert *v2);
84
85enum {
86 /* NOTE(@ideasman42): using #BLI_SCANFILL_CALC_REMOVE_DOUBLES
87 * Assumes ordered edges, otherwise we risk an eternal loop
88 * removing double verts. */
90
91 /* calculate isolated polygons */
93
94 /* NOTE: This flag removes checks for overlapping polygons.
95 * when this flag is set, we'll never get back more faces than (totvert - 2) */
97
98 /* checks valid edge users - can skip for simple loops */
100};
102unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag);
103unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3]);
105
106void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
107void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena);
108
109/* scanfill_utils.c */
110
117 ListBase *remvertbase,
118 ListBase *remedgebase);
119
120#ifdef __cplusplus
121}
122#endif
void BLI_scanfill_begin(ScanFillContext *sf_ctx)
Definition scanfill.c:791
@ BLI_SCANFILL_CALC_LOOSE
@ BLI_SCANFILL_CALC_POLYS
@ BLI_SCANFILL_CALC_HOLES
@ BLI_SCANFILL_CALC_REMOVE_DOUBLES
struct ScanFillFace ScanFillFace
unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag)
Definition scanfill.c:1152
struct ScanFillVert * BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
Definition scanfill.c:95
void BLI_scanfill_end(ScanFillContext *sf_ctx)
Definition scanfill.c:805
struct ScanFillEdge * BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2)
Definition scanfill.c:117
struct ScanFillEdge ScanFillEdge
struct ScanFillVert ScanFillVert
void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.c:798
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3])
Definition scanfill.c:825
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.c:815
struct ScanFillContext ScanFillContext
bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBase *remvertbase, ListBase *remedgebase)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
struct MemArena * arena
ListBase fillvertbase
ListBase filledgebase
unsigned short poly_nr
ListBase fillfacebase
struct ScanFillEdge * prev
unsigned short poly_nr
union ScanFillEdge::@115 tmp
struct ScanFillVert * v1
struct ScanFillVert * v2
unsigned char c
unsigned int f
struct ScanFillEdge * next
unsigned int user_flag
struct ScanFillFace * next
struct ScanFillVert * v2
struct ScanFillVert * v3
struct ScanFillFace * prev
struct ScanFillVert * v1
float xy[2]
unsigned short poly_nr
unsigned int f
unsigned char edge_count
struct ScanFillVert * next
float co[3]
struct ScanFillVert * v
unsigned int user_flag
unsigned int u
struct ScanFillVert * prev
union ScanFillVert::@114 tmp
unsigned int keyindex
uint8_t flag
Definition wm_window.cc:138