43 const bGPDspoint *pt3 = &points[int(totpoints * 0.75)];
75 const bGPDspoint *pt_last = &points[totpoints - 1];
79 points2d[totpoints - 1][0] =
dot_v3v3(tmp, locx);
80 points2d[totpoints - 1][1] =
dot_v3v3(tmp, locy);
85 float *co_prev =
reinterpret_cast<float *
>(&points2d[totpoints - 1]);
88 for (
int i = 0; i < totpoints - 1; i++) {
95 points2d[i][0] =
dot_v3v3(loc, locx);
96 points2d[i][1] =
dot_v3v3(loc, locy);
99 co_curr = (&points2d[i][0]);
100 cross += (co_curr[0] - co_prev[0]) * (co_curr[1] + co_prev[1]);
101 co_prev = (&points2d[i][0]);
105 *r_direction = (
cross >= 0.0f) ? 1 : -1;
119 const float center[2] = {0.5f, 0.5f};
121 d[0] = maxv[0] - minv[0];
122 d[1] = maxv[1] - minv[1];
123 for (
int i = 0; i < gps->
totpoints; i++) {
124 r_uv[i][0] = (points2d[i][0] - minv[0]) / d[0];
125 r_uv[i][1] = (points2d[i][1] - minv[1]) / d[1];
131 r_uv[i][0] -= center[0];
132 r_uv[i][1] -= center[1];
134 float x = r_uv[i][0] * c - r_uv[i][1] * s;
135 float y = r_uv[i][0] * s + r_uv[i][1] * c;
137 r_uv[i][0] =
x + center[0];
138 r_uv[i][1] =
y + center[1];
160 "GP Stroke temp triangulation");
162 "GP Stroke temp 2d points");
164 "GP Stroke temp 2d uv data");
192 for (
int i = 0; i < gps->
totpoints; i++) {
206 MEM_SAFE_DELETE(tmp_triangles);
207 MEM_SAFE_DELETE(points2d);
213 if (gps ==
nullptr || gps->
totpoints == 0) {
220 for (
int i = 1; i < gps->
totpoints; i++) {
228 if (gps ==
nullptr) {
Read Blender memory allocation and freeing.
#define ARRAY_SET_ITEMS(...)
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
void BKE_annotation_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
static void stroke_fill_triangulate(bGPDstroke *gps)
static void gpencil_calc_stroke_fill_uv(const float(*points2d)[2], bGPDstroke *gps, const float minv[2], const float maxv[2], float(*r_uv)[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
static void stroke_uv_update(bGPDstroke *gps)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float n[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
static void stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float