Blender V5.0
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
10
11#include "DNA_listBase.h"
12
13#include <stdbool.h>
14
15struct ScanFillVert;
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);
void BLI_scanfill_begin(ScanFillContext *sf_ctx)
Definition scanfill.cc:775
unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag)
Definition scanfill.cc:1131
@ BLI_SCANFILL_CALC_LOOSE
@ BLI_SCANFILL_CALC_POLYS
@ BLI_SCANFILL_CALC_HOLES
@ BLI_SCANFILL_CALC_REMOVE_DOUBLES
struct ScanFillVert * BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
Definition scanfill.cc:100
void BLI_scanfill_end(ScanFillContext *sf_ctx)
Definition scanfill.cc:789
struct ScanFillEdge * BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2)
Definition scanfill.cc:122
void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.cc:782
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3])
Definition scanfill.cc:809
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, struct MemArena *arena)
Definition scanfill.cc:799
bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, ListBase *remvertbase, ListBase *remedgebase)
These structs are the foundation for all linked lists in the library system.
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
struct ScanFillVert * v1
struct ScanFillVert * v2
unsigned char c
union ScanFillEdge::@026355123305312163137370333220125272167065274016 tmp
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
union ScanFillVert::@316106002035155215355067045167356240017116022023 tmp
unsigned int u
struct ScanFillVert * prev
unsigned int keyindex
uint8_t flag
Definition wm_window.cc:145