47 if ((side12 == 0.0f && side23 >= 0.0f && side31 >= 0.0f) ||
48 (side12 >= 0.0f && side23 == 0.0f && side31 >= 0.0f) ||
49 (side12 >= 0.0f && side23 >= 0.0f && side31 == 0.0f))
53 if ((side12 == 0.0f && side23 <= 0.0f && side31 <= 0.0f) ||
54 (side12 <= 0.0f && side23 == 0.0f && side31 <= 0.0f) ||
55 (side12 <= 0.0f && side23 <= 0.0f && side31 == 0.0f))
61 if (side12 >= 0.0f && side23 >= 0.0f && side31 >= 0.0f) {
64 if (side12 <= 0.0f && side23 <= 0.0f && side31 <= 0.0f) {
76 int twice_winding = 0;
77 const float2 &tri_p1 = poly[0];
79 const float2 &tri_p2 = poly[i];
80 const float2 &tri_p3 = poly[i + 1];
90 return int(twice_winding / 2);
104 if (winding_i == 0) {
108 if (orders_per_curve_.contains(curve_i)) {
109 orders_per_curve_.lookup(curve_i) += winding_i;
112 orders_per_curve_.add(curve_i, winding_i);
118 auto it_begin = orders_per_curve_.items().begin();
119 auto it_end = orders_per_curve_.items().end();
120 for (
auto it = it_begin; it != it_end; it++) {
121 if ((*it).value == 0) {
122 orders_per_curve_.remove(it);
131 const Span<int> shape = shapes[shape_id];
132 for (
const int curve_i : shape) {
133 if (orders_per_curve_.contains(curve_i)) {
134 winding += orders_per_curve_.lookup(curve_i);
138 return winding % 2 != 0;
143 if (orders_per_curve_.is_empty() || shape_mask.
is_empty()) {
156 if (this->is_in_shape(shape_i, shapes)) {
169 const int subject_shape,
172 const bool subj = this->
is_in_shape(subject_shape, shapes);
173 const bool clip = this->
is_in_shapes(clipping_shapes, shapes);
180 return subj && !clip;
217 const int curve_i =
segment.curve;
228 point1 = all_positions[
segment.src_points.first()];
242 int end_index = first_end_index;
244 point2 = all_positions[end_index];
248 end_index =
segment.wrap_index(end_index + 1);
249 point2 = all_positions[end_index];
252 if (end_index == first_end_index) {
267 const float2 l_point = mid_point + tan_dir * eps_dis;
268 const float2 r_point = mid_point - tan_dir * eps_dis;
271 const Span<int> shape_j = shapes[shape_j_index];
272 for (
const int curve_j : shape_j) {
273 if (curve_j == curve_i) {
277 const IndexRange points_j = points_by_curve[curve_j];
290 if (is_fill[curve_i]) {
291 const IndexRange points_i = points_by_curve[curve_i];
305 return {state_L, state_R};
312 const int subj_shape_i,
323 const IndexRange segments = segments_by_curve[curve_k];
329 const IndexMask &mask_shapes = is_subj ? clipping_shapes :
330 (!is_fill[shapes[subj_shape_i].first()] ?
334 for (
const int seg_i : segments) {
335 const Segment &this_segment = all_segments[seg_i];
338 this_segment, points, points_by_curve, shapes, mask_shapes, is_fill);
340 if (is_fill[curve_k]) {
341 all_inside_left[seg_i] = state_L.is_contributing(
342 op_params, shapes, subj_shape_i, clipping_shapes);
343 all_inside_right[seg_i] = state_R.is_contributing(
344 op_params, shapes, subj_shape_i, clipping_shapes);
347 all_inside_left[seg_i] = state_L.is_in_shapes(clipping_shapes, shapes);
348 all_inside_right[seg_i] = state_R.is_in_shapes(clipping_shapes, shapes);
375 dst_positions_2d[i] = project_fn(positions[i]);
379 auto is_curve_i_in_j = [&](
const int curve_i,
const int curve_j) {
380 const IndexRange points_i = points_by_curve[curve_i];
381 const IndexRange points_j = points_by_curve[curve_j];
388 return winding % 2 != 0;
394 for (
const int curve_i : points_by_curve.
index_range()) {
396 if (fill_ids.
span[curve_i] == 0) {
400 for (
const int curve_j : points_by_curve.
index_range()) {
401 if (curve_j == curve_i) {
405 if (fill_ids.
span[curve_j] != fill_ids.
span[curve_i]) {
409 if (is_curve_i_in_j(curve_i, curve_j)) {
410 is_curve_child[curve_i] =
true;
411 curve_children[curve_j].append(curve_i);
418 for (
const int curve_i : points_by_curve.
index_range()) {
419 if (is_curve_child[curve_i]) {
423 if (fill_ids.
span[curve_i] == 0 || unchanged_curves[curve_i]) {
427 fill_ids.
span[curve_i] = new_fill_id;
429 const Span<int> curve_i_children = curve_children[curve_i];
430 for (
const int curve_j : curve_i_children) {
431 fill_ids.
span[curve_j] = new_fill_id;
475 *r_alpha_P = r_lambda;
493 if (other_result.
segments.is_empty()) {
504 for (
const int i : other_result.
segments.index_range()) {
516 const int point_offset_i,
517 const int point_offset_j,
523 float alpha_a, alpha_b;
525 points_i[(i + 1) % points_i.
size()],
527 points_j[(j + 1) % points_j.
size()],
531 r_inters_per_curves[curve_i].append(r_intersections.
size());
532 r_inters_per_curves[curve_j].append(r_intersections.
size());
534 i + point_offset_i, j + point_offset_j, alpha_a, alpha_b, curve_i, curve_j));
548 const bool self_intersection,
553 const Span<int> curves_i = shapes[shape_i];
554 for (
const int curve_i : curves_i) {
556 const IndexRange points_i = points_by_curve[curve_i];
557 const bool cyclic_i = cyclic[curve_i];
560 const Span<int> curves_j = shapes[shape_j];
561 for (
const int curve_j : curves_j) {
562 if (self_intersection && curve_i >= curve_j) {
566 const IndexRange points_j = points_by_curve[curve_j];
567 const bool cyclic_j = cyclic[curve_j];
570 points.
slice(points_j),
597 for (
const int inter_id : intersections.
index_range()) {
619 if (is_start_a && is_end_a && is_start_b && is_end_b) {
620 connect(start_a, end_a);
621 connect(start_b, end_b);
623 else if (is_start_a && is_end_a && is_start_b && !is_end_b) {
624 connect(start_a, end_a);
626 else if (is_start_a && is_end_a && !is_start_b && is_end_b) {
627 connect(start_a, end_a);
629 else if (is_start_a && is_end_a && !is_start_b && !is_end_b) {
630 connect(start_a, end_a);
632 else if (is_start_a && !is_end_a && is_start_b && is_end_b) {
633 connect(start_b, end_b);
635 else if (is_start_a && !is_end_a && is_start_b && !is_end_b) {
636 connect(start_a, start_b);
638 else if (is_start_a && !is_end_a && !is_start_b && is_end_b) {
639 connect(start_a, end_b);
641 else if (is_start_a && !is_end_a && !is_start_b && !is_end_b) {
644 else if (!is_start_a && is_end_a && is_start_b && is_end_b) {
645 connect(start_b, end_b);
647 else if (!is_start_a && is_end_a && is_start_b && !is_end_b) {
648 connect(end_a, start_b);
650 else if (!is_start_a && is_end_a && !is_start_b && is_end_b) {
651 connect(end_a, end_b);
653 else if (!is_start_a && is_end_a && !is_start_b && !is_end_b) {
656 else if (!is_start_a && !is_end_a && is_start_b && is_end_b) {
657 connect(start_b, end_b);
659 else if (!is_start_a && !is_end_a && is_start_b && !is_end_b) {
662 else if (!is_start_a && !is_end_a && !is_start_b && is_end_b) {
665 else if (!is_start_a && !is_end_a && !is_start_b && !is_end_b) {
672 const int subj_shape_id,
697 Array<int> all_segment_offset_data(points_by_curve.
size() + 1, 0);
699 for (
const int curve_i : shapes[subj_shape_id]) {
701 curve_i, inters_per_curves, points_by_curve, intersections, cyclic, all_segments);
705 const Span<int> curves_j = shapes[clip_shape_i];
706 for (
const int curve_j : curves_j) {
708 curve_j, inters_per_curves, points_by_curve, intersections, cyclic, all_segments);
714 all_segment_offset_data);
719 for (
const int curve_i : shapes[subj_shape_id]) {
735 const Span<int> curves_j = shapes[clip_shape_id];
736 for (
const int curve_j : curves_j) {
754 for (
const int segment_i : all_segments.
index_range()) {
758 if (!all_inside_left[segment_i] ^ all_inside_right[segment_i]) {
759 segments_to_keep[segment_i] =
false;
763 BLI_assert(all_inside_left[segment_i] == all_inside_right[segment_i]);
764 if (all_inside_left[segment_i]) {
765 segments_to_keep[segment_i] =
false;
773 intersections, segments_to_keep, segment_connections);
793 for (
const int dst_curve_i : segment_offsets.
index_range()) {
794 const IndexRange segment_range = segment_offsets[dst_curve_i];
795 if (segment_range.
size() != 1) {
799 const int segment_i = segment_range.
first();
805 if (is_segments_clipping[segment_i]) {
809 unchanged_curves[dst_curve_i] =
true;
812 return unchanged_curves;
836 return is_cyclic[index] || (fill_ids[index] != 0);
840 const IndexRange points = points_by_curve[index];
842 if (points.size() <= 2) {
846 return fill_ids[
index] != 0;
850 compute_bounding_boxes(points_by_curve, shapes, positions_2d, screen_space_bbox);
852 Array<bool> shapes_bbox_intersecting(shapes.size(),
false);
856 subject_shapes.foreach_index([&](
const int64_t shape_i) {
859 bool box_intersects =
false;
861 clipping_shapes.foreach_index([&](
const int64_t shape_j) {
865 box_intersects =
true;
869 if (box_intersects) {
870 shapes_bbox_intersecting[shape_i] =
true;
874 Array<bool> editable_shapes_bool(shapes.size());
875 editable_shapes.to_bools(editable_shapes_bool);
877 subject_shapes.foreach_index([&](
const int64_t shape_i) {
879 if (shapes_bbox_intersecting[shape_i] && editable_shapes_bool[shape_i]) {
889 const int subj_first_curve = shapes[shape_i].first();
890 results_all.append_result(result, subj_first_curve);
894 if (op_params.boolean_mode == Operation::Intersect && !editable_shapes_bool[shape_i]) {
899 result.segment_offsets.append(0);
903 const int curve_j = shape[pos_j];
906 Segment::from_curve(curve_j, points_by_curve[curve_j], is_cyclic[curve_j]));
907 result.cyclic.append(is_cyclic[curve_j]);
908 result.segment_offsets.append(pos_j + 1);
909 result.segment_reversed.append(
false);
912 const int subj_first_curve = shape.
first();
913 results_all.append_result(result, subj_first_curve);
917 if (results_all.segments.is_empty()) {
921 const OffsetIndices<int> dst_segments_by_curve = OffsetIndices<int>(results_all.segment_offsets);
923 Array<bool> is_src_curve_clipping(points_by_curve.size(),
false);
924 for (
const int curve_i : points_by_curve.index_range()) {
925 if (curve_i == points_by_curve.index_range().last()) {
926 is_src_curve_clipping[curve_i] =
true;
930 results_all.is_segments_clipping = Array<bool>(results_all.segments.size());
931 for (
const int seg_i : results_all.segments.index_range()) {
932 const Segment &
segment = results_all.segments[seg_i];
933 results_all.is_segments_clipping[seg_i] = is_src_curve_clipping[
segment.curve];
936 results_all.dst_to_src_curves = Array<int>(dst_segments_by_curve.size());
937 for (
const int i : dst_segments_by_curve.index_range()) {
938 const IndexRange segment_range = dst_segments_by_curve[i];
939 const int subj_first_curve = results_all.subj_first_curves[i];
940 results_all.dst_to_src_curves[i] = subj_first_curve;
943 for (
const int seg_i : segment_range) {
944 const int curve_i = results_all.segments[seg_i].curve;
945 if (!is_src_curve_clipping[curve_i]) {
946 results_all.dst_to_src_curves[i] = curve_i;
953 results_all.segments, results_all.is_segments_clipping, dst_segments_by_curve);
966 const bool skip_clipping_attributes,
972 struct InterpolatePoint {
986 for (
const int curve_i : segment_offsets.
index_range()) {
987 point_offsets[curve_i] = i;
989 const bool unchanged = unchanged_curves[curve_i];
991 const IndexRange segment_range = segment_offsets[curve_i];
992 for (
const int seg_i : segment_range) {
994 const bool reversed = segment_reversed[seg_i];
995 const bool is_clipping = is_segments_clipping[seg_i];
996 const int point_num =
segment.points_num();
1001 point_to_interpolate.
append({i, start_edge.x, start_edge.y, start_alpha});
1002 r_is_point_clipping.
append(is_clipping);
1008 if (!unchanged && !is_clipping) {
1018 segment.foreach_point([&](
const int index,
const int pos) {
1023 segment.foreach_point([&](
const int index,
const int pos) {
1031 if (seg_i == segment_range.
last() &&
1036 point_to_interpolate.
append({i, end_edge.x, end_edge.y, end_alpha});
1037 r_is_point_clipping.
append(is_clipping);
1042 point_offsets.
last() = i;
1055 for (
const int curve_i : dst_points_by_curve.
index_range()) {
1056 const IndexRange points = dst_points_by_curve[curve_i];
1057 const Span<bool> range_is_clipping = r_is_point_clipping.
as_span().slice(points);
1064 const int src_curve_i = dst_to_src_curves[curve_i];
1065 const IndexRange src_points = src_points_by_curve[src_curve_i];
1068 const int mid_point_index = int((src_points.
first() + src_points.
last()) / 2);
1070 for (
const int point_i : points) {
1071 clipping_point_to_interpolate.
append(
1072 {int(point_i), mid_point_index, mid_point_index, 0.0f});
1079 int range_first = int(full_range.
first() - 1);
1080 int range_last = int(full_range.
last() + 1);
1081 if (range_first == points.
first() - 1) {
1082 range_first = points.
last();
1084 if (range_last == points.
last() + 1) {
1085 range_last = points.
first();
1088 const float t = (i + 1.0f) / (range.
size() + 1.0f);
1089 clipping_point_to_interpolate.
append({int(full_range[i]), range_first, range_last, t});
1102 dst_cyclic.copy_from(cyclic);
1104 [&](
const int i) { dst_cyclic[i] = src_cyclic[dst_to_src_curves[i]]; });
1111 auto src_attr = attribute.src.typed<T>();
1112 auto dst_attr = attribute.dst.span.typed<T>();
1114 for (const InterpolatePoint &interpolate_point : point_to_interpolate) {
1115 dst_attr[interpolate_point.dst_point] = bke::attribute_math::mix2<T>(
1116 interpolate_point.factor,
1117 src_attr[interpolate_point.src_point_1],
1118 src_attr[interpolate_point.src_point_2]);
1120 for (
const int2 index : points_to_copy) {
1123 for (
const int2 index : clipping_points_to_copy) {
1126 for (
const IndexRange range : ranges_to_reverse) {
1127 dst_attr.slice(range).reverse();
1134 if (skip_clipping_attributes) {
1148 unchanged_curves_mask.foreach_index([&](
const int i) {
1150 .
copy_from(src.
slice(src_points_by_curve[dst_to_src_curves[i]]));
1153 if (iter.
name !=
"position") {
1154 GMutableSpan attribute_data = dst.
span;
1155 bke::attribute_math::to_static_type(attribute_data.type(), [&]<
typename T>() {
1156 MutableSpan<T> span_data = attribute_data.typed<T>();
1158 for (const InterpolatePoint &interpolate_point : clipping_point_to_interpolate) {
1159 span_data[interpolate_point.dst_point] = bke::attribute_math::mix2<T>(
1160 interpolate_point.factor,
1161 span_data[interpolate_point.src_point_1],
1162 span_data[interpolate_point.src_point_2]);
1177 float3 point = -normal * plane.w;
1194 for (
const int i :
curves.points_range()) {
1195 src_positions_2d[i] = project_fn(positions[i]);
1202 curves.points_by_curve(),
1209 if (
result.segments.is_empty()) {
1220 result.is_segments_clipping,
1221 result.dst_to_src_curves,
1222 dst_segments_by_curve,
1232 dst_segments_by_curve);
1254 for (
const int i :
curves.points_range()) {
1255 src_positions_2d[i] = project_fn(src_positions[i]);
1262 curves.points_by_curve(),
1269 if (
result.segments.is_empty()) {
1280 result.is_segments_clipping,
1281 result.dst_to_src_curves,
1282 dst_segments_by_curve,
1291 const int src_curve =
result.dst_to_src_curves[curve_i];
1293 const IndexRange points = points_by_curve[curve_i];
1295 for (
const int point_i : points) {
1296 if (is_point_clipping[point_i]) {
1297 const float2 positions_2d = project_fn(positions[point_i]);
1309 dst_segments_by_curve);
Low-level operations for curves.
#define ISECT_LINE_LINE_EXACT
#define ISECT_LINE_LINE_CROSS
#define BLI_assert_unreachable()
constexpr const T & first() const
constexpr IndexRange index_range() const
const T & last(const int64_t n=0) const
void copy_from(GSpan values)
GMutableSpan slice(const int64_t start, int64_t size) const
GSpan slice(const int64_t start, int64_t size) const
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
constexpr int64_t first() const
constexpr IndexRange shift(int64_t n) const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
static constexpr IndexRange from_begin_size(const int64_t begin, const int64_t size)
static constexpr IndexRange from_single(const int64_t index)
constexpr IndexRange index_range() const
constexpr IndexRange drop_front(int64_t n) const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T & first() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
static VArray from_func(const int64_t size, GetFunc get_func)
void append(const T &value)
IndexRange index_range() const
void extend(Span< T > array)
Span< T > as_span() const
void append_n_times(const T &value, const int64_t n)
GAttributeReader get() const
MutableSpan< float3 > positions_for_write()
VArray< bool > cyclic() const
AttributeAccessor attributes() const
Span< float3 > positions() const
IndexRange curves_range() const
MutableSpan< int > offsets_for_write()
IndexRange points_range() const
MutableSpan< bool > cyclic_for_write()
OffsetIndices< int > points_by_curve() const
MutableAttributeAccessor attributes_for_write()
GSpanAttributeWriter lookup_for_write_span(StringRef name)
void remove_unneeded_ids()
bool is_contributing(const CurveBooleanOpParameters op_params, const GroupedSpan< int > &shapes, const int subject_shape, const IndexMask &clipping_shapes) const
void add_to_curve(const int curve_i, const int winding_i)
bool is_in_shape(const int shape_id, const GroupedSpan< int > &shapes) const
bool is_in_shapes(const IndexMask &shape_mask, const GroupedSpan< int > &shapes) const
void foreach_range(ForeachRangeFn auto &&fn) const
IndexMask slice(IndexRange range) const
IndexRange index_range() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
IndexMask complement(const IndexMask &universe, LinearAllocator<> &memory) const
IndexRange index_range() const
Segment< FEdge *, Vec3r > segment
void to_static_type(const CPPType &cpp_type, Fn &&fn)
int get_next_available_fill_id(Span< int > fill_ids)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
Vector< AttributeTransferData > retrieve_attributes_for_transfer(const AttributeAccessor src_attributes, MutableAttributeAccessor dst_attributes, Span< AttrDomain > domains, const AttributeFilter &attribute_filter={})
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
std::optional< Bounds< T > > intersect(const Bounds< T > &a, const Bounds< T > &b)
static BooleanResult execute_boolean(const CurveBooleanOpParameters op_params, const Span< float2 > positions_2d, const OffsetIndices< int > points_by_curve, const IndexMask &editable_shapes, const IndexMask &clipping_shapes, const GroupedSpan< int > shapes, const VArray< int > &fill_ids, const VArray< bool > &is_cyclic)
static void separate_fill_islands(bke::CurvesGeometry &dst, const Span< bool > unchanged_curves, const ProjectionFunc project_fn)
static float point_in_tri_winding(const float2 pt, const float2 v1, const float2 v2, const float2 v3)
static void find_intersections_between_curves(const Span< float2 > points_i, const Span< float2 > points_j, const int curve_i, const int curve_j, const bool cyclic_i, const bool cyclic_j, const int point_offset_i, const int point_offset_j, Array< Vector< int > > &r_inters_per_curves, Vector< IntersectionPoint > &r_intersections)
FunctionRef< float2(const float3)> ProjectionFunc
constexpr float epsilon_factor
constexpr float mid_point_factor
static void find_intersections_between_shapes(const Span< float2 > points, const GroupedSpan< int > shapes, const IndexMask &shapes_i, const IndexMask &shapes_j, const OffsetIndices< int > points_by_curve, const VArray< bool > &cyclic, const bool self_intersection, Array< Vector< int > > &r_inters_per_curves, Vector< IntersectionPoint > &r_intersections)
static void create_connections_from_intersection_points(const Span< IntersectionPoint > &intersections, const Span< bool > &segments_to_keep, MutableSpan< SegmentConnections > segment_connections)
constexpr float epsilon_distance
static std::pair< WindingState, WindingState > LR_states_from_segment(const Segment &segment, const Span< float2 > all_positions, const OffsetIndices< int > points_by_curve, const GroupedSpan< int > shapes, const IndexMask &mask_shapes, const VArray< bool > &is_fill)
static int point_in_polygon_winding_int(const float2 &point, const Span< float2 > poly)
static BooleanResult execute_single_boolean(const CurveBooleanOpParameters op_params, const int subj_shape_id, const Span< float2 > points, const GroupedSpan< int > shapes, const OffsetIndices< int > points_by_curve, const IndexMask &clipping_shapes, const VArray< bool > &is_fill, const VArray< bool > &cyclic)
static float4 transform_plane(const float4x4 &mat, const float4 &plane)
static bke::CurvesGeometry create_curves_from_segments(const bke::CurvesGeometry &src, const Span< Segment > segments, const Span< bool > segment_reversed, const Span< bool > cyclic, const Span< bool > is_segments_clipping, const Span< int > dst_to_src_curves, const OffsetIndices< int > segment_offsets, const Span< bool > unchanged_curves, const bool skip_clipping_attributes, Vector< bool > &r_is_point_clipping)
bke::CurvesGeometry curve_boolean_with_planes(const CurveBooleanOpParameters op_params, const bke::CurvesGeometry &curves, const ProjectionFunc project_fn, const GroupedSpan< int > shapes, const Span< float4 > curve_planes, const IndexMask &editable_shapes, const IndexMask &clipping_shapes, const float4x4 &layer_to_world, const ARegion ®ion)
static void get_inside_states_for_segments(const CurveBooleanOpParameters &op_params, const int curve_k, const bool is_subj, const int subj_shape_i, const Span< float2 > points, const GroupedSpan< int > shapes, const OffsetIndices< int > points_by_curve, const IndexMask &clipping_shapes, const Span< Segment > all_segments, const OffsetIndices< int > segments_by_curve, const VArray< bool > &is_fill, MutableSpan< bool > all_inside_left, MutableSpan< bool > all_inside_right)
static int intersect(const float2 &P1, const float2 &P2, const float2 &Q1, const float2 &Q2, float *r_alpha_P, float *r_alpha_Q)
static Array< bool > calculate_unchanged_curves(const Span< Segment > segments, const Span< bool > is_segments_clipping, const OffsetIndices< int > segment_offsets)
bke::CurvesGeometry curve_boolean(const CurveBooleanOpParameters op_params, const bke::CurvesGeometry &curves, const ProjectionFunc project_fn, const GroupedSpan< int > shapes, const IndexMask &editable_shapes, const IndexMask &clipping_shapes)
static int point_in_polygon_winding_twice(const float2 &point, const Span< float2 > poly)
void cut_caps(bke::CurvesGeometry &dst, const Span< Segment > segments, const Span< bool > segment_reversed, const Span< bool > cyclic, const OffsetIndices< int > segment_offsets)
EncodedConnection encode_index_and_side(const int index, const Side side)
constexpr EncodedConnection SEGMENT_CONNECTION_NULL
IntersectionPoint create_intersection(const int point_i, const int point_j, const float factor_i, const float factor_j, const int curve_i, const int curve_j)
void store_segment_map_on_intersections(const Span< Segment > all_segments, MutableSpan< IntersectionPoint > intersections)
int decode_index(const EncodedConnection encoded)
int create_segments_from_intersections_single_curve(const int curve_k, const Span< Vector< int > > inters_per_curves, const OffsetIndices< int > points_by_curve, const Span< IntersectionPoint > &intersections, const VArray< bool > &cyclic, Vector< Segment > &all_segments)
Side decode_side(const EncodedConnection encoded)
VecBase< EncodedConnection, 2 > SegmentConnections
void follow_segment_connections(const Span< Segment > all_segments, const Span< bool > segments_to_keep, const Span< SegmentConnections > segment_connections, Vector< Segment > &segments, Vector< int > &segment_offset_data, Vector< bool > &segment_reversed, Vector< bool > &cyclic)
void masked_fill(MutableSpan< T > data, const T &value, const IndexMask &mask)
T distance(const T &a, const T &b)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T min(const T &a, const T &b)
CartesianBasis invert(const CartesianBasis &basis)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
VecBase< double, 2 > double2
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
bool ED_view3d_win_to_3d_on_plane(const ARegion *region, const float plane[4], const float mval[2], bool do_clip, float r_out[3])
int isect_seg_seg_v2_lambda_mu_db(const double v1[2], const double v2[2], const double v3[2], const double v4[2], double *r_lambda, double *r_mu)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT
VecBase< float, 3 > float3
MutableVArraySpan< T > span
Array< int > dst_to_src_curves
Vector< Segment > segments
Vector< bool > segment_reversed
Vector< int > subj_first_curves
void append_result(const BooleanResult &other_result, const int subj_first_curve)
Vector< int > segment_offsets
Array< bool > is_segments_clipping
Array< bool > unchanged_curves
bool skip_clipping_attributes
IndexRange index_range() const