45 float d1[3], d2[3], len_d1;
83 const float denominator,
90 const float epsilon = 0.25f / 65536.0f;
91 if (
fabsf(denominator) < epsilon) {
93 if (numerator < -epsilon) {
100 const float correction = numerator / denominator;
101 if (correction < 0.0f || !isfinite(correction)) {
106 if (denominator < 0.0f) {
108 *scale = std::max(*scale, correction);
113 *scale = std::min(*scale, correction);
121 float base_offset[2] = {0.0f, 0.0f};
135 for (
TransData *td = tc->data; td < tc->
data + tc->data_len; td++) {
138 const float *scale_origin = use_local_center ? td->center : t->
center_global;
141 const float *
min = td->loc;
142 const float *
max = td->loc;
147 scale_origin[0] - base_offset[0], scale_origin[0] -
min[0], &scale);
151 base_offset[0] + t->
aspect[0] - scale_origin[0],
max[0] - scale_origin[0], &scale);
157 scale_origin[1] - base_offset[1], scale_origin[1] -
min[1], &scale);
160 base_offset[1] + t->
aspect[1] - scale_origin[1],
max[1] - scale_origin[1], &scale);
166 return scale != 1.0f;
179 float ratio = t->
values[0];
198 float pvec[3] = {0.0f, 0.0f, 0.0f};
200 for (
i = 0;
i < 3;
i++) {
218 for (const int i : range) {
219 TransData *td = &tc->data[i];
220 if (td->flag & TD_SKIP) {
223 ElementResize(t, tc, i, mat);
233 t->con.applySize(t,
nullptr,
nullptr, mat);
237 for (
i = 0;
i < tc->data_len;
i++) {
263 float mouse_dir_constraint[3];
281 status.item(
TIP_(
"Transform is set to only affect location"), ICON_ERROR);
288 int mval_start[2], mval_end[2];
293 mul_v3_m3v3(mval_dir, viewmat, mouse_dir_constraint);
308 mval_end[0] = t->
center2d[0] + mval_dir[0];
309 mval_end[1] = t->
center2d[1] + mval_dir[1];
321#ifdef USE_NUM_NO_ZERO
int BKE_image_find_nearest_tile_with_offset(const Image *image, const float co[2], float r_uv_offset[2]) ATTR_NONNULL(2
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void size_to_mat3(float R[3][3], const float size[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
void transform_pivot_set_m4(float mat[4][4], const float pivot[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool is_zero_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v2(float n[2])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void ED_area_status_text(ScrArea *area, const char *str)
BMesh const char void * data
VecBase< float, 2 > float2
VecBase< float, 3 > float3
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 2 > float2
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)