65 const Object *ob_curve,
float co[3],
const short axis,
const CurveDeform *cd,
float r_quat[4])
68 float fac, loc[4], dir[3], new_quat[4], radius;
70 const bool is_neg_axis = (axis > 2);
72 if (ob_curve->
runtime->curve_cache ==
nullptr) {
77 if (ob_curve->
runtime->curve_cache->anim_path_accum_length ==
nullptr) {
85 const float divisor = cd->
dmax[index] - cd->
dmin[index];
86 if (
LIKELY(divisor > FLT_EPSILON)) {
87 fac = -(co[index] - cd->
dmax[index]) / divisor;
96 if (
LIKELY(totdist > FLT_EPSILON)) {
97 fac = -(co[index] - cd->
dmax[index]) / totdist;
107 const float divisor = cd->
dmax[index] - cd->
dmin[index];
108 if (
LIKELY(divisor > FLT_EPSILON)) {
109 fac = (co[index] - cd->
dmin[index]) / divisor;
118 if (
LIKELY(totdist > FLT_EPSILON)) {
119 fac = +(co[index] - cd->
dmin[index]) / totdist;
128 float quat[4], cent[3];
134 float dir_flat[3] = {0, 0, 0}, q[4];
201 float (*vert_coords)[3],
202 const int vert_coords_len,
204 const int defgrp_index,
213 const bool is_neg_axis = (defaxis > 2);
215 bool use_dverts =
false;
222 cu =
static_cast<Curve *
>(ob_curve->
data);
228 if (is_neg_axis ==
false) {
243 if (em_target !=
nullptr) {
245 if (cd_dvert_offset != -1) {
250 if (dvert !=
nullptr) {
258#define DEFORM_OP(dvert) \
260 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
261 BKE_defvert_find_weight(dvert, defgrp_index); \
262 if (weight > 0.0f) { \
264 mul_m4_v3(cd.curvespace, vert_coords[a]); \
265 copy_v3_v3(vec, vert_coords[a]); \
266 calc_curve_deform(ob_curve, vec, defaxis, &cd, nullptr); \
267 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
268 mul_m4_v3(cd.objectspace, vert_coords[a]); \
273 if (em_target !=
nullptr) {
282 for (a = 0; a < vert_coords_len; a++) {
291#define DEFORM_OP_MINMAX(dvert) \
293 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
294 BKE_defvert_find_weight(dvert, defgrp_index); \
295 if (weight > 0.0f) { \
296 mul_m4_v3(cd.curvespace, vert_coords[a]); \
297 minmax_v3v3_v3(cd.dmin, cd.dmax, vert_coords[a]); \
303#define DEFORM_OP_CLAMPED(dvert) \
305 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
306 BKE_defvert_find_weight(dvert, defgrp_index); \
307 if (weight > 0.0f) { \
309 copy_v3_v3(vec, vert_coords[a]); \
310 calc_curve_deform(ob_curve, vec, defaxis, &cd, nullptr); \
311 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
312 mul_m4_v3(cd.objectspace, vert_coords[a]); \
317 if (em_target !=
nullptr) {
332 for (a = 0; a < vert_coords_len; a++) {
336 for (a = 0; a < vert_coords_len; a++) {
342#undef DEFORM_OP_MINMAX
343#undef DEFORM_OP_CLAMPED
347 for (a = 0; a < vert_coords_len; a++) {
354 for (a = 0; a < vert_coords_len; a++) {
359 for (a = 0; a < vert_coords_len; a++) {
370 float (*vert_coords)[3],
371 const int vert_coords_len,
373 const int defgrp_index,
390 float (*vert_coords)[3],
391 const int vert_coords_len,
392 const int defgrp_index,
412 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 CustomData *data, eCustomDataType 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])
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
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)
void quat_to_mat3(float m[3][3], const float q[4])
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 minmax_v3v3_v3(float min[3], float max[3], const float vec[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])
MINLINE float normalize_v3(float n[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
ObjectRuntimeHandle * runtime