Blender  V2.93
Classes | Typedefs | Functions
BKE_gpencil_geom.h File Reference

Go to the source code of this file.

Classes

struct  GPencilPointCoordinates
 

Typedefs

typedef struct GPencilPointCoordinates GPencilPointCoordinates
 

Functions

bool BKE_gpencil_data_minmax (const struct bGPdata *gpd, float r_min[3], float r_max[3])
 
bool BKE_gpencil_stroke_minmax (const struct bGPDstroke *gps, const bool use_select, float r_min[3], float r_max[3])
 
struct BoundBoxBKE_gpencil_boundbox_get (struct Object *ob)
 
void BKE_gpencil_centroid_3d (struct bGPdata *gpd, float r_centroid[3])
 
void BKE_gpencil_stroke_boundingbox_calc (struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_normal (const struct bGPDstroke *gps, float r_normal[3])
 
void BKE_gpencil_stroke_simplify_adaptive (struct bGPdata *gpd, struct bGPDstroke *gps, float epsilon)
 
void BKE_gpencil_stroke_simplify_fixed (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_subdivide (struct bGPdata *gpd, struct bGPDstroke *gps, int level, int type)
 
bool BKE_gpencil_stroke_trim (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_merge_distance (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, const float threshold, const bool use_unselected)
 
void BKE_gpencil_stroke_2d_flat (const struct bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
 
void BKE_gpencil_stroke_2d_flat_ref (const struct bGPDspoint *ref_points, int ref_totpoints, const struct bGPDspoint *points, int totpoints, float(*points2d)[2], const float scale, int *r_direction)
 
void BKE_gpencil_stroke_fill_triangulate (struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_geometry_update (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_uv_update (struct bGPDstroke *gps)
 
void BKE_gpencil_transform (struct bGPdata *gpd, const float mat[4][4])
 
int BKE_gpencil_stroke_point_count (struct bGPdata *gpd)
 
void BKE_gpencil_point_coords_get (struct bGPdata *gpd, GPencilPointCoordinates *elem_data)
 
void BKE_gpencil_point_coords_apply (struct bGPdata *gpd, const GPencilPointCoordinates *elem_data)
 
void BKE_gpencil_point_coords_apply_with_mat4 (struct bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4])
 
bool BKE_gpencil_stroke_sample (struct bGPdata *gpd, struct bGPDstroke *gps, const float dist, const bool select)
 
bool BKE_gpencil_stroke_smooth (struct bGPDstroke *gps, int i, float inf)
 
bool BKE_gpencil_stroke_smooth_strength (struct bGPDstroke *gps, int point_index, float influence)
 
bool BKE_gpencil_stroke_smooth_thickness (struct bGPDstroke *gps, int point_index, float influence)
 
bool BKE_gpencil_stroke_smooth_uv (struct bGPDstroke *gps, int point_index, float influence)
 
bool BKE_gpencil_stroke_close (struct bGPDstroke *gps)
 
void BKE_gpencil_dissolve_points (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, const short tag)
 
bool BKE_gpencil_stroke_stretch (struct bGPDstroke *gps, const float dist, const float tip_length)
 
bool BKE_gpencil_stroke_trim_points (struct bGPDstroke *gps, const int index_from, const int index_to)
 
struct bGPDstrokeBKE_gpencil_stroke_delete_tagged_points (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, int tag_flags, const bool select, const bool flat_cap, const int limit)
 
void BKE_gpencil_curve_delete_tagged_points (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, struct bGPDcurve *gpc, int tag_flags)
 
void BKE_gpencil_stroke_flip (struct bGPDstroke *gps)
 
bool BKE_gpencil_stroke_split (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, const int before_index, struct bGPDstroke **remaining_gps)
 
bool BKE_gpencil_stroke_shrink (struct bGPDstroke *gps, const float dist)
 
float BKE_gpencil_stroke_length (const struct bGPDstroke *gps, bool use_3d)
 
float BKE_gpencil_stroke_segment_length (const struct bGPDstroke *gps, const int start_index, const int end_index, bool use_3d)
 
void BKE_gpencil_stroke_set_random_color (struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_join (struct bGPDstroke *gps_a, struct bGPDstroke *gps_b, const bool leave_gaps, const bool fit_thickness)
 
void BKE_gpencil_stroke_copy_to_keyframes (struct bGPdata *gpd, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, const bool tail)
 
bool BKE_gpencil_convert_mesh (struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_gp, struct Object *ob_mesh, const float angle, const int thickness, const float offset, const float matrix[4][4], const int frame_offset, const bool use_seams, const bool use_faces)
 
void BKE_gpencil_stroke_uniform_subdivide (struct bGPdata *gpd, struct bGPDstroke *gps, const uint32_t target_number, const bool select)
 
void BKE_gpencil_stroke_to_view_space (struct RegionView3D *rv3d, struct bGPDstroke *gps, const float diff_mat[4][4])
 
void BKE_gpencil_stroke_from_view_space (struct RegionView3D *rv3d, struct bGPDstroke *gps, const float diff_mat[4][4])
 
struct bGPDstrokeBKE_gpencil_stroke_perimeter_from_view (struct RegionView3D *rv3d, struct bGPdata *gpd, const struct bGPDlayer *gpl, struct bGPDstroke *gps, const int subdivisions, const float diff_mat[4][4])
 
float BKE_gpencil_stroke_average_pressure_get (struct bGPDstroke *gps)
 
bool BKE_gpencil_stroke_is_pressure_constant (struct bGPDstroke *gps)
 

Typedef Documentation

◆ GPencilPointCoordinates

Function Documentation

◆ BKE_gpencil_boundbox_get()

struct BoundBox* BKE_gpencil_boundbox_get ( Object ob)

Get grease pencil object bounding box.

Parameters
obGrease pencil object
Returns
Bounding box

Definition at line 182 of file gpencil_geom.c.

References Object_Runtime::bb, boundbox_gpencil(), copy_v3_v3(), Object::data, DEG_get_original_id(), ELEM, bGPdata::flag, GP_DATA_CACHE_IS_DIRTY, Object::id, if(), MEM_callocN, NULL, Object::runtime, and BoundBox::vec.

Referenced by BKE_object_boundbox_get(), and BKE_object_minmax().

◆ BKE_gpencil_centroid_3d()

void BKE_gpencil_centroid_3d ( bGPdata gpd,
float  r_centroid[3] 
)

Compute center of bounding box.

Parameters
gpdGrease pencil data-block
r_centroidLocation of the center

Definition at line 130 of file gpencil_geom.c.

References add_v3_v3v3(), BKE_gpencil_data_minmax(), max, min, and mul_v3_v3fl().

Referenced by object_origin_set_exec(), and blender::io::gpencil::GpencilImporterSVG::read().

◆ BKE_gpencil_convert_mesh()

bool BKE_gpencil_convert_mesh ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob_gp,
Object ob_mesh,
const float  angle,
const int  thickness,
const float  offset,
const float  matrix[4][4],
const int  frame_offset,
const bool  use_seams,
const bool  use_faces 
)

Convert a mesh object to grease pencil stroke.

Parameters
bmainMain thread pointer.
depsgraphOriginal depsgraph.
sceneOriginal scene.
ob_gpGrease pencil object to add strokes.
ob_meshMesh to convert.
angleLimit angle to consider a edgeloop ends.
thicknessThickness of the strokes.
offsetOffset along the normals.
matrixTransformation matrix.
frame_offsetDestination frame number offset.
use_seamsOnly export seam edges.
use_facesExport faces as filled strokes.

Definition at line 2391 of file gpencil_geom.c.

References angle(), BKE_gpencil_layer_addnew(), BKE_gpencil_layer_frame_get(), BKE_gpencil_layer_named_get(), BKE_gpencil_material_find_index_by_name_prefix(), BKE_gpencil_stroke_add(), BKE_gpencil_stroke_geometry_update(), BKE_gpencil_stroke_subdivide(), BKE_object_get_evaluated_mesh(), BKE_object_material_get(), CFRA, copy_v3_v3(), copy_v4_v4(), Object::data, DEG_get_evaluated_object(), DEG_id_tag_update(), depsgraph, ELEM, bGPDstroke::flag, GP_GETFRAME_ADD_NEW, GP_STROKE_CYCLIC, GP_SUBDIV_SIMPLE, gpencil_add_material(), gpencil_generate_edgeloops(), gpencil_material_find_index_by_name(), bGPdata::id, Material::id, Object::id, ID_RECALC_COPY_ON_WRITE, ID_RECALC_GEOMETRY, MPoly::loopstart, make_element_name(), MPoly::mat_nr, Mesh::mloop, Mesh::mpoly, mul_m4_v3(), Mesh::mvert, ID::name, NULL, OB_GPENCIL, bGPDstroke::points, bGPDspoint::pressure, Material::r, bGPDspoint::strength, MPoly::totloop, Mesh::totpoly, Mesh::totvert, Object::type, MLoop::v, and bGPDspoint::x.

Referenced by object_convert_exec().

◆ BKE_gpencil_curve_delete_tagged_points()

void BKE_gpencil_curve_delete_tagged_points ( struct bGPdata gpd,
struct bGPDframe gpf,
struct bGPDstroke gps,
struct bGPDstroke next_stroke,
struct bGPDcurve gpc,
int  tag_flags 
)

◆ BKE_gpencil_data_minmax()

bool BKE_gpencil_data_minmax ( const struct bGPdata gpd,
float  r_min[3],
float  r_max[3] 
)

◆ BKE_gpencil_dissolve_points()

void BKE_gpencil_dissolve_points ( bGPdata gpd,
bGPDframe gpf,
bGPDstroke gps,
const short  tag 
)

Dissolve points in stroke.

Parameters
gpdGrease pencil data-block
gpfGrease pencil frame
gpsGrease pencil stroke
tagType of tag for point

Definition at line 1590 of file gpencil_geom.c.

References BKE_gpencil_free_stroke_weights(), BKE_gpencil_stroke_geometry_update(), BLI_freelinkN(), bGPDstroke::dvert, MDeformVert::dw, bGPDspoint::flag, MEM_callocN, MEM_dupallocN, MEM_freeN, NULL, bGPDstroke::points, bGPDframe::strokes, bGPDstroke::totpoints, and bGPDstroke::triangles.

Referenced by BKE_gpencil_stroke_merge_distance().

◆ BKE_gpencil_point_coords_apply()

void BKE_gpencil_point_coords_apply ( struct bGPdata gpd,
const GPencilPointCoordinates elem_data 
)

◆ BKE_gpencil_point_coords_apply_with_mat4()

void BKE_gpencil_point_coords_apply_with_mat4 ( struct bGPdata gpd,
const GPencilPointCoordinates elem_data,
const float  mat[4][4] 
)

◆ BKE_gpencil_point_coords_get()

void BKE_gpencil_point_coords_get ( struct bGPdata gpd,
GPencilPointCoordinates elem_data 
)

◆ BKE_gpencil_stroke_2d_flat()

void BKE_gpencil_stroke_2d_flat ( const struct bGPDspoint points,
int  totpoints,
float(*)  points2d[2],
int *  r_direction 
)

◆ BKE_gpencil_stroke_2d_flat_ref()

void BKE_gpencil_stroke_2d_flat_ref ( const struct bGPDspoint ref_points,
int  ref_totpoints,
const struct bGPDspoint points,
int  totpoints,
float(*)  points2d[2],
const float  scale,
int *  r_direction 
)

◆ BKE_gpencil_stroke_average_pressure_get()

float BKE_gpencil_stroke_average_pressure_get ( bGPDstroke gps)

Get average pressure.

Definition at line 4005 of file gpencil_geom.c.

References float(), bGPDstroke::points, bGPDspoint::pressure, and bGPDstroke::totpoints.

◆ BKE_gpencil_stroke_boundingbox_calc()

void BKE_gpencil_stroke_boundingbox_calc ( bGPDstroke gps)

Compute stroke bounding box.

Parameters
gpsGrease pencil Stroke

Definition at line 144 of file gpencil_geom.c.

References BKE_gpencil_stroke_minmax(), bGPDstroke::boundbox_max, bGPDstroke::boundbox_min, and INIT_MINMAX.

Referenced by BKE_gpencil_stroke_geometry_update(), and ED_gpencil_stroke_check_collision().

◆ BKE_gpencil_stroke_close()

bool BKE_gpencil_stroke_close ( bGPDstroke gps)

◆ BKE_gpencil_stroke_copy_to_keyframes()

void BKE_gpencil_stroke_copy_to_keyframes ( struct bGPdata gpd,
struct bGPDlayer gpl,
struct bGPDframe gpf,
struct bGPDstroke gps,
const bool  tail 
)

◆ BKE_gpencil_stroke_delete_tagged_points()

struct bGPDstroke* BKE_gpencil_stroke_delete_tagged_points ( struct bGPdata gpd,
struct bGPDframe gpf,
struct bGPDstroke gps,
struct bGPDstroke next_stroke,
int  tag_flags,
const bool  select,
const bool  flat_cap,
const int  limit 
)

◆ BKE_gpencil_stroke_fill_triangulate()

void BKE_gpencil_stroke_fill_triangulate ( bGPDstroke gps)

◆ BKE_gpencil_stroke_flip()

void BKE_gpencil_stroke_flip ( struct bGPDstroke gps)

◆ BKE_gpencil_stroke_from_view_space()

void BKE_gpencil_stroke_from_view_space ( RegionView3D rv3d,
bGPDstroke gps,
const float  diff_mat[4][4] 
)

Stroke from view space Transforms a stroke from view space back to world space. Inverse of BKE_gpencil_stroke_to_view_space Note: also takes care of parent space transform

Definition at line 3512 of file gpencil_geom.c.

References invert_m4_m4(), mul_m4_v3(), mul_v3_m4v3(), bGPDstroke::points, bGPDstroke::totpoints, RegionView3D::viewinv, and bGPDspoint::x.

Referenced by BKE_gpencil_stroke_perimeter_from_view().

◆ BKE_gpencil_stroke_geometry_update()

void BKE_gpencil_stroke_geometry_update ( bGPdata gpd,
bGPDstroke gps 
)

Recalc all internal geometry data for the stroke

Parameters
gpdGrease pencil data-block
gpsGrease pencil stroke

Definition at line 1307 of file gpencil_geom.c.

References BKE_gpencil_stroke_boundingbox_calc(), BKE_gpencil_stroke_fill_triangulate(), BKE_gpencil_stroke_update_geometry_from_editcurve(), BKE_gpencil_stroke_uv_update(), bGPdata::curve_edit_resolution, bGPDstroke::editcurve, bGPDcurve::flag, bGPDstroke::flag, bGPdata::flag, GP_CURVE_NEEDS_STROKE_UPDATE, GP_DATA_CURVE_ADAPTIVE_RESOLUTION, GP_STROKE_NEEDS_CURVE_UPDATE, GPENCIL_CURVE_EDIT_SESSIONS_ON, MEM_SAFE_FREE, NULL, bGPDstroke::tot_triangles, bGPDstroke::totpoints, and bGPDstroke::triangles.

Referenced by BKE_gpencil_convert_mesh(), BKE_gpencil_curve_delete_tagged_points(), BKE_gpencil_dissolve_points(), BKE_gpencil_from_image(), BKE_gpencil_point_coords_apply(), BKE_gpencil_point_coords_apply_with_mat4(), BKE_gpencil_stroke_delete_tagged_points(), BKE_gpencil_stroke_merge_distance(), BKE_gpencil_stroke_perimeter_from_view(), BKE_gpencil_stroke_sample(), BKE_gpencil_stroke_simplify_adaptive(), BKE_gpencil_stroke_simplify_fixed(), BKE_gpencil_stroke_split(), BKE_gpencil_stroke_subdivide(), BKE_gpencil_stroke_trim(), BKE_gpencil_stroke_uniform_subdivide(), BKE_gpencil_strokes_selected_update_editcurve(), BKE_gpencil_transform(), blo_do_versions_280(), deformStroke(), duplicateStroke(), ED_gpencil_create_monkey(), ED_gpencil_create_stroke(), ED_gpencil_select_curve_toggle_all(), ED_gpencil_trace_data_to_strokes(), gpencil_add_move_points(), gpencil_convert_spline(), gpencil_curve_extrude_points(), gpencil_dissolve_selected_curve_points(), gpencil_dissolve_selected_stroke_points(), gpencil_duplicate_exec(), gpencil_duplicate_points(), gpencil_editcurve_set_handle_type_exec(), gpencil_editmode_toggle_exec(), gpencil_generate_edgeloops(), gpencil_generic_stroke_select(), gpencil_insert_point(), gpencil_interpolate_modal(), gpencil_interpolate_seq_exec(), gpencil_interpolate_set_points(), gpencil_interpolate_update_strokes(), gpencil_primitive_interaction_end(), gpencil_primitive_update_strokes(), gpencil_recalc_geometry_exec(), gpencil_reset_transform_fill_exec(), gpencil_sculpt_brush_do_frame(), gpencil_select_exec(), gpencil_snap_to_grid(), gpencil_stroke_cyclical_set_exec(), gpencil_stroke_do_circle_sel(), gpencil_stroke_enter_editcurve_mode_exec(), gpencil_stroke_from_buffer(), gpencil_stroke_join_exec(), gpencil_stroke_join_islands(), gpencil_stroke_merge_exec(), gpencil_stroke_newfrombuffer(), gpencil_stroke_subdivide_exec(), gpencil_strokes_copy_exec(), gpencil_strokes_paste_exec(), gpencil_strokes_reproject_exec(), gpencil_subdivide_stroke(), gpencil_update_geometry(), gpencil_uv_transform_calc(), lineart_gpencil_generate(), object_origin_set_exec(), recalcData_gpencil_strokes(), and reduce_stroke_points().

◆ BKE_gpencil_stroke_is_pressure_constant()

bool BKE_gpencil_stroke_is_pressure_constant ( bGPDstroke gps)

Check if the thickness of the stroke is constant.

Definition at line 4022 of file gpencil_geom.c.

References bGPDstroke::points, bGPDspoint::pressure, and bGPDstroke::totpoints.

◆ BKE_gpencil_stroke_join()

void BKE_gpencil_stroke_join ( struct bGPDstroke gps_a,
struct bGPDstroke gps_b,
const bool  leave_gaps,
const bool  fit_thickness 
)

◆ BKE_gpencil_stroke_length()

float BKE_gpencil_stroke_length ( const struct bGPDstroke gps,
bool  use_3d 
)

◆ BKE_gpencil_stroke_merge_distance()

void BKE_gpencil_stroke_merge_distance ( bGPdata gpd,
bGPDframe gpf,
bGPDstroke gps,
const float  threshold,
const bool  use_unselected 
)

Reduce a series of points when the distance is below a threshold. Special case for first and last points (both are keeped) for other points, the merge point always is at first point.

Parameters
gpdGrease pencil data-block
gpfGrease Pencil frame
gpsGrease Pencil stroke
thresholdDistance between points
use_unselectedSet to true to analyze all stroke and not only selected points

Definition at line 2017 of file gpencil_geom.c.

References BKE_gpencil_dissolve_points(), BKE_gpencil_stroke_geometry_update(), bGPDspoint::flag, GP_SPOINT_SELECT, GP_SPOINT_TAG, len_squared_v3v3(), NULL, bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.

Referenced by deformStroke(), ED_gpencil_stroke_join_and_trim(), and gpencil_merge_by_distance_exec().

◆ BKE_gpencil_stroke_minmax()

bool BKE_gpencil_stroke_minmax ( const struct bGPDstroke gps,
const bool  use_select,
float  r_min[3],
float  r_max[3] 
)

Referenced by viewselected_exec().

◆ BKE_gpencil_stroke_normal()

void BKE_gpencil_stroke_normal ( const struct bGPDstroke gps,
float  r_normal[3] 
)

Referenced by deformStroke(), and duplicateStroke().

◆ BKE_gpencil_stroke_perimeter_from_view()

struct bGPDstroke* BKE_gpencil_stroke_perimeter_from_view ( struct RegionView3D rv3d,
struct bGPdata gpd,
const struct bGPDlayer gpl,
struct bGPDstroke gps,
const int  subdivisions,
const float  diff_mat[4][4] 
)

◆ BKE_gpencil_stroke_point_count()

int BKE_gpencil_stroke_point_count ( struct bGPdata gpd)

◆ BKE_gpencil_stroke_sample()

bool BKE_gpencil_stroke_sample ( bGPdata gpd,
bGPDstroke gps,
const float  dist,
const bool  select 
)

◆ BKE_gpencil_stroke_segment_length()

float BKE_gpencil_stroke_segment_length ( const struct bGPDstroke gps,
const int  start_index,
const int  end_index,
bool  use_3d 
)

Calculate grease pencil stroke length between points.

Definition at line 1371 of file gpencil_geom.c.

References len_v2v2(), len_v3v3(), MAX2, MIN2, bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.

Referenced by ED_gpencil_stroke_join_and_trim().

◆ BKE_gpencil_stroke_set_random_color()

void BKE_gpencil_stroke_set_random_color ( bGPDstroke gps)

Set a random color to stroke using vertex color.

Parameters
gpsStroke

Definition at line 2680 of file gpencil_geom.c.

References BLI_assert, BLI_hash_int_01(), BLI_hash_int_2d(), copy_v4_v4(), bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::vert_color, bGPDspoint::x, bGPDspoint::y, and bGPDspoint::z.

Referenced by lineart_gpencil_generate().

◆ BKE_gpencil_stroke_shrink()

bool BKE_gpencil_stroke_shrink ( bGPDstroke gps,
const float  dist 
)

Shrink the stroke by length.

Parameters
gpsStroke to shrink
distdelta length

Definition at line 706 of file gpencil_geom.c.

References BKE_gpencil_stroke_trim_points(), copy_v3_v3(), interp_v3_v3v3(), len_v3v3(), bGPDstroke::points, bGPDstroke::totpoints, x, and bGPDspoint::x.

◆ BKE_gpencil_stroke_simplify_adaptive()

void BKE_gpencil_stroke_simplify_adaptive ( bGPdata gpd,
bGPDstroke gps,
float  epsilon 
)

Reduce a series of points to a simplified version, but maintains the general shape of the series

Ramer - Douglas - Peucker algorithm by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm

Parameters
gpdGrease pencil data-block
gpsGrease pencil stroke
epsilonEpsilon value to define precision of the algorithm

Definition at line 1717 of file gpencil_geom.c.

References BKE_gpencil_free_point_weights(), BKE_gpencil_stroke_geometry_update(), closest_to_line_segment_v3(), bGPDstroke::dvert, MDeformVert::dw, blender::robust_pred::epsilon, len_v3v3(), max_i(), MEM_callocN, MEM_dupallocN, MEM_SAFE_FREE, NULL, bGPDstroke::points, bGPDstroke::totpoints, and x.

Referenced by deformStroke(), gpencil_stroke_newfrombuffer(), and gpencil_stroke_simplify_exec().

◆ BKE_gpencil_stroke_simplify_fixed()

void BKE_gpencil_stroke_simplify_fixed ( bGPdata gpd,
bGPDstroke gps 
)

Simplify alternate vertex of stroke except extremes.

Parameters
gpdGrease pencil data-block
gpsGrease pencil stroke

Definition at line 1826 of file gpencil_geom.c.

References BKE_gpencil_free_point_weights(), BKE_gpencil_stroke_geometry_update(), bGPDstroke::dvert, MDeformVert::dw, MEM_dupallocN, MEM_recallocN, MEM_SAFE_FREE, NULL, bGPDstroke::points, and bGPDstroke::totpoints.

Referenced by deformStroke(), gpencil_stroke_from_buffer(), and gpencil_stroke_simplify_fixed_exec().

◆ BKE_gpencil_stroke_smooth()

bool BKE_gpencil_stroke_smooth ( bGPDstroke gps,
int  i,
float  inf 
)

Apply smooth position to stroke point.

Parameters
gpsStroke to smooth
iPoint index
infAmount of smoothing to apply

Definition at line 778 of file gpencil_geom.c.

References CLAMP_MAX, CLAMP_MIN, ELEM, float(), interp_v3_v3v3(), madd_v3_v3fl(), bGPDstroke::points, steps, bGPDstroke::totpoints, and bGPDspoint::x.

Referenced by deformStroke(), gpencil_brush_smooth_apply(), gpencil_interpolate_smooth_stroke(), gpencil_smooth_stroke(), gpencil_stroke_from_buffer(), and gpencil_stroke_newfrombuffer().

◆ BKE_gpencil_stroke_smooth_strength()

bool BKE_gpencil_stroke_smooth_strength ( bGPDstroke gps,
int  point_index,
float  influence 
)

Apply smooth strength to stroke point.

Parameters
gpsStroke to smooth
point_indexPoint index
influenceAmount of smoothing to apply

Definition at line 841 of file gpencil_geom.c.

References CLAMP_MAX, CLAMP_MIN, ELEM, float(), interpf(), bGPDstroke::points, steps, bGPDspoint::strength, and bGPDstroke::totpoints.

Referenced by deformStroke(), gpencil_brush_smooth_apply(), gpencil_interpolate_smooth_stroke(), gpencil_smooth_stroke(), and gpencil_stroke_newfrombuffer().

◆ BKE_gpencil_stroke_smooth_thickness()

bool BKE_gpencil_stroke_smooth_thickness ( bGPDstroke gps,
int  point_index,
float  influence 
)

Apply smooth for thickness to stroke point (use pressure).

Parameters
gpsStroke to smooth
point_indexPoint index
influenceAmount of smoothing to apply

Definition at line 905 of file gpencil_geom.c.

References CLAMP_MAX, CLAMP_MIN, ELEM, float(), interpf(), bGPDstroke::points, bGPDspoint::pressure, steps, and bGPDstroke::totpoints.

Referenced by deformStroke(), gpencil_brush_smooth_apply(), and gpencil_smooth_stroke().

◆ BKE_gpencil_stroke_smooth_uv()

bool BKE_gpencil_stroke_smooth_uv ( bGPDstroke gps,
int  point_index,
float  influence 
)

Apply smooth for UV rotation to stroke point (use pressure).

Parameters
gpsStroke to smooth
point_indexPoint index
influenceAmount of smoothing to apply

Definition at line 968 of file gpencil_geom.c.

References CLAMP, CLAMP_MAX, CLAMP_MIN, interpf(), line_point_factor_v3(), M_PI_2, bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::uv_rot, and bGPDspoint::x.

Referenced by deformStroke(), gpencil_brush_smooth_apply(), and gpencil_smooth_stroke().

◆ BKE_gpencil_stroke_split()

bool BKE_gpencil_stroke_split ( bGPdata gpd,
bGPDframe gpf,
bGPDstroke gps,
const int  before_index,
bGPDstroke **  remaining_gps 
)

Split stroke.

Parameters
gpdGrease pencil data-block
gpfGrease pencil frame
gpsGrease pencil original stroke
before_indexPosition of the point to split
remaining_gpsSecondary stroke after split.
Returns
True if the split was done

Definition at line 646 of file gpencil_geom.c.

References BKE_gpencil_stroke_add_existing_style(), BKE_gpencil_stroke_geometry_update(), BKE_gpencil_stroke_trim_points(), MDeformWeight::def_nr, bGPDstroke::dvert, MDeformVert::dw, MDeformVert::flag, bGPDstroke::mat_nr, MEM_callocN, bGPDstroke::points, bGPDstroke::thickness, bGPDstroke::totpoints, MDeformVert::totweight, and MDeformWeight::weight.

◆ BKE_gpencil_stroke_stretch()

bool BKE_gpencil_stroke_stretch ( bGPDstroke gps,
const float  dist,
const float  tip_length 
)

Backbone stretch similar to Freestyle.

Parameters
gpsStroke to sample
distDistance of one segment
tip_lengthIgnore tip jittering, set zero to use default value.

Definition at line 537 of file gpencil_geom.c.

References copy_v3_v3(), interp_v3_v3v3(), len_v3v3(), bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.

◆ BKE_gpencil_stroke_subdivide()

void BKE_gpencil_stroke_subdivide ( bGPdata gpd,
bGPDstroke gps,
int  level,
int  type 
)

◆ BKE_gpencil_stroke_to_view_space()

void BKE_gpencil_stroke_to_view_space ( RegionView3D rv3d,
bGPDstroke gps,
const float  diff_mat[4][4] 
)

Stroke to view space Transforms a stroke to view space. This allows for manipulations in 2D but also easy conversion back to 3D. Note: also takes care of parent space transform

Definition at line 3493 of file gpencil_geom.c.

References mul_m4_v3(), mul_v3_m4v3(), bGPDstroke::points, bGPDstroke::totpoints, RegionView3D::viewmat, and bGPDspoint::x.

Referenced by BKE_gpencil_stroke_perimeter_from_view().

◆ BKE_gpencil_stroke_trim()

bool BKE_gpencil_stroke_trim ( bGPdata gpd,
bGPDstroke gps 
)

◆ BKE_gpencil_stroke_trim_points()

bool BKE_gpencil_stroke_trim_points ( bGPDstroke gps,
const int  index_from,
const int  index_to 
)

Trim stroke to needed segments

Parameters
gpsTarget stroke
index_fromthe index of the first point to be used in the trimmed result
index_tothe index of the last point to be used in the trimmed result

Definition at line 587 of file gpencil_geom.c.

References BKE_gpencil_free_stroke_weights(), MDeformWeight::def_nr, bGPDstroke::dvert, MDeformVert::dw, MDeformVert::flag, MEM_callocN, MEM_freeN, NULL, bGPDstroke::points, bGPDstroke::totpoints, MDeformVert::totweight, and MDeformWeight::weight.

Referenced by BKE_gpencil_stroke_shrink(), and BKE_gpencil_stroke_split().

◆ BKE_gpencil_stroke_uniform_subdivide()

void BKE_gpencil_stroke_uniform_subdivide ( bGPdata gpd,
bGPDstroke gps,
const uint32_t  target_number,
const bool  select 
)

Subdivide the grease pencil stroke so the number of points is target_number. Does not change the shape of the stroke. The new points will be distributed as uniformly as possible by repeatedly subdividing the current longest edge.

Parameters
gpsThe stroke to be up-sampled.
target_numberThe number of points the up-sampled stroke should have.
selectSelect/Deselect the stroke.

Definition at line 3353 of file gpencil_geom.c.

References BKE_gpencil_stroke_geometry_update(), BKE_gpencil_stroke_select_index_set(), BLI_addtail(), BLI_assert, BLI_heap_free(), BLI_heap_insert(), BLI_heap_new(), BLI_heap_pop_min(), BLI_insertlinkafter(), copy_v3_v3(), copy_v4_v4(), MDeformWeight::def_nr, bGPDstroke::dvert, tSamplePoint::dw, MDeformVert::dw, ListBase::first, bGPDspoint::flag, bGPDstroke::flag, tSampleEdge::from, GP_SPOINT_SELECT, GP_STROKE_CYCLIC, GP_STROKE_SELECT, interp_v3_v3v3(), interp_v4_v4v4(), interpf(), ListBase::last, tSampleEdge::length_sq, LISTBASE_FOREACH_MUTABLE, MEM_callocN, MEM_freeN, MEM_recallocN, MEM_SAFE_FREE, MIN2, new_sample_edge_from_sample_points(), new_sample_point_from_gp_point(), tSamplePoint::next, NULL, bGPDstroke::points, tSamplePoint::pressure, bGPDspoint::pressure, select(), tSamplePoint::strength, bGPDspoint::strength, tSamplePoint::time, bGPDspoint::time, tSampleEdge::to, bGPDstroke::totpoints, tSamplePoint::totweight, MDeformVert::totweight, bGPDspoint::vert_color, tSamplePoint::vertex_color, MDeformWeight::weight, tSamplePoint::x, and bGPDspoint::x.

Referenced by gpencil_interpolate_seq_exec(), and gpencil_interpolate_set_points().

◆ BKE_gpencil_stroke_uv_update()

void BKE_gpencil_stroke_uv_update ( bGPDstroke gps)

Update Stroke UV data.

Parameters
gpsGrease pencil stroke

Definition at line 1287 of file gpencil_geom.c.

References len_v3v3(), NULL, bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::uv_fac, and x.

Referenced by BKE_gpencil_stroke_geometry_update(), ED_gpencil_update_color_uv(), and gpencil_sbuffer_stroke_ensure().

◆ BKE_gpencil_transform()

void BKE_gpencil_transform ( bGPdata gpd,
const float  mat[4][4] 
)

Apply grease pencil Transforms.

Parameters
gpdGrease pencil data-block
matTransformation matrix

Definition at line 2514 of file gpencil_geom.c.

References BKE_gpencil_stroke_geometry_update(), bGPdata::layers, LISTBASE_FOREACH, mat4_to_scale(), mul_m4_v3(), NULL, bGPDstroke::points, bGPDspoint::pressure, and bGPDspoint::x.

Referenced by apply_objects_internal().