[Bf-blender-cvs] [d60d0368800] lineart-shadow: Merge branch 'temp-lineart-contained' into lineart-shadow
YimingWu
noreply at git.blender.org
Tue Jul 20 11:23:07 CEST 2021
Commit: d60d036880033354d079f9436a008d526817207a
Author: YimingWu
Date: Tue Jul 20 14:10:45 2021 +0800
Branches: lineart-shadow
https://developer.blender.org/rBd60d036880033354d079f9436a008d526817207a
Merge branch 'temp-lineart-contained' into lineart-shadow
===================================================================
===================================================================
diff --cc source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 15fac94d4a9,386c7be5379..bf227d454bb
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@@ -644,94 -596,10 +644,94 @@@ BLI_INLINE int lineart_LineIntersectTes
#endif
}
+BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(
+ const double *a1, const double *a2, const double *b1, const double *b2, double *aRatio)
+{
+#define USE_VECTOR_LINE_INTERSECTION_IGN
+#ifdef USE_VECTOR_LINE_INTERSECTION_IGN
+
+ /* from isect_line_line_v2_point() */
+
+ double s10[2], s32[2];
+ double div;
+
+ sub_v2_v2v2_db(s10, a2, a1);
+ sub_v2_v2v2_db(s32, b2, b1);
+
+ div = cross_v2v2_db(s10, s32);
+ if (div != 0.0f) {
+ const double u = cross_v2v2_db(a2, a1);
+ const double v = cross_v2v2_db(b2, b1);
+
+ const double rx = ((s32[0] * u) - (s10[0] * v)) / div;
+ const double ry = ((s32[1] * u) - (s10[1] * v)) / div;
+
+ if (fabs(a2[0] - a1[0]) > fabs(a2[1] - a1[1])) {
+ *aRatio = ratiod(a1[0], a2[0], rx);
+ if ((*aRatio) >= -DBL_EDGE_LIM && (*aRatio) <= 1 + DBL_EDGE_LIM) {
+ return 1;
+ }
+ return 0;
+ }
+
+ *aRatio = ratiod(a1[1], a2[1], ry);
+ if ((*aRatio) >= -DBL_EDGE_LIM && (*aRatio) <= 1 + DBL_EDGE_LIM) {
+ return 1;
+ }
+ return 0;
+ }
+ return 0;
+
+#else
+ double k1, k2;
+ double x;
+ double y;
+ double ratio;
+ double x_diff = (a2[0] - a1[0]);
+ double x_diff2 = (b2[0] - b1[0]);
+
+ if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff, 0)) {
+ if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
+ *aRatio = 0;
+ return 0;
+ }
+ double r2 = ratiod(b1[0], b2[0], a1[0]);
+ x = interpd(b2[0], b1[0], r2);
+ y = interpd(b2[1], b1[1], r2);
+ *aRatio = ratio = ratiod(a1[1], a2[1], y);
+ }
+ else {
+ if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
+ ratio = ratiod(a1[0], a2[0], b1[0]);
+ x = interpd(a2[0], a1[0], ratio);
+ *aRatio = ratio;
+ }
+ else {
+ k1 = (a2[1] - a1[1]) / x_diff;
+ k2 = (b2[1] - b1[1]) / x_diff2;
+
+ if ((k1 == k2))
+ return 0;
+
+ x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
+
+ ratio = (x - a1[0]) / x_diff;
+
+ *aRatio = ratio;
+ }
+ }
+
+ if (ratio <= 0 || ratio >= 1)
+ return 0;
+
+ return 1;
+#endif
+}
+
struct Depsgraph;
- struct Scene;
- struct LineartRenderBuffer;
struct LineartGpencilModifierData;
+ struct LineartRenderBuffer;
+ struct Scene;
void MOD_lineart_destroy_render_data(struct LineartGpencilModifierData *lmd);
More information about the Bf-blender-cvs
mailing list