Blender V5.3
blender::ed::greasepencil::segment Namespace Reference

Classes

class  Segment
struct  IntersectionPoint

Typedefs

using EncodedConnection = int
using SegmentConnections = VecBase<EncodedConnection, 2>

Enumerations

enum  Side : uint8_t { Start = 0 , End = 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)
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)
static void find_intersections_between_curve_and_curves (const Span< float2 > screen_space_positions, const Span< Bounds< float2 > > screen_space_bbox, const OffsetIndices< int > points_by_curve, const VArray< bool > &cyclic, const IndexMask &visible_curves, const int curve_i, Array< Vector< int > > &r_inters_per_curves, Vector< IntersectionPoint > &r_intersections)
void find_intersections_between_all_curves (const Span< float2 > screen_space_positions, const Span< Bounds< float2 > > screen_space_bbox, const OffsetIndices< int > points_by_curve, const VArray< bool > &cyclic, const IndexMask &visible_curves, Array< Vector< int > > &r_inters_per_curves, Vector< IntersectionPoint > &r_intersections)
void store_segment_map_on_intersections (const Span< Segment > all_segments, MutableSpan< IntersectionPoint > intersections)
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)
void create_segments_from_intersections (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, MutableSpan< int > segments_num_per_curve)
static bool check_and_join_segments (Segment &first, const Segment &second)
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)
int decode_index (const EncodedConnection encoded)
Side decode_side (const EncodedConnection encoded)
void create_connections_from_curves (const OffsetIndices< int > segments_by_curve, const Span< bool > segments_to_keep, const VArray< bool > &is_cyclic, MutableSpan< SegmentConnections > segment_connections)
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 compute_bounding_boxes (const OffsetIndices< int > src_points_by_curve, const Span< float2 > screen_space_positions, MutableSpan< Bounds< float2 > > screen_space_bbox)
void compute_bounding_boxes (const OffsetIndices< int > src_points_by_curve, const GroupedSpan< int > shapes, const Span< float2 > screen_space_positions, MutableSpan< Bounds< float2 > > screen_space_bbox)

Variables

static constexpr int BBOX_PADDING = 2
constexpr EncodedConnection SEGMENT_CONNECTION_NULL = 0

Typedef Documentation

◆ EncodedConnection

◆ SegmentConnections

Enumeration Type Documentation

◆ Side

Enumerator
Start 
End 

Definition at line 19 of file grease_pencil_segments_intern.hh.

Function Documentation

◆ check_and_join_segments()

◆ compute_bounding_boxes() [1/2]

void blender::ed::greasepencil::segment::compute_bounding_boxes ( const OffsetIndices< int > src_points_by_curve,
const GroupedSpan< int > shapes,
const Span< float2 > screen_space_positions,
MutableSpan< Bounds< float2 > > screen_space_bbox )

◆ compute_bounding_boxes() [2/2]

void blender::ed::greasepencil::segment::compute_bounding_boxes ( const OffsetIndices< int > src_points_by_curve,
const Span< float2 > screen_space_positions,
MutableSpan< Bounds< float2 > > screen_space_bbox )

◆ create_connections_from_curves()

void blender::ed::greasepencil::segment::create_connections_from_curves ( const OffsetIndices< int > segments_by_curve,
const Span< bool > segments_to_keep,
const VArray< bool > & is_cyclic,
MutableSpan< SegmentConnections > segment_connections )

◆ create_intersection()

◆ create_segments_from_intersections()

void blender::ed::greasepencil::segment::create_segments_from_intersections ( 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,
MutableSpan< int > segments_num_per_curve )

◆ create_segments_from_intersections_single_curve()

int blender::ed::greasepencil::segment::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 )

◆ cut_caps()

◆ decode_index()

int blender::ed::greasepencil::segment::decode_index ( const EncodedConnection encoded)

◆ decode_side()

Side blender::ed::greasepencil::segment::decode_side ( const EncodedConnection encoded)

◆ encode_index_and_side()

EncodedConnection blender::ed::greasepencil::segment::encode_index_and_side ( const int index,
const Side side )

◆ find_intersections_between_all_curves()

void blender::ed::greasepencil::segment::find_intersections_between_all_curves ( const Span< float2 > screen_space_positions,
const Span< Bounds< float2 > > screen_space_bbox,
const OffsetIndices< int > points_by_curve,
const VArray< bool > & cyclic,
const IndexMask & visible_curves,
Array< Vector< int > > & r_inters_per_curves,
Vector< IntersectionPoint > & r_intersections )

◆ find_intersections_between_curve_and_curves()

◆ follow_segment_connections()

◆ get_intersection_distance_of_segments()

float blender::ed::greasepencil::segment::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 167 of file grease_pencil_segments_geom.cc.

References blender::math::abs(), blender::math::distance(), distance(), get_intersection_distance_of_segments(), and blender::math::safe_divide().

Referenced by find_intersections_between_curve_and_curves(), and get_intersection_distance_of_segments().

◆ store_segment_map_on_intersections()

Variable Documentation

◆ BBOX_PADDING

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

Definition at line 17 of file grease_pencil_segments_intern.hh.

◆ SEGMENT_CONNECTION_NULL