39 float dmin[3], dmax[3];
40 float curvespace[4][4], objectspace[4][4], objectspace3[3][3];
62 const Object *ob_curve,
float co[3],
const short axis,
const CurveDeform *cd,
float r_quat[4])
65 float fac, loc[4], dir[3], new_quat[4], radius;
67 const bool is_neg_axis = (axis > 2);
82 const float divisor = cd->
dmax[index] - cd->
dmin[index];
83 if (
LIKELY(divisor > FLT_EPSILON)) {
84 fac = -(co[index] - cd->
dmax[index]) / divisor;
93 if (
LIKELY(totdist > FLT_EPSILON)) {
94 fac = -(co[index] - cd->
dmax[index]) / totdist;
104 const float divisor = cd->
dmax[index] - cd->
dmin[index];
105 if (
LIKELY(divisor > FLT_EPSILON)) {
106 fac = (co[index] - cd->
dmin[index]) / divisor;
115 if (
LIKELY(totdist > FLT_EPSILON)) {
116 fac = +(co[index] - cd->
dmin[index]) / totdist;
125 float quat[4], cent[3];
131 float dir_flat[3] = {0, 0, 0}, q[4];
198 float (*vert_coords)[3],
199 const int vert_coords_len,
201 const int defgrp_index,
209 const bool is_neg_axis = (defaxis > 2);
211 bool use_dverts =
false;
224 if (is_neg_axis ==
false) {
239 if (em_target !=
NULL) {
241 if (cd_dvert_offset != -1) {
254 #define DEFORM_OP(dvert) \
256 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
257 BKE_defvert_find_weight(dvert, defgrp_index); \
258 if (weight > 0.0f) { \
260 mul_m4_v3(cd.curvespace, vert_coords[a]); \
261 copy_v3_v3(vec, vert_coords[a]); \
262 calc_curve_deform(ob_curve, vec, defaxis, &cd, NULL); \
263 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
264 mul_m4_v3(cd.objectspace, vert_coords[a]); \
269 if (em_target !=
NULL) {
278 for (
a = 0;
a < vert_coords_len;
a++) {
287 #define DEFORM_OP_MINMAX(dvert) \
289 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
290 BKE_defvert_find_weight(dvert, defgrp_index); \
291 if (weight > 0.0f) { \
292 mul_m4_v3(cd.curvespace, vert_coords[a]); \
293 minmax_v3v3_v3(cd.dmin, cd.dmax, vert_coords[a]); \
299 #define DEFORM_OP_CLAMPED(dvert) \
301 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
302 BKE_defvert_find_weight(dvert, defgrp_index); \
303 if (weight > 0.0f) { \
305 copy_v3_v3(vec, vert_coords[a]); \
306 calc_curve_deform(ob_curve, vec, defaxis, &cd, NULL); \
307 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
308 mul_m4_v3(cd.objectspace, vert_coords[a]); \
313 if (em_target !=
NULL) {
328 for (
a = 0;
a < vert_coords_len;
a++) {
332 for (
a = 0;
a < vert_coords_len;
a++) {
338 #undef DEFORM_OP_MINMAX
339 #undef DEFORM_OP_CLAMPED
343 for (
a = 0;
a < vert_coords_len;
a++) {
350 for (
a = 0;
a < vert_coords_len;
a++) {
355 for (
a = 0;
a < vert_coords_len;
a++) {
366 float (*vert_coords)[3],
367 const int vert_coords_len,
369 const int defgrp_index,
374 ob_curve, ob_target, vert_coords, vert_coords_len, dvert, defgrp_index, flag, defaxis,
NULL);
379 float (*vert_coords)[3],
380 const int vert_coords_len,
381 const int defgrp_index,
401 const int no_rot_axis,
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
float BKE_anim_path_get_length(const struct CurveCache *curve_cache)
int CustomData_get_offset(const struct CustomData *data, int type)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m3(float m[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void vec_apply_track(float vec[3], short axis)
float normalize_qt(float q[4])
void mul_qt_v3(const float q[4], float r[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void quat_apply_track(float quat[4], short axis, short upflag)
void copy_qt_qt(float q[4], const float a[4])
void quat_to_mat3(float mat[3][3], const float q[4])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
#define INIT_MINMAX(min, max)
@ MOD_CURVE_INVERT_VGROUP
Object is a sort of wrapper for general info.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT const BMVert * v
const float * anim_path_accum_length
struct CurveCache * curve_cache