Commit: 33ea84f629de01df569f89df26109d5e68f28e6e
Author: Charlie Jolly
Date: Thu Oct 17 13:20:43 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB33ea84f629de01df569f89df26109d5e68f28e6e
GPencil: Guides: Use angle sampling for Circular guide
Use angle sampling for missing points, this fixes fast stroke issues finally.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c
b/source/blender/editors/gpencil/gpencil_paint.c
index 027e90f1e07..bc4707d226b 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -3582,18 +3582,25 @@ static void gpencil_add_guide_points(const tGPsdata *p,
/* Use arc sampling for circular guide */
if (guide->type == GP_GUIDE_CIRCULAR) {
- float step = M_PI_2 / (float)(segments + 1);
- float a = step;
float start[2], end[2], midpoint[2];
copy_v2_v2(start, p->mvalo);
copy_v2_v2(end, mval);
copy_v2_v2(midpoint, p->guide.origin);
+ float cw = cross_tri_v2(start, p->guide.origin, end);
+ float angle = angle_v2v2v2(start, p->guide.origin, end);
+
+ float step = angle / (float)(segments + 1);
+ if (cw < 0.0f) {
+ step = -step;
+ }
+
+ float a = step;
+
for (int i = 0; i < segments; i++) {
pt = &points[idx_old + i - 1];
- pt->x = midpoint[0] + (end[0] - midpoint[0]) * sinf(a) + (start[0] -
midpoint[0]) * cosf(a);
- pt->y = midpoint[1] + (end[1] - midpoint[1]) * sinf(a) + (start[1] -
midpoint[1]) * cosf(a);
+ gp_rotate_v2_v2v2fl(&pt->x, start, p->guide.origin, -a);
gpencil_snap_to_guide(p, guide, &pt->x);
a += step;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs