|
Blender V4.3
|
#include "testing/testing.h"#include "BLI_array.hh"#include "BLI_convexhull_2d.h"#include "BLI_math_angle_types.hh"#include "BLI_math_geom.h"#include "BLI_math_matrix.h"#include "BLI_math_matrix_types.hh"#include "BLI_math_rotation.h"#include "BLI_math_rotation.hh"#include "BLI_math_vector.h"#include "BLI_math_vector.hh"#include "BLI_math_vector_types.hh"#include "BLI_rand.hh"Go to the source code of this file.
Macros | |
| #define | DEFAULT_TEST_ITER 8 |
| #define | DEFAULT_TEST_POLY_NUM 12 |
| #define | DEFAULT_TEST_RANDOM_SEED 123 |
| #define | ROTATION_EPS 1e-6 |
Functions | |
Internal Utilities | |
| static blender::Array< float2 > | convexhull_points_from_map (blender::Span< float2 > points, blender::Span< int > points_map) |
| static blender::Array< float2 > | convexhull_2d_as_array (blender::Span< float2 > points) |
Wrap Public API's | |
| static float | convexhull_2d_aabb_fit_points_2d (blender::Span< float2 > points) |
Tests | |
| TEST (convexhull_2d, IsConvex) | |
| TEST (convexhull_2d, IsCCW) | |
| TEST (convexhull_2d, NOP) | |
| TEST (convexhull_2d, Lines_AxisAligned) | |
| TEST (convexhull_2d, Lines_Diagonal) | |
| TEST (convexhull_2d, Simple) | |
| TEST (convexhull_2d, Octagon) | |
| TEST (convexhull_2d, OctagonAxisAligned) | |
| TEST (convexhull_2d, Complex) | |
Test that convex hull calculation and fitting convex hulls to a bounding box is working properly.
Definition in file BLI_convexhull_2d_test.cc.
| #define DEFAULT_TEST_ITER 8 |
| #define DEFAULT_TEST_POLY_NUM 12 |
The size of a polygon when generating data.
Definition at line 40 of file BLI_convexhull_2d_test.cc.
| #define DEFAULT_TEST_RANDOM_SEED 123 |
|
static |
Definition at line 78 of file BLI_convexhull_2d_test.cc.
References BLI_convexhull_aabb_fit_points_2d().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
static |
Definition at line 62 of file BLI_convexhull_2d_test.cc.
References BLI_convexhull_2d(), convexhull_points_from_map(), and blender::Array< T, InlineBufferCapacity, Allocator >::data().
|
static |
Definition at line 51 of file BLI_convexhull_2d_test.cc.
References blender::Span< T >::size().
Referenced by convexhull_2d_as_array().
| TEST | ( | convexhull_2d | , |
| Complex | ) |
Generate complex rotated/translated shapes with a known size. Check the rotation returned by BLI_convexhull_aabb_fit_points_2d rotates the points into a bounding box with an area no larger than generated size.
Definition at line 321 of file BLI_convexhull_2d_test.cc.
References BLI_assert, convexhull_2d_aabb_fit_points_2d(), DEFAULT_TEST_ITER, DEFAULT_TEST_POLY_NUM, DEFAULT_TEST_RANDOM_SEED, blender::math::from_rotation(), blender::RandomNumberGenerator::get_float(), blender::RandomNumberGenerator::get_int32(), INIT_MINMAX2, M_PI, blender::math::min(), blender::math::min_max(), and size().
| TEST | ( | convexhull_2d | , |
| IsCCW | ) |
Definition at line 111 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_as_array(), cross_poly_v2(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), DEFAULT_TEST_ITER, DEFAULT_TEST_POLY_NUM, DEFAULT_TEST_RANDOM_SEED, blender::RandomNumberGenerator::get_float(), and blender::Array< T, InlineBufferCapacity, Allocator >::size().
| TEST | ( | convexhull_2d | , |
| IsConvex | ) |
Definition at line 90 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_as_array(), cross_tri_v2(), DEFAULT_TEST_ITER, DEFAULT_TEST_POLY_NUM, DEFAULT_TEST_RANDOM_SEED, blender::RandomNumberGenerator::get_float(), blender::Array< T, InlineBufferCapacity, Allocator >::size(), and UNLIKELY.
| TEST | ( | convexhull_2d | , |
| Lines_AxisAligned | ) |
| TEST | ( | convexhull_2d | , |
| Lines_Diagonal | ) |
Definition at line 210 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_aabb_fit_points_2d(), blender::math::AngleRadianBase< T >::from_degree(), and ROTATION_EPS.
| TEST | ( | convexhull_2d | , |
| NOP | ) |
Definition at line 127 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_aabb_fit_points_2d(), and ROTATION_EPS.
| TEST | ( | convexhull_2d | , |
| Octagon | ) |
Definition at line 272 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_aabb_fit_points_2d(), DEFAULT_TEST_ITER, DEFAULT_TEST_RANDOM_SEED, blender::math::AngleRadianBase< T >::from_degree(), ROTATION_EPS, blender::RandomNumberGenerator::shuffle(), and sin_cos_from_fraction().
| TEST | ( | convexhull_2d | , |
| OctagonAxisAligned | ) |
Definition at line 294 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_aabb_fit_points_2d(), DEFAULT_TEST_ITER, DEFAULT_TEST_RANDOM_SEED, blender::math::AngleRadianBase< T >::from_degree(), ROTATION_EPS, blender::RandomNumberGenerator::shuffle(), and sin_cos_from_fraction().
| TEST | ( | convexhull_2d | , |
| Simple | ) |
Definition at line 245 of file BLI_convexhull_2d_test.cc.
References convexhull_2d_aabb_fit_points_2d(), blender::math::AngleRadianBase< T >::from_degree(), and ROTATION_EPS.