40 const bGPDspoint *pt3 = &points[int(totpoints * 0.75)];
72 const bGPDspoint *pt_last = &points[totpoints - 1];
76 points2d[totpoints - 1][0] =
dot_v3v3(tmp, locx);
77 points2d[totpoints - 1][1] =
dot_v3v3(tmp, locy);
82 float *co_prev = (
float *)&points2d[totpoints - 1];
85 for (
int i = 0;
i < totpoints - 1;
i++) {
96 co_curr = (&points2d[
i][0]);
97 cross += (co_curr[0] - co_prev[0]) * (co_curr[1] + co_prev[1]);
98 co_prev = (&points2d[
i][0]);
102 *r_direction = (
cross >= 0.0f) ? 1 : -1;
116 const float center[2] = {0.5f, 0.5f};
118 d[0] = maxv[0] - minv[0];
119 d[1] = maxv[1] - minv[1];
121 r_uv[
i][0] = (points2d[
i][0] - minv[0]) / d[0];
122 r_uv[
i][1] = (points2d[
i][1] - minv[1]) / d[1];
128 r_uv[
i][0] -= center[0];
129 r_uv[
i][1] -= center[1];
131 float x = r_uv[
i][0] * c - r_uv[
i][1] * s;
132 float y = r_uv[
i][0] * s + r_uv[
i][1] * c;
134 r_uv[
i][0] =
x + center[0];
135 r_uv[
i][1] =
y + center[1];
157 "GP Stroke temp triangulation");
159 "GP Stroke temp 2d points");
161 "GP Stroke temp 2d uv data");
183 "GP Stroke triangulation");
211 if (gps ==
nullptr || gps->
totpoints == 0) {
226 if (gps ==
nullptr) {
272 for (
int i = 0;
i < totpoints;
i++) {
273 pt_final = &join_stroke->
points[
i];
275 pt = &gps_last->
points[e1];
279 pt = &gps_first->
points[e2];
287 pt_final->
time = delta;
296 if ((gps_first->
dvert !=
nullptr) || (gps_last->
dvert !=
nullptr)) {
304 for (
int i = 0;
i < totpoints;
i++) {
305 dvert_dst = &join_stroke->
dvert[
i];
308 if (gps_last->
dvert) {
309 dvert_src = &gps_last->
dvert[e1];
314 if (gps_first->
dvert) {
315 dvert_src = &gps_first->
dvert[e2];
320 if ((dvert_src) && (dvert_src->
dw)) {
361 bool in_island =
false;
371 if (pt->
flag & tag_flags) {
381 idx = num_islands - 1;
389 idx = num_islands - 1;
402 for (idx = 0; idx < num_islands; idx++) {
410 if ((
is_cyclic) && (gps_first ==
nullptr)) {
411 gps_first = new_stroke;
421 "gp delete stroke fragment");
422 memcpy(
static_cast<void *
>(new_stroke->
points),
427 if (gps->
dvert !=
nullptr) {
430 "gp delete stroke fragment weight");
431 memcpy(new_stroke->
dvert,
459 new_stroke->
inittime += double(delta);
462 for (j = 0; j < new_stroke->
totpoints; j++, pts++) {
474 if ((limit > 0) && (new_stroke->
totpoints <= limit)) {
475 if (gps_first == new_stroke) {
493 if ((
is_cyclic) && (gps_first !=
nullptr) && (gps_first != new_stroke)) {
struct bGPDstroke * BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src, bool dup_points, bool dup_curve)
void BKE_gpencil_free_stroke(struct bGPDstroke *gps)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float n[3])
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
#define ARRAY_SET_ITEMS(...)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static bool is_cyclic(const Nurb *nu)
static void gpencil_stroke_join_islands(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last)
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])
bGPDstroke * BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags, const bool select, const bool flat_cap, const int limit)
void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
void BKE_gpencil_stroke_uv_update(bGPDstroke *gps)
void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
void BKE_gpencil_stroke_geometry_update(bGPdata *, bGPDstroke *gps)
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
VecBase< float, 3 > float3
struct MDeformVert * dvert