Blender V5.0
blender::ed::greasepencil::trim Namespace Reference

Classes

struct  Segment
struct  Segments

Enumerations

enum  Side : uint8_t { Start = 0 , End = 1 }
enum  Distance : uint8_t { Min = 0 , Max = 1 }

Functions

static float get_intersection_distance_of_segments (const float2 &co_a, const float2 &co_b, const float2 &co_c, const float2 &co_d)
static void get_intersections_of_curve_with_curves (const int src_curve, const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const Span< rcti > screen_space_curve_bounds, MutableSpan< bool > r_is_intersected_after_point, MutableSpan< float2 > r_intersection_distance)
static void expand_trim_segment_direction (Segment &segment, const int direction, const bke::CurvesGeometry &src, const Span< bool > is_intersected_after_point, const Span< float2 > intersection_distance, MutableSpan< bool > point_is_in_segment)
static void expand_trim_segment (Segment &segment, const bke::CurvesGeometry &src, const Span< bool > is_intersected_after_point, const Span< float2 > intersection_distance, MutableSpan< bool > point_is_in_segment)
bke::CurvesGeometry trim_curve_segments (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const Span< rcti > screen_space_curve_bounds, const IndexMask &curve_selection, const Vector< Vector< int > > &selected_points_in_curves, const bool keep_caps)

Variables

static constexpr int BBOX_PADDING = 2
static constexpr float DISTANCE_FACTOR_THRESHOLD = 0.01f

Enumeration Type Documentation

◆ Distance

Enumerator
Min 
Max 

Definition at line 907 of file grease_pencil_geom.cc.

◆ Side

Enumerator
Start 
End 

Definition at line 906 of file grease_pencil_geom.cc.

Function Documentation

◆ expand_trim_segment()

void blender::ed::greasepencil::trim::expand_trim_segment ( Segment & segment,
const bke::CurvesGeometry & src,
const Span< bool > is_intersected_after_point,
const Span< float2 > intersection_distance,
MutableSpan< bool > point_is_in_segment )
static

Expand a trim segment of one point by walking along the curve in both directions.

Definition at line 1230 of file grease_pencil_geom.cc.

References expand_trim_segment(), and expand_trim_segment_direction().

Referenced by expand_trim_segment(), and trim_curve_segments().

◆ expand_trim_segment_direction()

void blender::ed::greasepencil::trim::expand_trim_segment_direction ( Segment & segment,
const int direction,
const bke::CurvesGeometry & src,
const Span< bool > is_intersected_after_point,
const Span< float2 > intersection_distance,
MutableSpan< bool > point_is_in_segment )
static

Expand a trim segment by walking along the curve in forward or backward direction. A trim segments ends at an intersection with another curve, or at the outer end of the curve.

Definition at line 1154 of file grease_pencil_geom.cc.

References DISTANCE_FACTOR_THRESHOLD, End, expand_trim_segment_direction(), Max, Min, blender::bke::CurvesGeometry::points_by_curve(), and Start.

Referenced by expand_trim_segment(), and expand_trim_segment_direction().

◆ get_intersection_distance_of_segments()

float blender::ed::greasepencil::trim::get_intersection_distance_of_segments ( const float2 & co_a,
const float2 & co_b,
const float2 & co_c,
const float2 & co_d )
static

Get the intersection distance of two line segments a-b and c-d. The intersection distance is defined as the normalized distance (0..1) from point a to the intersection point of a-b and c-d.

Definition at line 1017 of file grease_pencil_geom.cc.

References blender::math::clamp(), distance(), get_intersection_distance_of_segments(), and blender::math::length().

Referenced by get_intersection_distance_of_segments(), and get_intersections_of_curve_with_curves().

◆ get_intersections_of_curve_with_curves()

void blender::ed::greasepencil::trim::get_intersections_of_curve_with_curves ( const int src_curve,
const bke::CurvesGeometry & src,
const Span< float2 > screen_space_positions,
const Span< rcti > screen_space_curve_bounds,
MutableSpan< bool > r_is_intersected_after_point,
MutableSpan< float2 > r_intersection_distance )
static

◆ trim_curve_segments()

Variable Documentation

◆ BBOX_PADDING

int blender::ed::greasepencil::trim::BBOX_PADDING = 2
staticconstexpr

Definition at line 911 of file grease_pencil_geom.cc.

Referenced by get_intersections_of_curve_with_curves().

◆ DISTANCE_FACTOR_THRESHOLD

float blender::ed::greasepencil::trim::DISTANCE_FACTOR_THRESHOLD = 0.01f
staticconstexpr

Definition at line 915 of file grease_pencil_geom.cc.

Referenced by expand_trim_segment_direction(), and trim_curve_segments().