73#define CONSTRAIN_EPSILON 0.0001f
77 const float *constraint_vector[2];
79 for (
int i = 0;
i < 3;
i++) {
89 cross_v3_v3v3(r_plane_no, constraint_vector[0], constraint_vector[1]);
118 else if (dims == 1) {
142 const float min_dist = 1.0f;
170 float vec[3], factor,
angle;
171 float t_con_center[3];
207 float norm[3], norm_center[3];
221 if (1.0f -
fabsf(factor) < 0.0002f) {
243 if (!isfinite(
out[0])) {
246 if (!isfinite(
out[1])) {
249 if (!isfinite(
out[2])) {
260 const float plane_no[3],
276 const float plane[4],
279 float face_plane[4], isect_orig[3], isect_dir[3];
326 const float eps = 0.001f;
327 float view_to_plane[3];
330 float factor =
dot_v3v3(plane_no, view_to_plane);
335 const float plane_no[3],
340 float pos[3], view_vec[3], factor;
376 bool is_snap_to_point =
false, is_snap_to_edge =
false, is_snap_to_face =
false;
382 is_snap_to_point = !is_snap_to_edge && !is_snap_to_face;
389 if (is_snap_to_point) {
399 if (is_snap_to_edge) {
402 else if (is_snap_to_face) {
412 else if (dims == 1) {
426 if (is_snap_to_edge) {
429 else if (is_snap_to_face) {
554 const float axismtx[3][3],
608 float tmp_axismtx[3][3];
609 const float (*axismtx)[3];
620 axismtx = tmp_axismtx;
685 switch (orientation) {
716 TransInfo *t,
const float center[3],
const float dir[3],
char axis,
short options)
722 float v1[3],
v2[3], v3[3];
756 immVertexFormat(),
"pos", blender::gpu::VertAttrType::SFLOAT_32_32_32);
807 if (depth_test_enabled) {
812 immVertexFormat(),
"pos", blender::gpu::VertAttrType::SFLOAT_32_32_32);
816 float viewport_size[4];
818 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
832 if (depth_test_enabled) {
853 float tmat[4][4], imat[4][4];
861 if (rv3d !=
nullptr) {
880 if (depth_test_enabled) {
885 immVertexFormat(),
"pos", blender::gpu::VertAttrType::SFLOAT_32_32_32);
905 if (depth_test_enabled) {
920 immVertexFormat(),
"pos", blender::gpu::VertAttrType::SFLOAT_32_32_32);
932 const float y1 = v2d->
cur.
ymin;
934 const float y2 = v2d->
cur.
ymax;
957 float tmp_axismtx[3][3];
961 for (
int i = 0;
i < tc->data_len;
i++, td++) {
963 const float (*axismtx)[3];
993 axismtx = tmp_axismtx;
1087 if (
abs(dvec.x) <
abs(dvec.y)) {
1103 float mvec[3], proj[3];
1121 for (
i = 0;
i < 3;
i++) {
1122 float axis[3], axis_2d[2];
1190 if (mode_prev != t->
con.
mode) {
MINLINE float max_ff(float a, float b)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
bool isect_ray_ray_v3(const float ray_origin_a[3], const float ray_direction_a[3], const float ray_origin_b[3], const float ray_direction_b[3], float *r_lambda_a, float *r_lambda_b)
float closest_to_ray_v3(float r_close[3], const float p[3], const float ray_orig[3], const float ray_dir[3])
bool isect_plane_plane_v3(const float plane_a[4], const float plane_b[4], float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT
bool isect_ray_plane_v3_factor(const float ray_origin[3], const float ray_direction[3], const float plane_co[3], const float plane_no[3], float *r_lambda)
void mul_m3_v3(const float M[3][3], float r[3])
void unit_m3(float m[3][3])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void unit_m4(float m[4][4])
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
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 float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3_length(float r[3], const float a[3], float unit_length)
MINLINE void negate_v3(float r[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define SNPRINTF_UTF8(dst, format,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define UNUSED_FUNCTION(x)
@ V3D_ORIENT_CUSTOM_MATRIX
void GPU_matrix_scale_2f(float x, float y)
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
void GPU_blend(GPUBlend blend)
void GPU_depth_test(GPUDepthTest test)
GPUDepthTest GPU_depth_test_get()
void GPU_viewport_size_get_f(float coords[4])
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
void UI_make_axis_color(const unsigned char col[3], char axis, unsigned char r_col[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
static void mul(btAlignedObjectArray< T > &items, const Q &value)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
CCL_NAMESPACE_BEGIN struct Options options
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
VecBase< float, 2 > float2
VecBase< float, 3 > float3