Blender V5.3
BLI_polyfill_2d_test.cc File Reference
#include "testing/testing.h"
#include "MEM_guardedalloc.h"
#include "BLI_array_utils_c.hh"
#include "BLI_map.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_ordered_edge.hh"
#include "BLI_polyfill_2d.hh"
#include "BLI_utildefines.hh"
#include "BLI_heap.hh"
#include "BLI_memarena.hh"
#include "BLI_polyfill_2d_beautify.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define USE_COMBINATIONS_ALL
#define USE_BEAUTIFY
#define TRI_ERROR_VALUE   uint(-1)
#define TEST_POLYFILL_TEMPLATE_STATIC(poly, test_flag)
#define POLY_TRI_COUNT(len)

Enumerations

enum  blender::ePolyFill2DTestFlag { blender::POLYFILL2D_TEST_IS_DEGENERATE = (1 << 0) , blender::POLYFILL2D_TEST_NO_ZERO_AREA_TRIS = (1 << 1) , blender::POLYFILL2D_TEST_NOP = 0 }

Functions

static void blender::polyfill_to_obj (const char *id, const float poly[][2], const uint poly_num, const uint tris[][3], const uint tris_num)
static void blender::test_valid_polyfill_prepare (uint tris[][3], uint tris_num)
static void blender::test_polyfill_simple (const float[][2], const uint poly_num, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_topology (const float[][2], const uint poly_num, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_winding (const float poly[][2], const uint, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_area (const float poly[][2], const uint poly_num, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_area_tri_nonzero (const float poly[][2], const uint, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_template_check (const char *id, const ePolyFill2DTestFlag test_flag, const float poly[][2], const uint poly_num, const uint tris[][3], const uint tris_num)
static void blender::test_polyfill_template (const char *id, const ePolyFill2DTestFlag test_flag, const float poly[][2], const uint poly_num, uint tris[][3], const uint tris_num)
static void blender::test_polyfill_template_flip_sign (const char *id, const ePolyFill2DTestFlag test_flag, const float poly[][2], const uint poly_num, uint tris[][3], const uint tris_num)
static void blender::test_polyfill_template_main (const char *id, const ePolyFill2DTestFlag test_flag, const float poly[][2], const uint poly_num, uint tris[][3], const uint tris_num)
 blender::TEST (polyfill2d, TriangleCCW)
 blender::TEST (polyfill2d, SquareCCW)
 blender::TEST (polyfill2d, SquareCW)
 blender::TEST (polyfill2d, Starfleet)
 blender::TEST (polyfill2d, StarfleetDegenerate)
 blender::TEST (polyfill2d, 3Colinear)
 blender::TEST (polyfill2d, 4Colinear)
 blender::TEST (polyfill2d, UnorderedColinear)
 blender::TEST (polyfill2d, PlusShape)
 blender::TEST (polyfill2d, StarShape)
 blender::TEST (polyfill2d, UShape)
 blender::TEST (polyfill2d, Spiral)
 blender::TEST (polyfill2d, TestFlipCode)
 blender::TEST (polyfill2d, SelfIntersect)
 blender::TEST (polyfill2d, SelfTouch)
 blender::TEST (polyfill2d, SelfOverlap)
 blender::TEST (polyfill2d, TestDavData)
 blender::TEST (polyfill2d, Issue815)
 blender::TEST (polyfill2d, Issue207_1)
 blender::TEST (polyfill2d, Issue207_11)
 blender::TEST (polyfill2d, Issue1407)
 blender::TEST (polyfill2d, Issue1407_pt)
 blender::TEST (polyfill2d, IssueT40777_colinear)
 blender::TEST (polyfill2d, IssueT41986_axis_align)
 blender::TEST (polyfill2d, IssueT52834_axis_align_co_linear)
 blender::TEST (polyfill2d, IssueT67109_axis_align_co_linear_a)
 blender::TEST (polyfill2d, IssueT67109_axis_align_co_linear_b)
 blender::TEST (polyfill2d, IssueT67109_axis_align_co_linear_c)
 blender::TEST (polyfill2d, Issue103913_axis_align_co_linear_no_zero_area_tri)

Macro Definition Documentation

◆ POLY_TRI_COUNT

#define POLY_TRI_COUNT ( len)
Value:
((len) - 2)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263

Script to generate the data below:

# This example assumes we have a mesh object in edit-mode
import bpy
import bmesh
obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
def clean_float(num):
if int(num) == num:
return str(int(num))
prec = 1
while True:
text = f"{num:.{prec}f}"
if float(text) == num:
return text
prec += 1
for f in bm.faces:
if f.select:
print(f"\t// data for face: {f.index}")
print("\tconst float poly[][2] = {", end="")
coords = [[clean_float(num) for num in l.vert.co[0:2]] for l in f.loops]
print("\t ", end="")
for i, (x, y) in enumerate(coords):
if (i % 2) == 0:
print("\n\t ", end="")
print(f"{{{x}, {y}}}", end=",")
print("\n\t};")
#define str(s)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float

Definition at line 400 of file BLI_polyfill_2d_test.cc.

◆ TEST_POLYFILL_TEMPLATE_STATIC

#define TEST_POLYFILL_TEMPLATE_STATIC ( poly,
test_flag )
Value:
{ \
uint tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \
const uint poly_num = ARRAY_SIZE(poly); \
const uint tris_num = ARRAY_SIZE(tris); \
const char *id = typeid(*this).name(); \
\
test_polyfill_template_main(id, test_flag, poly, poly_num, tris, tris_num); \
} \
(void)0
#define POLY_TRI_COUNT(len)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept

Definition at line 305 of file BLI_polyfill_2d_test.cc.

Referenced by blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), blender::TEST(), and blender::TEST().

◆ TRI_ERROR_VALUE

#define TRI_ERROR_VALUE   uint(-1)

◆ USE_BEAUTIFY

#define USE_BEAUTIFY

Definition at line 12 of file BLI_polyfill_2d_test.cc.

◆ USE_COMBINATIONS_ALL

#define USE_COMBINATIONS_ALL

Definition at line 11 of file BLI_polyfill_2d_test.cc.