|
Blender V5.3
|
Classes | |
| struct | BooleanResult |
| struct | CurveBooleanOpParameters |
| class | WindingState |
Typedefs | |
| using | ProjectionFunc = FunctionRef<float2(const float3)> |
Enumerations | |
| enum class | Operation : int8_t { Intersect , Union , Difference } |
Functions | |
| static float | point_in_tri_winding (const float2 pt, const float2 v1, const float2 v2, const float2 v3) |
| static int | point_in_polygon_winding_twice (const float2 &point, const Span< float2 > poly) |
| static int | point_in_polygon_winding_int (const float2 &point, const Span< float2 > poly) |
| 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 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 void | separate_fill_islands (bke::CurvesGeometry &dst, const Span< bool > unchanged_curves, const ProjectionFunc project_fn) |
| static int | intersect (const float2 &P1, const float2 &P2, const float2 &Q1, const float2 &Q2, float *r_alpha_P, float *r_alpha_Q) |
| 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) |
| 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) |
| 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 Array< bool > | calculate_unchanged_curves (const Span< Segment > segments, const Span< bool > is_segments_clipping, const OffsetIndices< int > segment_offsets) |
| 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 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) |
| static float4 | transform_plane (const float4x4 &mat, const float4 &plane) |
| 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) |
| 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) |
Variables | |
| constexpr float | epsilon_distance = 0.01f |
| constexpr float | epsilon_factor = 0.05f |
| constexpr float | mid_point_factor = 0.35421f |
| using blender::ed::greasepencil::boolean::ProjectionFunc = FunctionRef<float2(const float3)> |
Definition at line 1004 of file ED_grease_pencil.hh.
|
strong |
| Enumerator | |
|---|---|
| Intersect | |
| Union | |
| Difference | |
Definition at line 987 of file ED_grease_pencil.hh.
|
static |
Definition at line 787 of file grease_pencil_boolean.cc.
References calculate_unchanged_curves(), blender::ed::greasepencil::End, blender::IndexRange::first(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::IndexRange::size(), blender::offset_indices::OffsetIndices< T >::size(), and blender::ed::greasepencil::Start.
Referenced by calculate_unchanged_curves().
|
static |
Definition at line 585 of file grease_pencil_boolean.cc.
References create_connections_from_intersection_points(), blender::ed::greasepencil::segment::decode_index(), blender::ed::greasepencil::segment::decode_side(), blender::ed::greasepencil::segment::encode_index_and_side(), blender::ed::greasepencil::End, blender::false, blender::Span< T >::index_range(), blender::ed::greasepencil::segment::SEGMENT_CONNECTION_NULL, blender::ed::greasepencil::segment::IntersectionPoint::segment_index_i, blender::ed::greasepencil::segment::IntersectionPoint::segment_index_j, and blender::ed::greasepencil::Start.
Referenced by create_connections_from_intersection_points(), and execute_single_boolean().
|
static |
Definition at line 958 of file grease_pencil_boolean.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_n_times(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), attribute, blender::bke::attribute_filter_from_skip_ref(), blender::bke::CurvesGeometry::attributes(), blender::bke::CurvesGeometry::attributes_for_write(), create_curves_from_segments(), blender::bke::Curve, blender::bke::CurvesGeometry::cyclic(), blender::bke::CurvesGeometry::cyclic_for_write(), blender::offset_indices::OffsetIndices< T >::data(), blender::ed::greasepencil::End, blender::IndexRange::first(), blender::index_mask::IndexMask::foreach_index(), blender::index_mask::IndexMask::foreach_range(), blender::IndexRange::from_begin_size(), blender::IndexMask::from_bools(), blender::bke::gather_attributes(), blender::IndexRange::index_range(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), blender::IndexRange::last(), blender::bke::CurvesGeometry::offsets_for_write(), blender::bke::Point, blender::bke::CurvesGeometry::points_by_curve(), blender::bke::retrieve_attributes_for_transfer(), blender::IndexRange::shift(), blender::IndexRange::size(), blender::offset_indices::OffsetIndices< T >::size(), blender::ed::greasepencil::Start, T, blender::bke::attribute_math::to_static_type(), and blender::offset_indices::OffsetIndices< T >::total_size().
Referenced by create_curves_from_segments(), curve_boolean(), and curve_boolean_with_planes().
| bke::CurvesGeometry blender::ed::greasepencil::boolean::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 ) |
Definition at line 1185 of file grease_pencil_boolean.cc.
References create_curves_from_segments(), blender::bke::Curve, curve_boolean(), blender::ed::greasepencil::segment::cut_caps(), execute_boolean(), blender::ed::greasepencil::boolean::CurveBooleanOpParameters::keep_caps, blender::result, separate_fill_islands(), blender::ed::greasepencil::boolean::CurveBooleanOpParameters::separate_islands, and blender::ed::greasepencil::boolean::CurveBooleanOpParameters::skip_clipping_attributes.
Referenced by curve_boolean(), and blender::ed::greasepencil::tests::test_curve_boolean().
| bke::CurvesGeometry blender::ed::greasepencil::boolean::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 & | region ) |
Definition at line 1242 of file grease_pencil_boolean.cc.
References create_curves_from_segments(), blender::bke::Curve, curve_boolean_with_planes(), blender::bke::CurvesGeometry::curves_range(), blender::ed::greasepencil::segment::cut_caps(), blender::ED_view3d_win_to_3d_on_plane(), execute_boolean(), blender::math::invert(), blender::ed::greasepencil::boolean::CurveBooleanOpParameters::keep_caps, blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::positions_for_write(), blender::result, separate_fill_islands(), blender::ed::greasepencil::boolean::CurveBooleanOpParameters::separate_islands, blender::ed::greasepencil::boolean::CurveBooleanOpParameters::skip_clipping_attributes, transform_plane(), and blender::math::transform_point().
Referenced by curve_boolean_with_planes().
|
static |
Definition at line 815 of file grease_pencil_boolean.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::index_mask::IndexMask::complement(), execute_boolean(), blender::VArray< T >::from_func(), blender::offset_indices::GroupedSpan< T >::index_range(), blender::offset_indices::OffsetIndices< T >::is_empty(), blender::ed::greasepencil::boolean::BooleanResult::segment_offsets, and blender::offset_indices::OffsetIndices< T >::size().
Referenced by curve_boolean(), curve_boolean_with_planes(), and execute_boolean().
|
static |
Definition at line 671 of file grease_pencil_boolean.cc.
References blender::offset_indices::accumulate_counts_to_offsets(), blender::BLI_assert(), create_connections_from_intersection_points(), blender::ed::greasepencil::segment::create_segments_from_intersections_single_curve(), execute_single_boolean(), find_intersections_between_shapes(), blender::ed::greasepencil::segment::follow_segment_connections(), blender::index_mask::IndexMask::foreach_index(), blender::IndexRange::from_single(), get_inside_states_for_segments(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::result, blender::ed::greasepencil::segment::SEGMENT_CONNECTION_NULL, blender::offset_indices::OffsetIndices< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and blender::ed::greasepencil::segment::store_segment_map_on_intersections().
Referenced by execute_single_boolean().
|
static |
Definition at line 510 of file grease_pencil_boolean.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::ed::greasepencil::segment::create_intersection(), blender::IndexRange::drop_back(), find_intersections_between_curves(), blender::Span< T >::index_range(), intersect(), ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, blender::Span< T >::size(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by find_intersections_between_curves(), and find_intersections_between_shapes().
|
static |
Definition at line 542 of file grease_pencil_boolean.cc.
References find_intersections_between_curves(), find_intersections_between_shapes(), blender::IndexRange::first(), blender::index_mask::IndexMask::foreach_index(), and blender::Span< T >::slice().
Referenced by execute_single_boolean(), and find_intersections_between_shapes().
|
static |
Definition at line 309 of file grease_pencil_boolean.cc.
References blender::IndexRange::from_single(), get_inside_states_for_segments(), blender::IndexRange::is_empty(), and LR_states_from_segment().
Referenced by execute_single_boolean(), and get_inside_states_for_segments().
|
static |
This is a heavily modified implementation of the Greiner-Hormann clipping algorithm.
Greiner, Günther; Kai Hormann (1998). "Efficient clipping of arbitrary polygons". ACM Transactions on Graphics. 17 (2): 71-83.
The original Greiner-Hormann algorithm works in three phases: 1: Find all intersections and sort them. 2: Set the direction of all intersection point (the paper call it entry_exit) 3: Create all polygons by following the direction of each intersection point until it loops.
This implementation adds the following: 1: Groups of curves, called fills. This allows for input geometry with holes. 2: Curves can have no fill, so they will get cut.
This implementation works by: 1: Break one subject fill and all clipping fills into segments and store their intersections. 2: Remove all segments that are not contributing. 3: Follow each segment until it loops or terminates. 4: Repeat for every subject fill.
Definition at line 463 of file grease_pencil_boolean.cc.
References intersect(), and blender::isect_seg_seg_v2_lambda_mu_db().
Referenced by find_intersections_between_curves(), and intersect().
|
static |
Definition at line 206 of file grease_pencil_boolean.cc.
References blender::ed::greasepencil::boolean::WindingState::add_to_curve(), blender::math::distance(), blender::ed::greasepencil::End, epsilon_distance, epsilon_factor, blender::index_mask::IndexMask::foreach_index(), blender::math::interpolate(), LR_states_from_segment(), mid_point_factor, blender::math::min(), blender::math::normalize(), point_in_polygon_winding_int(), blender::ed::greasepencil::boolean::WindingState::remove_unneeded_ids(), blender::Span< T >::slice(), and blender::ed::greasepencil::Start.
Referenced by get_inside_states_for_segments(), and LR_states_from_segment().
|
static |
Definition at line 87 of file grease_pencil_boolean.cc.
References point_in_polygon_winding_int(), and point_in_polygon_winding_twice().
Referenced by LR_states_from_segment(), point_in_polygon_winding_int(), and separate_fill_islands().
|
static |
Definition at line 73 of file grease_pencil_boolean.cc.
References blender::IndexRange::drop_back(), blender::IndexRange::drop_front(), blender::Span< T >::index_range(), point_in_polygon_winding_twice(), and point_in_tri_winding().
Referenced by point_in_polygon_winding_int(), and point_in_polygon_winding_twice().
|
static |
Definition at line 37 of file grease_pencil_boolean.cc.
References blender::line_point_side_v2(), point_in_tri_winding(), and blender::v2.
Referenced by point_in_polygon_winding_twice(), and point_in_tri_winding().
|
static |
Separate disjoint fill islands.
Note: Nested islands of 3 or more curves will not be split, (i.e. an island inside a lake inside a island, will stay the same fill id as the upper most parent island.)
If a curve as been changed and it is not a child then update it's and it's children's fill ids.
Note: Previously unchanged curves may have their fill id changed, if their parent curve id is changed.
Definition at line 364 of file grease_pencil_boolean.cc.
References blender::bke::CurvesGeometry::attributes_for_write(), blender::bke::SpanAttributeWriter< T >::finish(), blender::Span< T >::first(), blender::bke::greasepencil::get_next_available_fill_id(), blender::offset_indices::OffsetIndices< T >::index_range(), blender::bke::MutableAttributeAccessor::lookup_for_write_span(), point_in_polygon_winding_int(), blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::bke::CurvesGeometry::positions(), separate_fill_islands(), blender::offset_indices::OffsetIndices< T >::size(), blender::Span< T >::slice(), and blender::bke::SpanAttributeWriter< T >::span.
Referenced by curve_boolean(), curve_boolean_with_planes(), and separate_fill_islands().
|
static |
Definition at line 1174 of file grease_pencil_boolean.cc.
References blender::math::dot(), blender::math::transform_direction(), transform_plane(), and blender::math::transform_point().
Referenced by curve_boolean_with_planes(), and transform_plane().
|
constexpr |
Definition at line 197 of file grease_pencil_boolean.cc.
Referenced by LR_states_from_segment().
|
constexpr |
Definition at line 200 of file grease_pencil_boolean.cc.
Referenced by LR_states_from_segment().
|
constexpr |
Definition at line 203 of file grease_pencil_boolean.cc.
Referenced by LR_states_from_segment().