Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_interpolate.c
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | static bool gpencil_stroke_need_flip(Depsgraph *depsgraph, | ||||
| float diff_mat[4][4]; | float diff_mat[4][4]; | ||||
| /* calculate parent matrix */ | /* calculate parent matrix */ | ||||
| BKE_gpencil_layer_transform_matrix_get(depsgraph, ob, gpl, diff_mat); | BKE_gpencil_layer_transform_matrix_get(depsgraph, ob, gpl, diff_mat); | ||||
| bGPDspoint *pt, pt_dummy_ps; | bGPDspoint *pt, pt_dummy_ps; | ||||
| float v_from_start[2], v_to_start[2], v_from_end[2], v_to_end[2]; | float v_from_start[2], v_to_start[2], v_from_end[2], v_to_end[2]; | ||||
| /* Line from start of strokes. */ | /* Line from start of strokes. */ | ||||
| pt = &gps_from->points[0]; | pt = &gps_from->points[0]; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps); | gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps); | ||||
| gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_start[0], &v_from_start[1]); | gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_start[0], &v_from_start[1]); | ||||
| pt = &gps_to->points[0]; | pt = &gps_to->points[0]; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps); | gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps); | ||||
| gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_start[0], &v_to_start[1]); | gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_start[0], &v_to_start[1]); | ||||
| /* Line from end of strokes. */ | /* Line from end of strokes. */ | ||||
| pt = &gps_from->points[gps_from->totpoints - 1]; | pt = &gps_from->points[gps_from->totpoints - 1]; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps); | gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps); | ||||
| gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_end[0], &v_from_end[1]); | gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_from_end[0], &v_from_end[1]); | ||||
| pt = &gps_to->points[gps_to->totpoints - 1]; | pt = &gps_to->points[gps_to->totpoints - 1]; | ||||
| gpencil_point_to_parent_space(pt, diff_mat, &pt_dummy_ps); | gpencil_point_to_world_space(pt, diff_mat, &pt_dummy_ps); | ||||
| gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_end[0], &v_to_end[1]); | gpencil_point_to_xy_fl(gsc, gps_from, &pt_dummy_ps, &v_to_end[0], &v_to_end[1]); | ||||
| const bool isect_lines = (isect_seg_seg_v2(v_from_start, v_to_start, v_from_end, v_to_end) == | const bool isect_lines = (isect_seg_seg_v2(v_from_start, v_to_start, v_from_end, v_to_end) == | ||||
| ISECT_LINE_LINE_CROSS); | ISECT_LINE_LINE_CROSS); | ||||
| /* If the vectors intersect. */ | /* If the vectors intersect. */ | ||||
| if (isect_lines) { | if (isect_lines) { | ||||
| /* For sharp angles, check distance between extremes. */ | /* For sharp angles, check distance between extremes. */ | ||||
| ▲ Show 20 Lines • Show All 1,617 Lines • Show Last 20 Lines | |||||