Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_math_bits.h"
#include "BLI_utildefines.h"
#include "BLI_strict_flags.h"
Go to the source code of this file.
Classes | |
struct | Float3_Len |
struct | Double2_Len |
Macros | |
#define | CCW(A, B, C) ((C[1] - A[1]) * (B[0] - A[0]) > (B[1] - A[1]) * (C[0] - A[0])) |
#define | MEAN_VALUE_HALF_TAN_V2(_area, i1, i2) |
#define | IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0) |
#define | CROSS_SIGN(dir_a, dir_b) ((void)cross_v3_v3v3(test_dir, dir_a, dir_b), (dot_v3v3(plane, test_dir) > 0.0f)) |
Functions | |
void | cross_tri_v3 (float n[3], const float v1[3], const float v2[3], const float v3[3]) |
float | normal_tri_v3 (float n[3], const float v1[3], const float v2[3], const float v3[3]) |
float | normal_quad_v3 (float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
float | normal_poly_v3 (float n[3], const float verts[][3], unsigned int nr) |
float | area_quad_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
float | area_squared_quad_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
float | area_tri_v3 (const float v1[3], const float v2[3], const float v3[3]) |
float | area_squared_tri_v3 (const float v1[3], const float v2[3], const float v3[3]) |
float | area_tri_signed_v3 (const float v1[3], const float v2[3], const float v3[3], const float normal[3]) |
float | area_poly_v3 (const float verts[][3], unsigned int nr) |
float | area_squared_poly_v3 (const float verts[][3], unsigned int nr) |
float | cross_poly_v2 (const float verts[][2], unsigned int nr) |
void | cross_poly_v3 (float n[3], const float verts[][3], unsigned int nr) |
float | area_poly_v2 (const float verts[][2], unsigned int nr) |
float | area_poly_signed_v2 (const float verts[][2], unsigned int nr) |
float | area_squared_poly_v2 (const float verts[][2], unsigned int nr) |
float | cotangent_tri_weight_v3 (const float v1[3], const float v2[3], const float v3[3]) |
void | plane_from_point_normal_v3 (float r_plane[4], const float plane_co[3], const float plane_no[3]) |
void | plane_to_point_vector_v3 (const float plane[4], float r_plane_co[3], float r_plane_no[3]) |
void | plane_to_point_vector_v3_normalized (const float plane[4], float r_plane_co[3], float r_plane_no[3]) |
float | volume_tetrahedron_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
float | volume_tetrahedron_signed_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
float | volume_tri_tetrahedron_signed_v3_6x (const float v1[3], const float v2[3], const float v3[3]) |
float | volume_tri_tetrahedron_signed_v3 (const float v1[3], const float v2[3], const float v3[3]) |
float | dist_squared_to_line_v2 (const float p[2], const float l1[2], const float l2[2]) |
float | dist_to_line_v2 (const float p[2], const float l1[2], const float l2[2]) |
float | dist_squared_to_line_segment_v2 (const float p[2], const float l1[2], const float l2[2]) |
float | dist_to_line_segment_v2 (const float p[2], const float l1[2], const float l2[2]) |
float | closest_seg_seg_v2 (float r_closest_a[2], float r_closest_b[2], float *r_lambda_a, float *r_lambda_b, const float a1[2], const float a2[2], const float b1[2], const float b2[2]) |
float | closest_to_line_segment_v2 (float r_close[2], const float p[2], const float l1[2], const float l2[2]) |
float | closest_to_line_segment_v3 (float r_close[3], const float p[3], const float l1[3], const float l2[3]) |
void | closest_to_plane_v3 (float r_close[3], const float plane[4], const float pt[3]) |
void | closest_to_plane_normalized_v3 (float r_close[3], const float plane[4], const float pt[3]) |
void | closest_to_plane3_v3 (float r_close[3], const float plane[3], const float pt[3]) |
void | closest_to_plane3_normalized_v3 (float r_close[3], const float plane[3], const float pt[3]) |
float | dist_signed_squared_to_plane_v3 (const float pt[3], const float plane[4]) |
float | dist_squared_to_plane_v3 (const float pt[3], const float plane[4]) |
float | dist_signed_squared_to_plane3_v3 (const float pt[3], const float plane[3]) |
float | dist_squared_to_plane3_v3 (const float pt[3], const float plane[3]) |
float | dist_signed_to_plane_v3 (const float pt[3], const float plane[4]) |
float | dist_to_plane_v3 (const float pt[3], const float plane[4]) |
float | dist_signed_to_plane3_v3 (const float pt[3], const float plane[3]) |
float | dist_to_plane3_v3 (const float pt[3], const float plane[3]) |
float | dist_squared_to_line_segment_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | dist_to_line_segment_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | dist_squared_to_line_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | dist_to_line_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | dist_signed_squared_to_corner_v3v3v3 (const float p[3], const float v1[3], const float v2[3], const float v3[3], const float axis_ref[3]) |
float | dist_squared_to_ray_v3_normalized (const float ray_origin[3], const float ray_direction[3], const float co[3]) |
float | dist_squared_ray_to_seg_v3 (const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], float r_point[3], float *r_depth) |
void | aabb_get_near_far_from_plane (const float plane_no[3], const float bbmin[3], const float bbmax[3], float bb_near[3], float bb_afar[3]) |
float | dist_seg_seg_v2 (const float a1[3], const float a2[3], const float b1[3], const float b2[3]) |
void | closest_on_tri_to_point_v3 (float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3]) |
int | isect_seg_seg_v2_int (const int v1[2], const int v2[2], const int v3[2], const int v4[2]) |
int | isect_line_line_v2_point (const float v0[2], const float v1[2], const float v2[2], const float v3[2], float r_vi[2]) |
int | isect_seg_seg_v2 (const float v1[2], const float v2[2], const float v3[2], const float v4[2]) |
void | isect_seg_seg_v3 (const float a0[3], const float a1[3], const float b0[3], const float b1[3], float r_a[3], float r_b[3]) |
int | isect_seg_seg_v2_point_ex (const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float endpoint_bias, float r_vi[2]) |
int | isect_seg_seg_v2_point (const float v0[2], const float v1[2], const float v2[2], const float v3[2], float r_vi[2]) |
bool | isect_seg_seg_v2_simple (const float v1[2], const float v2[2], const float v3[2], const float v4[2]) |
int | isect_seg_seg_v2_lambda_mu_db (const double v1[2], const double v2[2], const double v3[2], const double v4[2], double *r_lambda, double *r_mu) |
int | isect_line_sphere_v3 (const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]) |
int | isect_line_sphere_v2 (const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2]) |
bool | isect_point_poly_v2 (const float pt[2], const float verts[][2], const unsigned int nr, const bool UNUSED(use_holes)) |
bool | isect_point_poly_v2_int (const int pt[2], const int verts[][2], const unsigned int nr, const bool UNUSED(use_holes)) |
bool | isect_point_tri_v2_cw (const float pt[2], const float v1[2], const float v2[2], const float v3[2]) |
int | isect_point_tri_v2 (const float pt[2], const float v1[2], const float v2[2], const float v3[2]) |
int | isect_point_quad_v2 (const float pt[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2]) |
bool | isect_line_segment_tri_v3 (const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]) |
bool | isect_line_segment_tri_epsilon_v3 (const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon) |
bool | isect_ray_tri_v3 (const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]) |
bool | isect_ray_plane_v3 (const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, const bool clip) |
bool | isect_ray_tri_epsilon_v3 (const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon) |
void | isect_ray_tri_watertight_v3_precalc (struct IsectRayPrecalc *isect_precalc, const float ray_direction[3]) |
bool | isect_ray_tri_watertight_v3 (const float ray_origin[3], const struct IsectRayPrecalc *isect_precalc, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]) |
bool | isect_ray_tri_watertight_v3_simple (const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]) |
bool | isect_ray_seg_v2 (const float ray_origin[2], const float ray_direction[2], const float v0[2], const float v1[2], float *r_lambda, float *r_u) |
bool | isect_ray_line_v3 (const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], float *r_lambda) |
bool | isect_point_planes_v3 (float(*planes)[4], int totplane, const float p[3]) |
bool | isect_point_planes_v3_negated (const float(*planes)[4], const int totplane, const float p[3]) |
bool | isect_line_plane_v3 (float r_isect_co[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3]) |
bool | isect_plane_plane_plane_v3 (const float plane_a[4], const float plane_b[4], const float plane_c[4], float r_isect_co[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]) |
bool | isect_planes_v3_fn (const float planes[][4], const int planes_len, const float eps_coplanar, const float eps_isect, void(*callback_fn)(const float co[3], int i, int j, int k, void *user_data), void *user_data) |
bool | isect_tri_tri_v3_ex (const float tri_a[3][3], const float tri_b[3][3], float r_i1[3], float r_i2[3], int *r_tri_a_edge_isect_count) |
bool | isect_tri_tri_v3 (const float t_a0[3], const float t_a1[3], const float t_a2[3], const float t_b0[3], const float t_b1[3], const float t_b2[3], float r_i1[3], float r_i2[3]) |
static bool | getLowestRoot (const float a, const float b, const float c, const float maxR, float *root) |
int | isect_aabb_planes_v3 (const float(*planes)[4], const int totplane, const float bbmin[3], const float bbmax[3]) |
bool | isect_sweeping_sphere_tri_v3 (const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]) |
bool | isect_axial_line_segment_tri_v3 (const int axis, const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda) |
int | isect_line_line_epsilon_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3], float r_i1[3], float r_i2[3], const float epsilon) |
int | isect_line_line_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3], float r_i1[3], float r_i2[3]) |
bool | isect_line_line_strict_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *r_lambda) |
bool | isect_ray_ray_epsilon_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], const float epsilon, float *r_lambda_a, float *r_lambda_b) |
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) |
bool | isect_aabb_aabb_v3 (const float min1[3], const float max1[3], const float min2[3], const float max2[3]) |
void | isect_ray_aabb_v3_precalc (struct IsectRayAABB_Precalc *data, const float ray_origin[3], const float ray_direction[3]) |
bool | isect_ray_aabb_v3 (const struct IsectRayAABB_Precalc *data, const float bb_min[3], const float bb_max[3], float *tmin_out) |
bool | isect_ray_aabb_v3_simple (const float orig[3], const float dir[3], const float bb_min[3], const float bb_max[3], float *tmin, float *tmax) |
float | closest_to_ray_v3 (float r_close[3], const float p[3], const float ray_orig[3], const float ray_dir[3]) |
float | closest_to_line_v3 (float r_close[3], const float p[3], const float l1[3], const float l2[3]) |
float | closest_to_line_v2 (float r_close[2], const float p[2], const float l1[2], const float l2[2]) |
double | closest_to_line_v2_db (double r_close[2], const double p[2], const double l1[2], const double l2[2]) |
float | ray_point_factor_v3_ex (const float p[3], const float ray_origin[3], const float ray_direction[3], const float epsilon, const float fallback) |
float | ray_point_factor_v3 (const float p[3], const float ray_origin[3], const float ray_direction[3]) |
float | line_point_factor_v3_ex (const float p[3], const float l1[3], const float l2[3], const float epsilon, const float fallback) |
float | line_point_factor_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | line_point_factor_v2_ex (const float p[2], const float l1[2], const float l2[2], const float epsilon, const float fallback) |
float | line_point_factor_v2 (const float p[2], const float l1[2], const float l2[2]) |
float | line_plane_factor_v3 (const float plane_co[3], const float plane_no[3], const float l1[3], const float l2[3]) |
void | limit_dist_v3 (float v1[3], float v2[3], const float dist) |
int | isect_point_tri_v2_int (const int x1, const int y1, const int x2, const int y2, const int a, const int b) |
static bool | point_in_slice (const float p[3], const float v1[3], const float l1[3], const float l2[3]) |
static bool | point_in_slice_as (const float p[3], const float origin[3], const float normal[3]) |
bool | point_in_slice_seg (float p[3], float l1[3], float l2[3]) |
bool | isect_point_tri_prism_v3 (const float p[3], const float v1[3], const float v2[3], const float v3[3]) |
bool | isect_point_tri_v3 (const float p[3], const float v1[3], const float v2[3], const float v3[3], float r_isect_co[3]) |
bool | clip_segment_v3_plane (const float p1[3], const float p2[3], const float plane[4], float r_p1[3], float r_p2[3]) |
bool | clip_segment_v3_plane_n (const float p1[3], const float p2[3], const float plane_array[][4], const int plane_num, float r_p1[3], float r_p2[3]) |
void | axis_dominant_v3_to_m3 (float r_mat[3][3], const float normal[3]) |
Normal to x,y matrix. More... | |
void | axis_dominant_v3_to_m3_negate (float r_mat[3][3], const float normal[3]) |
static float | tri_signed_area (const float v1[3], const float v2[3], const float v3[3], const int i, const int j) |
static bool | barycentric_weights (const float v1[3], const float v2[3], const float v3[3], const float co[3], const float n[3], float w[3]) |
void | interp_weights_tri_v3 (float w[3], const float v1[3], const float v2[3], const float v3[3], const float co[3]) |
void | interp_weights_quad_v3 (float w[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float co[3]) |
int | barycentric_inside_triangle_v2 (const float w[3]) |
bool | barycentric_coords_v2 (const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]) |
void | barycentric_weights_v2 (const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]) |
void | barycentric_weights_v2_clamped (const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]) |
void | barycentric_weights_v2_persp (const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3]) |
void | barycentric_weights_v2_quad (const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float co[2], float w[4]) |
void | transform_point_by_tri_v3 (float pt_tar[3], float const pt_src[3], const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3], const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3]) |
void | transform_point_by_seg_v3 (float p_dst[3], const float p_src[3], const float l_dst_p1[3], const float l_dst_p2[3], const float l_src_p1[3], const float l_src_p2[3]) |
int | interp_sparse_array (float *array, const int list_size, const float skipval) |
void | interp_cubic_v3 (float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t) |
void | resolve_tri_uv_v2 (float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]) |
void | resolve_tri_uv_v3 (float r_uv[2], const float st[3], const float st0[3], const float st1[3], const float st2[3]) |
void | resolve_quad_uv_v2 (float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) |
void | resolve_quad_uv_v2_deriv (float r_uv[2], float r_deriv[2][2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) |
float | resolve_quad_u_v2 (const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) |
void | interp_bilinear_quad_v3 (float data[4][3], float u, float v, float res[3]) |
void | interp_barycentric_tri_v3 (float data[3][3], float u, float v, float res[3]) |
void | orthographic_m4 (float matrix[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip) |
void | perspective_m4 (float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip) |
void | perspective_m4_fov (float mat[4][4], const float angle_left, const float angle_right, const float angle_up, const float angle_down, const float nearClip, const float farClip) |
void | window_translate_m4 (float winmat[4][4], float perspmat[4][4], const float x, const float y) |
void | planes_from_projmat (const float mat[4][4], float left[4], float right[4], float bottom[4], float top[4], float near[4], float far[4]) |
void | projmat_dimensions (const float winmat[4][4], float *r_left, float *r_right, float *r_bottom, float *r_top, float *r_near, float *r_far) |
void | projmat_dimensions_db (const float winmat_fl[4][4], double *r_left, double *r_right, double *r_bottom, double *r_top, double *r_near, double *r_far) |
void | projmat_from_subregion (const float projmat[4][4], const int win_size[2], const int x_min, const int x_max, const int y_min, const int y_max, float r_projmat[4][4]) |
static void | i_multmatrix (const float icand[4][4], float mat[4][4]) |
void | polarview_m4 (float mat[4][4], float dist, float azimuth, float incidence, float twist) |
void | lookat_m4 (float mat[4][4], float vx, float vy, float vz, float px, float py, float pz, float twist) |
int | box_clip_bounds_m4 (float boundbox[2][3], const float bounds[4], float winmat[4][4]) |
void | box_minmax_bounds_m4 (float min[3], float max[3], float boundbox[2][3], float mat[4][4]) |
void | map_to_tube (float *r_u, float *r_v, const float x, const float y, const float z) |
void | map_to_sphere (float *r_u, float *r_v, const float x, const float y, const float z) |
void | map_to_plane_v2_v3v3 (float r_co[2], const float co[3], const float no[3]) |
void | map_to_plane_axis_angle_v2_v3v3fl (float r_co[2], const float co[3], const float axis[3], const float angle) |
void | accumulate_vertex_normals_tri_v3 (float n1[3], float n2[3], float n3[3], const float f_no[3], const float co1[3], const float co2[3], const float co3[3]) |
void | accumulate_vertex_normals_v3 (float n1[3], float n2[3], float n3[3], float n4[3], const float f_no[3], const float co1[3], const float co2[3], const float co3[3], const float co4[3]) |
void | accumulate_vertex_normals_poly_v3 (float **vertnos, const float polyno[3], const float **vertcos, float vdiffs[][3], const int nverts) |
void | tangent_from_uv_v3 (const float uv1[2], const float uv2[2], const float uv3[2], const float co1[3], const float co2[3], const float co3[3], const float n[3], float r_tang[3]) |
void | vcloud_estimate_transform_v3 (const int list_size, const float(*pos)[3], const float *weight, const float(*rpos)[3], const float *rweight, float lloc[3], float rloc[3], float lrot[3][3], float lscale[3][3]) |
static void | vec_add_dir (float r[3], const float v1[3], const float v2[3], const float fac) |
bool | form_factor_visible_quad (const float p[3], const float n[3], const float v0[3], const float v1[3], const float v2[3], float q0[3], float q1[3], float q2[3], float q3[3]) |
static void | ff_normalize (float n[3]) |
float | form_factor_quad (const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3]) |
float | form_factor_hemi_poly (float p[3], float n[3], float v1[3], float v2[3], float v3[3], float v4[3]) |
bool | is_edge_convex_v3 (const float v1[3], const float v2[3], const float f1_no[3], const float f2_no[3]) |
bool | is_quad_convex_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
bool | is_quad_convex_v2 (const float v1[2], const float v2[2], const float v3[2], const float v4[2]) |
bool | is_poly_convex_v2 (const float verts[][2], unsigned int nr) |
int | is_quad_flip_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
bool | is_quad_flip_v3_first_third_fast (const float v1[3], const float v2[3], const float v3[3], const float v4[3]) |
bool | is_quad_flip_v3_first_third_fast_with_normal (const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float normal[3]) |
float | cubic_tangent_factor_circle_v3 (const float tan_l[3], const float tan_r[3]) |
float | geodesic_distance_propagate_across_triangle (const float v0[3], const float v1[3], const float v2[3], const float dist1, const float dist2) |
dist_squared_to_ray_to_aabb and helpers | |
void | dist_squared_ray_to_aabb_v3_precalc (struct DistRayAABB_Precalc *neasrest_precalc, const float ray_origin[3], const float ray_direction[3]) |
float | dist_squared_ray_to_aabb_v3 (const struct DistRayAABB_Precalc *data, const float bb_min[3], const float bb_max[3], float r_point[3], float *r_depth) |
float | dist_squared_ray_to_aabb_v3_simple (const float ray_origin[3], const float ray_direction[3], const float bb_min[3], const float bb_max[3], float r_point[3], float *r_depth) |
dist_squared_to_projected_aabb and helpers | |
void | dist_squared_to_projected_aabb_precalc (struct DistProjectedAABBPrecalc *precalc, const float projmat[4][4], const float winsize[2], const float mval[2]) |
float | dist_squared_to_projected_aabb (struct DistProjectedAABBPrecalc *data, const float bbmin[3], const float bbmax[3], bool r_axis_closest[3]) |
float | dist_squared_to_projected_aabb_simple (const float projmat[4][4], const float winsize[2], const float mval[2], const float bbmin[3], const float bbmax[3]) |
Tri-Tri Intersect 2D | |
"Fast and Robust Triangle-Triangle Overlap Test Using Orientation Predicates" P. Guigue - O. Devillers Journal of Graphics Tools, 8(1), 2003. | |
static bool | isect_tri_tri_v2_impl_vert (const float t_a0[2], const float t_a1[2], const float t_a2[2], const float t_b0[2], const float t_b1[2], const float t_b2[2]) |
static bool | isect_tri_tri_v2_impl_edge (const float t_a0[2], const float t_a1[2], const float t_a2[2], const float t_b0[2], const float t_b1[2], const float t_b2[2]) |
static int | isect_tri_tri_impl_ccw_v2 (const float t_a0[2], const float t_a1[2], const float t_a2[2], const float t_b0[2], const float t_b1[2], const float t_b2[2]) |
bool | isect_tri_tri_v2 (const float t_a0[2], const float t_a1[2], const float t_a2[2], const float t_b0[2], const float t_b1[2], const float t_b2[2]) |
interp_weights_poly_v2, v3 | |
#define | IS_POINT_IX (1 << 0) |
#define | IS_SEGMENT_IX (1 << 1) |
#define | DIR_V3_SET(d_len, va, vb) |
#define | DIR_V2_SET(d_len, va, vb) |
static float | mean_value_half_tan_v3 (const struct Float3_Len *d_curr, const struct Float3_Len *d_next) |
static double | mean_value_half_tan_v2_db (const struct Double2_Len *d_curr, const struct Double2_Len *d_next) |
void | interp_weights_poly_v3 (float *w, float v[][3], const int n, const float co[3]) |
void | interp_weights_poly_v2 (float *w, float v[][2], const int n, const float co[2]) |
#define CROSS_SIGN | ( | dir_a, | |
dir_b | |||
) | ((void)cross_v3_v3v3(test_dir, dir_a, dir_b), (dot_v3v3(plane, test_dir) > 0.0f)) |
#define DIR_V2_SET | ( | d_len, | |
va, | |||
vb | |||
) |
Definition at line 4014 of file math_geom.c.
#define DIR_V3_SET | ( | d_len, | |
va, | |||
vb | |||
) |
Definition at line 4007 of file math_geom.c.
#define IS_POINT_IX (1 << 0) |
Definition at line 4004 of file math_geom.c.
#define IS_SEGMENT_IX (1 << 1) |
Definition at line 4005 of file math_geom.c.
Definition at line 4286 of file math_geom.c.
void aabb_get_near_far_from_plane | ( | const float | plane_no[3], |
const float | bbmin[3], | ||
const float | bbmax[3], | ||
float | bb_near[3], | ||
float | bb_afar[3] | ||
) |
Returns the coordinates of the nearest vertex and the farthest vertex from a plane (or normal).
Definition at line 615 of file math_geom.c.
Referenced by dist_squared_ray_to_aabb_v3(), dist_squared_to_projected_aabb(), DRW_culling_min_max_test(), isect_aabb_planes_v3(), and tree_intersect_plane_test().
void accumulate_vertex_normals_poly_v3 | ( | float ** | vertnos, |
const float | polyno[3], | ||
const float ** | vertcos, | ||
float | vdiffs[][3], | ||
int | nverts | ||
) |
Add weighted face normal component into normals of the face vertices. Caller must pass pre-allocated vdiffs of nverts length.
Definition at line 5061 of file math_geom.c.
References dot_v3v3(), madd_v3_v3fl(), normalize_v3(), saacos(), and sub_v3_v3v3().
void accumulate_vertex_normals_tri_v3 | ( | float | n1[3], |
float | n2[3], | ||
float | n3[3], | ||
const float | f_no[3], | ||
const float | co1[3], | ||
const float | co2[3], | ||
const float | co3[3] | ||
) |
Definition at line 4977 of file math_geom.c.
References dot_v3v3(), madd_v3_v3fl(), normalize_v3(), saacos(), sub_v3_v3v3(), and vn.
Referenced by BKE_mesh_calc_normals_looptri().
void accumulate_vertex_normals_v3 | ( | float | n1[3], |
float | n2[3], | ||
float | n3[3], | ||
float | n4[3], | ||
const float | f_no[3], | ||
const float | co1[3], | ||
const float | co2[3], | ||
const float | co3[3], | ||
const float | co4[3] | ||
) |
Definition at line 5014 of file math_geom.c.
References dot_v3v3(), madd_v3_v3fl(), normalize_v3(), NULL, saacos(), sub_v3_v3v3(), and vn.
Referenced by make_face().
Definition at line 179 of file math_geom.c.
References cross_poly_v2(), and verts.
Referenced by area_squared_poly_v2().
Definition at line 174 of file math_geom.c.
References cross_poly_v2(), fabsf, and verts.
Referenced by BKE_mesh_calc_poly_uv_area(), BKE_mesh_remap_calc_polys_from_mesh(), projected_boundary_area(), and test_polyfill_area().
Definition at line 125 of file math_geom.c.
References cross_poly_v3(), len_v3(), and verts.
Referenced by area_quad_v3(), BKE_mesh_calc_poly_area(), and get_dupliface_transform_from_coords().
Definition at line 77 of file math_geom.c.
References area_poly_v3(), UNPACK3, v1, v2, and verts.
Referenced by psys_thread_context_init_distribute().
Definition at line 184 of file math_geom.c.
References blender::compositor::area(), area_poly_signed_v2(), and verts.
Definition at line 132 of file math_geom.c.
References cross_poly_v3(), len_squared_v3(), mul_v3_fl(), and verts.
Referenced by area_squared_quad_v3().
float area_squared_quad_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Definition at line 83 of file math_geom.c.
References area_squared_poly_v3(), UNPACK3, v1, v2, and verts.
Definition at line 99 of file math_geom.c.
References cross_tri_v3(), len_squared_v3(), mul_v3_fl(), v1, and v2.
Referenced by BM_face_calc_point_in_face().
float area_tri_signed_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | normal[3] | ||
) |
Definition at line 107 of file math_geom.c.
References blender::compositor::area(), cross_tri_v3(), dot_v3v3(), len_v3(), normal, v1, and v2.
Referenced by mesh_calc_poly_area_centroid().
Definition at line 92 of file math_geom.c.
References cross_tri_v3(), len_v3(), v1, and v2.
Referenced by BKE_mesh_calc_poly_area(), DRW_text_edit_mesh_measure_stats(), init_laplacian_matrix(), laplacian_triangle_area(), M_Geometry_area_tri(), mesh_calc_center_centroid_ex(), p_face_area(), psys_thread_context_init_distribute(), quad_calc_error(), blender::nodes::node_geo_distribute_points_on_faces_cc::sample_mesh_surface(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), Freestyle::BlenderFileLoader::testDegenerateTriangle(), transform_point_by_tri_v3(), and VoronoiVertexWeight::VoronoiVertexWeight().
Normal to x,y matrix.
Creates a 3x3 matrix from a normal. This matrix can be applied to vectors so their 'z' axis runs along normal. In practice it means you can use x,y as 2d coords.
r_mat | The matrix to return. |
normal | A unit length vector. |
Definition at line 3527 of file math_geom.c.
References BLI_assert, BLI_ASSERT_UNIT_EPSILON, BLI_ASSERT_UNIT_V3, copy_v3_v3(), dot_m3_v3_row_z(), fabsf, is_negative_m3(), is_zero_v3(), normal, ortho_basis_v3v3_v3(), and transpose_m3().
Referenced by BKE_mesh_remap_calc_polys_from_mesh(), bm_edge_calc_rotate_beauty__area(), bm_face_bisect_verts(), BM_face_interp_from_face(), BM_face_point_inside_test(), BM_face_split_edgenet(), BM_face_split_edgenet_connect_islands(), BM_face_splits_check_legal(), bm_face_subset_calc_planar(), bm_interp_face_store(), bm_loop_collapse_is_degenerate(), BM_loop_interp_from_face(), BM_vert_interp_from_face(), bmesh_calc_tessellation_for_face_beauty(), createTransCurveVerts(), blender::io::obj::fixup_invalid_polygon(), mesh_init_origspace(), poly_rotate_plane(), projected_boundary_area(), smart_project_exec(), transform_convert_mesh_islands_calc(), and transform_point_by_tri_v3().
Same as axis_dominant_v3_to_m3, but flips the normal
Definition at line 3544 of file math_geom.c.
References BLI_assert, BLI_ASSERT_UNIT_EPSILON, BLI_ASSERT_UNIT_V3, dot_m3_v3_row_z(), is_negative_m3(), is_zero_v3(), negate_v3_v3(), normal, ortho_basis_v3v3_v3(), and transpose_m3().
Referenced by BLI_scanfill_calc_ex(), BM_face_calc_tessellation(), BM_face_triangulate(), bmesh_calc_tessellation_for_face_beauty(), bmesh_calc_tessellation_for_face_impl(), C_BVHTree_FromPolygons(), mesh_calc_tessellation_for_face_impl(), mesh_tessface_calc(), and p_add_ngon().
bool barycentric_coords_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | co[2], | ||
float | w[3] | ||
) |
Definition at line 3676 of file math_geom.c.
References is_finite_v3(), v1, v2, w(), x, x2, y, and y1.
Referenced by blender::compositor::KeyingScreenOperation::execute_pixel(), blender::geometry::ReverseUVSampler::sample(), and blender::compositor::KeyingScreenOperation::update_memory_buffer_partial().
int barycentric_inside_triangle_v2 | ( | const float | w[3] | ) |
Definition at line 3663 of file math_geom.c.
References IN_RANGE, IN_RANGE_INCL, and w().
Referenced by blender::compositor::KeyingScreenOperation::execute_pixel(), blender::bke::pbvh::pixels::extract_barycentric_pixels(), and blender::compositor::KeyingScreenOperation::update_memory_buffer_partial().
|
static |
Definition at line 3571 of file math_geom.c.
References axis_dominant_v3(), copy_v3_fl(), is_finite_v3(), mul_v3_fl(), tri_signed_area(), v1, v2, and w().
Referenced by blender::bke::pbvh::pixels::extract_barycentric_pixels(), interp_weights_quad_v3(), and interp_weights_tri_v3().
void barycentric_weights_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | co[2], | ||
float | w[3] | ||
) |
Definition at line 3700 of file math_geom.c.
References copy_v3_fl(), cross_tri_v2(), is_finite_v3(), mul_v3_fl(), v1, v2, and w().
Referenced by blender::bke::pbvh::pixels::calc_barycentric_delta(), dynamic_paint_create_uv_surface_direct_cb(), dynamic_paint_create_uv_surface_neighbor_cb(), blender::bke::pbvh::pixels::extract_barycentric_pixels(), project_bucket_clip_face(), project_paint_occlude_ptv_clip(), rect_to_uvspace_ortho(), screen_px_from_ortho(), screen_px_from_persp(), transform_point_by_tri_v3(), and VecZDepthOrtho().
void barycentric_weights_v2_clamped | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | co[2], | ||
float | w[3] | ||
) |
A version of barycentric_weights_v2 that doesn't allow negative weights. Useful when negative values cause problems and points are only ever slightly outside of the triangle.
Definition at line 3723 of file math_geom.c.
References copy_v3_fl(), cross_tri_v2(), is_finite_v3(), max_ff(), mul_v3_fl(), v1, v2, and w().
Referenced by tri_fill_smooth().
void barycentric_weights_v2_persp | ( | const float | v1[4], |
const float | v2[4], | ||
const float | v3[4], | ||
const float | co[2], | ||
float | w[3] | ||
) |
still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight
Definition at line 3746 of file math_geom.c.
References copy_v3_fl(), cross_tri_v2(), is_finite_v3(), mul_v3_fl(), v1, v2, and w().
Referenced by project_bucket_clip_face(), project_paint_occlude_ptv_clip(), rect_to_uvspace_persp(), and VecZDepthPersp().
void barycentric_weights_v2_quad | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2], | ||
const float | co[2], | ||
float | w[4] | ||
) |
same as barycentric_weights_v2 but works with a quad, NOTE: untested for values outside the quad's bounds this is interp_weights_poly_v2 expanded for quads only
Definition at line 3769 of file math_geom.c.
References blender::compositor::area(), copy_v4_fl(), is_finite_v4(), len_v2(), MEAN_VALUE_HALF_TAN_V2, mul_v4_fl(), t, UNLIKELY, v1, v2, and w().
Referenced by barycentric_weights_v2_grid_cache(), draw_circle_in_quad(), and maskrasterize_layer_z_depth_quad().
Definition at line 4835 of file math_geom.c.
References Freestyle::a, bounds(), copy_m4_m4(), and mul_m4_v4().
Definition at line 4894 of file math_geom.c.
References Freestyle::a, copy_v3_v3(), max, min, minmax_v3v3_v3(), and mul_m4_v3().
bool clip_segment_v3_plane | ( | const float | p1[3], |
const float | p2[3], | ||
const float | plane[4], | ||
float | r_p1[3], | ||
float | r_p2[3] | ||
) |
Definition at line 3417 of file math_geom.c.
References copy_v3_v3(), dot_v3v3(), madd_v3_v3v3fl(), plane_point_side_v3(), sub_v3_v3v3(), t, and UNPACK3.
bool clip_segment_v3_plane_n | ( | const float | p1[3], |
const float | p2[3], | ||
const float | plane_array[][4], | ||
const int | plane_num, | ||
float | r_p1[3], | ||
float | r_p2[3] | ||
) |
Definition at line 3464 of file math_geom.c.
References dot_v3v3(), madd_v3_v3v3fl(), plane_point_side_v3(), sub_v3_v3v3(), t, and UNPACK3.
Referenced by DRW_text_edit_mesh_measure_stats(), ED_view3d_clip_segment(), mesh_foreachScreenEdge_clip_bb_segment__mapFunc(), point_is_visible(), and view3d_project_segment_to_screen_with_content_clip_planes().
void closest_on_tri_to_point_v3 | ( | float | r[3], |
const float | p[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Set 'r' to the point in triangle (v1, v2, v3) closest to point 'p'.
Definition at line 980 of file math_geom.c.
References add_v3_v3(), copy_v3_v3(), dot_v3v3(), madd_v3_v3v3fl(), mul_v3_fl(), r, sub_v3_v3v3(), v, v1, v2, and w().
Referenced by BKE_mesh_remap_calc_loops_from_mesh(), bmbvh_find_face_closest_cb(), calc_area_normal_and_center_task_cb(), compute_collision_point_edge_tri(), compute_collision_point_tri_tri(), edge_queue_tri_in_circle(), edge_queue_tri_in_sphere(), editmesh_looptri_nearest_point(), blender::ed::curves::convert_to_particle_system::find_mface_for_root_position(), M_Geometry_closest_point_on_tri(), mesh_faces_nearest_point(), mesh_looptri_nearest_point(), mesh_looptri_target_project(), mesh_tris_nearest_point_dp(), and py_bvhtree_nearest_point_range_cb().
float closest_seg_seg_v2 | ( | float | r_closest_a[2], |
float | r_closest_b[2], | ||
float * | r_lambda_a, | ||
float * | r_lambda_b, | ||
const float | a1[2], | ||
const float | a2[2], | ||
const float | b1[2], | ||
const float | b2[2] | ||
) |
Finds the points where two line segments are closest to each other.
lambda_*
is a value between 0 and 1 for each segment that indicates where r_closest_*
is on the corresponding segment.
Definition at line 297 of file math_geom.c.
References BLI_assert, closest_to_line_segment_v2(), closest_to_line_v2(), copy_v2_v2(), isect_line_line_v2_point(), isect_seg_seg_v2_simple(), len_squared_v2v2(), and min_ffff().
float closest_to_line_segment_v2 | ( | float | r_close[2], |
const float | p[2], | ||
const float | l1[2], | ||
const float | l2[2] | ||
) |
Point closest to v1 on line v2-v3 in 2D.
Definition at line 357 of file math_geom.c.
References closest_to_line_v2(), and copy_v2_v2().
Referenced by closest_seg_seg_v2(), dist_squared_to_line_segment_v2(), edbm_rip_edge_invoke(), knife_find_line_hits(), uv_find_nearest_edge(), and uvedit_uv_straighten_elements().
float closest_to_line_segment_v3 | ( | float | r_close[3], |
const float | p[3], | ||
const float | l1[3], | ||
const float | l2[3] | ||
) |
Point closest to v1 on line v2-v3 in 3D.
Definition at line 379 of file math_geom.c.
References closest_to_line_v3(), and copy_v3_v3().
Referenced by bev_create_ngon(), BKE_gpencil_stroke_simplify_adaptive(), BM_face_calc_tangent_edge_diagonal(), dist_squared_to_line_segment_v3(), blender::ed::sculpt_paint::find_curves_brush_position(), heat_ray_source_visible(), heat_source_distance(), mesh_edges_nearest_point(), mesh_verts_spherecast_do(), projected_boundary_area(), snap_to_pipe_profile(), and square_out_adj_vmesh().
float closest_to_line_v2 | ( | float | r_close[2], |
const float | p[2], | ||
const float | l1[2], | ||
const float | l2[2] | ||
) |
Definition at line 3183 of file math_geom.c.
References dot_v2v2(), and sub_v2_v2v2().
Referenced by closest_seg_seg_v2(), closest_to_line_segment_v2(), dist_squared_to_line_v2(), dynamic_paint_find_island_border(), gizmo_arrow_test_select(), gpencil_snap_to_guide(), interp_weights_uv_v2_calc(), knife_constrain_axis(), and slide_plane_marker_modal().
double closest_to_line_v2_db | ( | double | r_close[2], |
const double | p[2], | ||
const double | l1[2], | ||
const double | l2[2] | ||
) |
Definition at line 3200 of file math_geom.c.
References dot_v2v2_db(), and sub_v2_v2v2_db().
float closest_to_line_v3 | ( | float | r_close[3], |
const float | p[3], | ||
const float | l1[3], | ||
const float | l2[3] | ||
) |
Find closest point to p on line through (l1
, l2
) and return lambda, where (0 <= lambda <= 1) when p
is in the line segment (l1
, l2
).
Definition at line 3176 of file math_geom.c.
References closest_to_ray_v3(), and sub_v3_v3v3().
Referenced by bezier_handle_calc_length_v3(), BKE_gpencil_stroke_trim(), closest_to_line_segment_v3(), compute_collision_point_edge_tri(), compute_collision_point_tri_tri(), dist_squared_to_line_v3(), M_Geometry_intersect_line_line(), M_Geometry_intersect_point_line(), modifyMesh(), point_in_slice(), and viewops_data_create().
Definition at line 422 of file math_geom.c.
References BLI_ASSERT_UNIT_V3, dot_v3v3(), and madd_v3_v3v3fl().
Definition at line 415 of file math_geom.c.
References dot_v3v3(), len_squared_v3(), and madd_v3_v3v3fl().
Definition at line 408 of file math_geom.c.
References BLI_ASSERT_UNIT_V3, madd_v3_v3v3fl(), and plane_point_side_v3().
Referenced by bmo_planar_faces_exec(), do_clay_brush_task_cb_ex(), do_clay_strips_brush_task_cb_ex(), do_clay_thumb_brush_task_cb_ex(), do_fill_brush_task_cb_ex(), do_flatten_brush_task_cb_ex(), do_multiplane_scrape_brush_task_cb_ex(), do_scrape_brush_task_cb_ex(), getVerticalAndHorizontalChange(), gizmo_bisect_prop_depth_set(), gizmo_spin_prop_depth_set(), offset_meet(), SCULPT_brush_test_circle_sq(), and view3d_interactive_add_modal().
Find the closest point on a plane.
r_close | Return coordinate |
plane | The plane to test against. |
pt | The point to find the nearest of |
Definition at line 401 of file math_geom.c.
References len_squared_v3(), madd_v3_v3v3fl(), and plane_point_side_v3().
Referenced by BM_mesh_bisect_plane(), cloth_brush_solve_collision(), ED_view3d_win_to_3d_on_plane_with_fallback(), gpencil_sculpt_compute_lock_axis(), isect_point_tri_v3(), project_line_gesture_apply_task_cb(), SCULPT_relax_vertex(), and snap_to_pipe_profile().
float closest_to_ray_v3 | ( | float | r_close[3], |
const float | p[3], | ||
const float | ray_orig[3], | ||
const float | ray_dir[3] | ||
) |
Definition at line 3157 of file math_geom.c.
References copy_v3_v3(), dot_v3v3(), is_zero_v3(), madd_v3_v3v3fl(), sub_v3_v3v3(), and UNLIKELY.
Referenced by closest_to_line_v3(), and UNUSED_FUNCTION().
Definition at line 190 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, cross_v3_v3v3(), dot_v3v3(), len_v3(), sub_v3_v3v3(), v1, and v2.
Referenced by init_laplacian_matrix(), initLaplacianMatrix(), laplacian_triangle_area(), and laplacian_triangle_weights().
Scalar cross product of a 2d polygon.
area * 2
Definition at line 141 of file math_geom.c.
References Freestyle::a, blender::math::cross(), and verts.
Referenced by area_poly_signed_v2(), area_poly_v2(), BKE_mesh_uv_vert_map_create(), BM_face_uv_calc_cross(), BM_uv_element_map_create(), BM_uv_vert_map_create(), and polyfill_prepare().
Definition at line 160 of file math_geom.c.
References add_newell_cross_v3_v3v3(), verts, and zero_v3().
Referenced by area_poly_v3(), area_squared_poly_v3(), and normal_poly_v3().
Definition at line 18 of file math_geom.c.
Referenced by area_squared_tri_v3(), area_tri_signed_v3(), area_tri_v3(), bm_edge_calc_rotate_beauty__area(), bm_face_split_by_concave(), isect_point_tri_v3(), and raycast_tri_backface_culling_test().
Return the value which the distance between points will need to be scaled by, to define a handle, given both points are on a perfect circle.
Use when we want a bezier curve to match a circle as closely as possible.
Definition at line 5895 of file math_geom.c.
References acosf, angle(), BLI_ASSERT_UNIT_V3, cosf, dot_v3v3(), eps, and sinf.
Referenced by BKE_pchan_bbone_handles_compute().
float dist_seg_seg_v2 | ( | const float | a1[3], |
const float | a2[3], | ||
const float | b1[3], | ||
const float | b2[3] | ||
) |
Returns the distance between two 2D line segments.
Definition at line 968 of file math_geom.c.
References dist_squared_to_line_segment_v2(), isect_seg_seg_v2_simple(), min_ffff(), and sqrtf.
float dist_signed_squared_to_corner_v3v3v3 | ( | const float | p[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
const float | axis_ref[3] | ||
) |
Check if p is inside the 2x planes defined by (v1, v2, v3)
where the 3x points define 2x planes.
axis_ref | used when v1,v2,v3 form a line and to check if the corner is concave/convex. |
(return < 0.0)
is outside.Definition at line 512 of file math_geom.c.
References copy_v3_v3(), cross_v3_v3v3(), dist_signed_squared_to_plane3_v3(), dist_signed_squared_to_plane_v3(), dot_v3v3(), len_squared_v3(), max_ff(), min_ff(), negate_v3(), plane_from_point_normal_v3(), sub_v3_v3v3(), v1, and v2.
Referenced by BM_loop_point_side_of_loop_test(), and tc_mesh_customdatacorrect_apply_vert().
Definition at line 445 of file math_geom.c.
References copysignf, dot_v3v3(), and len_squared_v3().
Referenced by dist_signed_squared_to_corner_v3v3v3().
Definition at line 429 of file math_geom.c.
References copysignf, len_squared_v3(), and plane_point_side_v3().
Referenced by BM_loop_point_side_of_edge_test(), dist_signed_squared_to_corner_v3v3v3(), and modifyMesh().
Definition at line 473 of file math_geom.c.
References dot_v3v3(), len_squared_v3(), and sqrtf.
Referenced by dist_to_plane3_v3().
Return the signed distance from the point to the plane.
Definition at line 461 of file math_geom.c.
References len_squared_v3(), plane_point_side_v3(), and sqrtf.
Referenced by calc_clay_surface_task_cb(), dist_to_plane_v3(), do_cloth_brush_apply_forces_task_cb_ex(), draw_primitive_view_impl(), M_Geometry_distance_point_to_plane(), modifyMesh(), sculpt_boundary_displacement_from_grab_delta_get(), sculpt_gesture_trim_calculate_depth(), and sculpt_pose_get_scale_from_grab_delta().
float dist_squared_ray_to_aabb_v3 | ( | const struct DistRayAABB_Precalc * | data, |
const float | bb_min[3], | ||
const float | bb_max[3], | ||
float | r_point[3], | ||
float * | r_depth | ||
) |
Returns the distance from a ray to a bound-box (projected on ray)
Definition at line 665 of file math_geom.c.
References aabb_get_near_far_from_plane(), copy_v3_v3(), data, dist_squared_ray_to_seg_v3(), dot_v3v3(), and sub_v3_v3v3().
Referenced by dist_squared_ray_to_aabb_v3_simple(), nearest_to_ray_aabb_dist_sq(), and SCULPT_search_circle_cb().
void dist_squared_ray_to_aabb_v3_precalc | ( | struct DistRayAABB_Precalc * | neasrest_precalc, |
const float | ray_origin[3], | ||
const float | ray_direction[3] | ||
) |
Definition at line 651 of file math_geom.c.
References copy_v3_v3(), DistRayAABB_Precalc::ray_direction, DistRayAABB_Precalc::ray_inv_dir, and DistRayAABB_Precalc::ray_origin.
Referenced by BKE_pbvh_find_nearest_to_ray(), dist_squared_ray_to_aabb_v3_simple(), sculpt_pbvh_gather_generic(), and vwpaint_pbvh_gather_generic().
float dist_squared_ray_to_aabb_v3_simple | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | bb_min[3], | ||
const float | bb_max[3], | ||
float | r_point[3], | ||
float * | r_depth | ||
) |
Use when there is no advantage to pre-calculation.
Definition at line 754 of file math_geom.c.
References data, dist_squared_ray_to_aabb_v3(), dist_squared_ray_to_aabb_v3_precalc(), DistRayAABB_Precalc::ray_direction, and DistRayAABB_Precalc::ray_origin.
float dist_squared_ray_to_seg_v3 | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
float | r_point[3], | ||
float * | r_depth | ||
) |
Find the closest point in a seg to a ray and return the distance squared.
r_point | Is the point on segment closest to ray (or to ray_origin if the ray and the segment are parallel). |
r_depth | the distance of r_point projection on ray to the ray_origin. |
Definition at line 579 of file math_geom.c.
References copy_v3_v3(), dot_v3v3(), interp_v3_v3v3(), isect_ray_line_v3(), len_squared_v3(), square_f(), sub_v3_v3v3(), and v1.
Referenced by dist_squared_ray_to_aabb_v3(), dist_squared_ray_to_tri_v3_fast(), and EDBM_unified_findnearest_from_raycast().
Distance p to line-piece v1-v2.
Definition at line 283 of file math_geom.c.
References closest(), closest_to_line_segment_v2(), and len_squared_v2v2().
Referenced by BKE_curveprofile_insert(), calcEdgeSlide_mval_range(), dist_seg_seg_v2(), dist_squared_to_looptri_uv_edges(), dist_to_crns(), dist_to_crns_abs(), dist_to_line_segment_v2(), dist_to_rect(), dynamic_paint_find_island_border(), ED_curve_editfont_select_pick(), ED_mask_find_nearest_diff_point(), ED_node_link_intersect_test(), edbm_rip_edge_side_measure(), edbm_rip_edgedist_squared(), edge_inside_circle(), find_nearest_tracking_segment_cb(), interp_weights_poly_v2(), knife_find_closest_edge_of_face(), knife_find_closest_vert_of_edge(), knife_find_line_hits(), knife_ray_intersect_face(), layer_bucket_isect_test(), blender::ed::space_node::pick_input_link_by_link_intersect(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), uv_circle_select_is_edge_inside(), uv_find_nearest_loop_from_edge(), and view3d_ruler_pick().
Distance v1 to line-piece l1-l2 in 3D.
Definition at line 485 of file math_geom.c.
References closest(), closest_to_line_segment_v3(), and len_squared_v3v3().
Referenced by dist_to_line_segment_v3(), find_closer_edge(), gpencil_add_verts_to_dgroups(), interp_weights_poly_v3(), nearestVert(), and Freestyle::BlenderFileLoader::testDegenerateTriangle().
Distance p to line v1-v2 using Hesse formula (NO LINE PIECE!)
Definition at line 270 of file math_geom.c.
References closest(), closest_to_line_v2(), and len_squared_v2v2().
Referenced by dist_to_line_v2(), freetypechar_to_vchar(), project_bucket_clip_face(), and testvertexnearedge().
Definition at line 499 of file math_geom.c.
References closest(), closest_to_line_v3(), and len_squared_v3v3().
Referenced by BKE_nurb_handles_autocalc(), and dist_to_line_v3().
Definition at line 452 of file math_geom.c.
References dot_v3v3(), and len_squared_v3().
Definition at line 436 of file math_geom.c.
References len_squared_v3(), and plane_point_side_v3().
Referenced by build_boundary_terminal_edge(), and knife_ray_intersect_face().
float dist_squared_to_projected_aabb | ( | struct DistProjectedAABBPrecalc * | data, |
const float | bbmin[3], | ||
const float | bbmax[3], | ||
bool | r_axis_closest[3] | ||
) |
Returns the distance from a 2D coordinate to a bound-box (projected).
Definition at line 823 of file math_geom.c.
References aabb_get_near_far_from_plane(), data, dot_m4_v3_row_x(), dot_m4_v3_row_y(), dot_v2v2(), fabsf, len_squared_v2(), len_squared_v2v2(), madd_v2_v2fl(), mul_project_m4_v3_zfac(), and sub_v2_v2v2().
Referenced by BLI_bvhtree_find_nearest_projected(), bvhtree_nearest_projected_dfs_recursive(), bvhtree_nearest_projected_with_clipplane_test_dfs_recursive(), dist_squared_to_projected_aabb_simple(), and snap_bound_box_check_dist().
void dist_squared_to_projected_aabb_precalc | ( | struct DistProjectedAABBPrecalc * | precalc, |
const float | projmat[4][4], | ||
const float | winsize[2], | ||
const float | mval[2] | ||
) |
projmat | Projection Matrix (usually perspective matrix multiplied by object matrix). |
Definition at line 772 of file math_geom.c.
References copy_m4_m4(), cross_v3_v3v3(), isect_plane_plane_plane_v3(), isect_plane_plane_v3(), mul_v2_v2fl(), DistProjectedAABBPrecalc::mval, DistProjectedAABBPrecalc::pmat, DistProjectedAABBPrecalc::ray_direction, DistProjectedAABBPrecalc::ray_inv_dir, DistProjectedAABBPrecalc::ray_origin, sub_v2_v2v2(), transpose_m4_m4(), and zero_v3().
Referenced by BLI_bvhtree_find_nearest_projected(), dist_squared_to_projected_aabb_simple(), snap_bound_box_check_dist(), snap_mesh_edge_verts_mixed(), snap_mesh_polygon(), snap_object_center(), snapArmature(), snapCamera(), and snapCurve().
float dist_squared_to_projected_aabb_simple | ( | const float | projmat[4][4], |
const float | winsize[2], | ||
const float | mval[2], | ||
const float | bbmin[3], | ||
const float | bbmax[3] | ||
) |
Definition at line 953 of file math_geom.c.
References data, dist_squared_to_projected_aabb(), dist_squared_to_projected_aabb_precalc(), and DistProjectedAABBPrecalc::mval.
float dist_squared_to_ray_v3_normalized | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | co[3] | ||
) |
Compute the squared distance of a point to a line (defined as ray).
ray_origin | A point on the line. |
ray_direction | Normalized direction of the line. |
co | Point to which the distance is to be calculated. |
Definition at line 563 of file math_geom.c.
References add_v3_v3v3(), len_squared_v3v3(), project_v3_v3v3_normalized(), and sub_v3_v3v3().
Referenced by EDBM_unified_findnearest_from_raycast().
Definition at line 292 of file math_geom.c.
References dist_squared_to_line_segment_v2(), and sqrtf.
Referenced by MOD_lineart_smooth_chains(), and TEST().
Definition at line 494 of file math_geom.c.
References dist_squared_to_line_segment_v3(), and sqrtf.
Definition at line 278 of file math_geom.c.
References dist_squared_to_line_v2(), and sqrtf.
Referenced by calculate_autoscale_factor(), computeBindWeights(), MOD_lineart_smooth_chains(), and TEST().
Definition at line 507 of file math_geom.c.
References dist_squared_to_line_v3(), and sqrtf.
Referenced by blender::ed::sculpt_paint::sample_curves_3d_brush(), and blender::ed::sculpt_paint::sample_curves_surface_3d_brush().
Definition at line 480 of file math_geom.c.
References dist_signed_to_plane3_v3(), and fabsf.
Definition at line 468 of file math_geom.c.
References dist_signed_to_plane_v3(), and fabsf.
Referenced by do_cloth_brush_apply_forces_task_cb_ex().
Definition at line 5656 of file math_geom.c.
References dot_v3v3(), and sqrtf.
Referenced by form_factor_quad().
float form_factor_hemi_poly | ( | float | p[3], |
float | n[3], | ||
float | v1[3], | ||
float | v2[3], | ||
float | v3[3], | ||
float | v4[3] | ||
) |
Definition at line 5716 of file math_geom.c.
References form_factor_quad(), form_factor_visible_quad(), q1, v1, and v2.
float form_factor_quad | ( | const float | p[3], |
const float | n[3], | ||
const float | q0[3], | ||
const float | q1[3], | ||
const float | q2[3], | ||
const float | q3[3] | ||
) |
Definition at line 5671 of file math_geom.c.
References cross_v3_v3v3(), dot3(), dot_v3v3(), ff_normalize(), M_PI, MAX2, q1, result, saacosf(), and sub_v3_v3v3().
Referenced by form_factor_hemi_poly().
bool form_factor_visible_quad | ( | const float | p[3], |
const float | n[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float | q0[3], | ||
float | q1[3], | ||
float | q2[3], | ||
float | q3[3] | ||
) |
Definition at line 5299 of file math_geom.c.
References Freestyle::c, copy_v3_v3(), dot_v3v3(), blender::robust_pred::epsilon, fabsf, q1, v1, v2, and vec_add_dir().
Referenced by form_factor_hemi_poly().
float geodesic_distance_propagate_across_triangle | ( | const float | v0[3], |
const float | v1[3], | ||
const float | v2[3], | ||
float | dist1, | ||
float | dist2 | ||
) |
Utility for computing approximate geodesic distances on triangle meshes.
Given triangle with vertex coordinates v0, v1, v2, and known geodesic distances dist1 and dist2 at v1 and v2, estimate a geodesic distance at vertex v0.
From "Dart Throwing on Surfaces", EGSR 2009. Section 7, Geodesic Dart Throwing.
Definition at line 5922 of file math_geom.c.
References Freestyle::a, cross_v3_v3v3(), dot_v3v3(), fabsf, len_v2v2(), len_v3(), len_v3v3(), min_ff(), normalize_v3(), normalize_v3_v3(), sqrtf, sub_v3_v3v3(), v, v1, and v2.
Referenced by bmesh_test_dist_add(), and sculpt_geodesic_mesh_test_dist_add().
|
static |
Definition at line 2568 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, determinant(), sqrtf, and SWAP.
Referenced by isect_sweeping_sphere_tri_v3().
Definition at line 4758 of file math_geom.c.
References col, and copy_m4_m4().
Referenced by lookat_m4().
Definition at line 4501 of file math_geom.c.
References add_v3_v3(), copy_v3_v3(), data, mul_v3_fl(), and v.
Referenced by calc_point_from_barycentric_cage(), calc_point_from_barycentric_extrusion(), interp_barycentric_mlooptri(), and RE_bake_normal_world_to_tangent().
Use to find the point of a UV on a face. Reverse of resolve_*
functions.
Definition at line 4484 of file math_geom.c.
References add_v3_v3(), copy_v3_v3(), data, mul_v3_fl(), and v.
Referenced by interp_bilinear_grid(), interp_bilinear_mpoly(), and interp_vmesh().
void interp_cubic_v3 | ( | float | x[3], |
float | v[3], | ||
const float | x1[3], | ||
const float | v1[3], | ||
const float | x2[3], | ||
const float | v2[3], | ||
float | t | ||
) |
(x1, v1)(t1=0)------(x2, v2)(t2=1), 0<t<1 --> (x, v)(t)
.
Definition at line 4253 of file math_geom.c.
References Freestyle::a, usdtokens::b(), t, v, v1, v2, x, and x2.
Referenced by psys_interpolate_particle().
Given an array with some invalid values this function interpolates valid values replacing the invalid ones.
Definition at line 3917 of file math_geom.c.
References float(), MEM_callocN, and MEM_freeN.
Referenced by annotation_stroke_newfrombuffer(), gpencil_get_depth_array(), gpencil_primitive_update_strokes(), and gpencil_stroke_newfrombuffer().
Definition at line 4160 of file math_geom.c.
References CLAMP, DIR_V2_SET, dist_squared_to_line_segment_v2(), eps, fabsf, IS_POINT_IX, IS_SEGMENT_IX, Double2_Len::len, line_point_factor_v2(), max_ff(), mean_value_half_tan_v2_db(), UNLIKELY, v, and w().
Definition at line 4075 of file math_geom.c.
References CLAMP, DIR_V3_SET, dist_squared_to_line_segment_v3(), eps, fabsf, IS_POINT_IX, IS_SEGMENT_IX, Float3_Len::len, line_point_factor_v3(), max_ff(), mean_value_half_tan_v3(), UNLIKELY, v, and w().
void interp_weights_quad_v3 | ( | float | w[4], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
const float | co[3] | ||
) |
Definition at line 3612 of file math_geom.c.
References barycentric_weights(), cross_v3_v3v3(), equals_v3v3(), sub_v3_v3v3(), SWAP, v1, v2, w(), and zero_v4().
void interp_weights_tri_v3 | ( | float | w[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
const float | co[3] | ||
) |
Definition at line 3603 of file math_geom.c.
References barycentric_weights(), normal_tri_v3(), v1, v2, and w().
Referenced by bindVert(), BKE_shrinkwrap_compute_smooth_normal(), blender::bke::mesh_surface_sample::compute_bary_coord_in_triangle(), blender::ed::curves::convert_to_particle_system::compute_mface_weights_for_position(), dynamic_paint_paint_mesh_cell_point_cb_ex(), blender::bke::mesh_surface_sample::MeshAttributeInterpolator::ensure_barycentric_coords(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), and target_project_solve_point_tri().
bool is_edge_convex_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Check if the edge is convex or concave (depends on face winding) Copied from BM_edge_is_convex().
Definition at line 5734 of file math_geom.c.
References blender::math::cross(), cross_v3_v3v3(), dot_v3v3(), equals_v3v3(), sub_v3_v3v3(), v1, and v2.
Referenced by blender::draw::statvis_calc_sharp().
Definition at line 5806 of file math_geom.c.
References Freestyle::a, copy_v2_v2(), blender::math::cross(), cross_v2v2(), sub_v2_v2v2(), and verts.
Referenced by BM_face_splits_check_legal(), and isPolyValid().
bool is_quad_convex_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2] | ||
) |
Definition at line 5800 of file math_geom.c.
References isect_seg_seg_v2(), v1, and v2.
bool is_quad_convex_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Evaluate if entire quad is a proper convex quad
Method projects points onto a plane and checks its convex using following method:
Definition at line 5750 of file math_geom.c.
References CROSS_SIGN, cross_v3_v3v3(), len_squared_v3(), project_plane_v3_v3v3(), sub_v3_v3v3(), v1, and v2.
Referenced by bm_decim_triangulate_end(), and hull_merge_triangles().
Check if either of the diagonals along this quad create flipped triangles (normals pointing away from each other).
Definition at line 5845 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), ret, sub_v3_v3v3(), v1, and v2.
Referenced by bm_edge_is_delimit(), BM_face_triangulate(), and bm_vert_connect_select_history_edge_to_vert_path().
bool is_quad_flip_v3_first_third_fast | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Definition at line 5867 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), sub_v3_v3v3(), v1, and v2.
Referenced by mesh_calc_tessellation_for_face_impl().
bool is_quad_flip_v3_first_third_fast_with_normal | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
const float | normal[3] | ||
) |
Definition at line 5882 of file math_geom.c.
References cross_v3_v3v3(), blender::math::dot(), dot_v3v3(), normal, sub_v3_v3v3(), v1, and v2.
Referenced by bmesh_calc_tessellation_for_face_impl(), and mesh_calc_tessellation_for_face_impl().
bool isect_aabb_aabb_v3 | ( | const float | min1[3], |
const float | max1[3], | ||
const float | min2[3], | ||
const float | max2[3] | ||
) |
Axis-aligned bounding box.
Definition at line 3048 of file math_geom.c.
Referenced by blender::ed::sculpt_paint::paint::image::init_triangle_brush_test(), and particle_intersect_mesh().
int isect_aabb_planes_v3 | ( | const float(*) | planes[4], |
int | totplane, | ||
const float | bbmin[3], | ||
const float | bbmax[3] | ||
) |
Checks status of an AABB in relation to a list of planes.
Definition at line 2604 of file math_geom.c.
References aabb_get_near_far_from_plane(), ISECT_AABB_PLANE_BEHIND_ANY, ISECT_AABB_PLANE_CROSS_ANY, ISECT_AABB_PLANE_IN_FRONT_ALL, plane_point_side_v3(), and ret.
Referenced by BLI_bvhtree_find_nearest_projected(), and bvhtree_nearest_projected_with_clipplane_test_dfs_recursive().
bool isect_axial_line_segment_tri_v3 | ( | const int | axis, |
const float | p1[3], | ||
const float | p2[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda | ||
) |
Definition at line 2819 of file math_geom.c.
References blender::robust_pred::epsilon, sub_v3_v3v3(), v, v1, and v2.
int isect_line_line_epsilon_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
float | i1[3], | ||
float | i2[3], | ||
float | epsilon | ||
) |
Definition at line 2871 of file math_geom.c.
References Freestyle::a, add_v3_v3v3(), usdtokens::b(), Freestyle::c, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, fabsf, mul_v3_fl(), project_v3_v3v3(), sub_v3_v3v3(), t, UNLIKELY, v1, and v2.
Referenced by isect_line_line_v3().
bool isect_line_line_strict_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
float | vi[3], | ||
float * | r_lambda | ||
) |
Intersection point strictly between the two lines
Definition at line 2946 of file math_geom.c.
References Freestyle::a, add_v3_v3v3(), usdtokens::b(), Freestyle::c, cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, fabsf, mul_v3_fl(), sub_v3_v3v3(), UNLIKELY, v1, and v2.
int isect_line_line_v2_point | ( | const float | v0[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
float | r_vi[2] | ||
) |
Intersect Line-Line, floats - gives intersection point.
Definition at line 1085 of file math_geom.c.
References cross_v2v2(), ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, sub_v2_v2v2(), v, v1, and v2.
Referenced by closest_seg_seg_v2(), facetag_cut_cost_edge_uv(), and knife_snap_edge_constrained().
int isect_line_line_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
float | r_i1[3], | ||
float | r_i2[3] | ||
) |
Definition at line 2935 of file math_geom.c.
References blender::robust_pred::epsilon, isect_line_line_epsilon_v3(), v1, and v2.
Referenced by BKE_gpencil_stroke_trim(), BKE_mesh_remap_calc_edges_from_mesh(), camera_frame_fit_calc_from_data(), facetag_cut_cost_edge(), knife_find_line_hits(), M_Geometry_intersect_line_line(), mesh_edges_spherecast(), object_transform_axis_target_calc_depth_init(), offset_meet(), project_to_edge(), set_profile_params(), and square_out_adj_vmesh().
bool isect_line_plane_v3 | ( | float | r_isect_co[3], |
const float | l1[3], | ||
const float | l2[3], | ||
const float | plane_co[3], | ||
const float | plane_no[3] | ||
) |
Intersect line/plane.
r_isect_co | The intersection point. |
l1 | The first point of the line. |
l2 | The second point of the line. |
plane_co | A point on the plane to intersect with. |
plane_no | The direction of the plane (does not need to be normalized). |
Definition at line 2078 of file math_geom.c.
References blender::math::dot(), dot_v3v3(), fabsf, madd_v3_v3v3fl(), and sub_v3_v3v3().
Referenced by adjust_miter_coords(), bindVert(), bm_loop_calc_opposite_co(), calculate_profile_segments(), compute_collision_point_edge_tri(), compute_collision_point_tri_tri(), ED_gpencil_project_point_to_plane(), ED_gpencil_project_stroke_to_plane(), knife_start_cut(), knife_update_active(), and M_Geometry_intersect_line_plane().
bool isect_line_segment_tri_epsilon_v3 | ( | const float | p1[3], |
const float | p2[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2], | ||
float | epsilon | ||
) |
Like isect_line_segment_tri_v3, but allows epsilon tolerance around triangle.
Definition at line 1611 of file math_geom.c.
References Freestyle::a, cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, sub_v3_v3v3(), v, v1, and v2.
bool isect_line_segment_tri_v3 | ( | const float | p1[3], |
const float | p2[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2] | ||
) |
Test if the line starting at p1 ending at p2 intersects the triangle v0..v2 return non zero if it does.
Definition at line 1561 of file math_geom.c.
References Freestyle::a, cross_v3_v3v3(), dot_v3v3(), sub_v3_v3v3(), v, v1, and v2.
Referenced by compute_collision_point_edge_tri(), particle_intersect_mesh(), sb_detect_edge_collisionCached(), and sb_detect_face_collisionCached().
int isect_line_sphere_v2 | ( | const float | l1[2], |
const float | l2[2], | ||
const float | sp[2], | ||
const float | r, | ||
float | r_p1[2], | ||
float | r_p2[2] | ||
) |
Definition at line 1411 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, dot_v2v2(), madd_v2_v2v2fl(), r, and sqrtf.
Referenced by M_Geometry_intersect_line_sphere_2d().
int isect_line_sphere_v3 | ( | const float | l1[3], |
const float | l2[3], | ||
const float | sp[3], | ||
float | r, | ||
float | r_p1[3], | ||
float | r_p2[3] | ||
) |
l1,l2 | Coordinates (point of line). |
sp,r | Coordinate and radius (sphere). |
l2 - l1
, this direction compared with the normal of each point on the sphere: r_p1 always has a >= 0.0 dot product. r_p2 always has a <= 0.0 dot product. For example, when l1 is inside the sphere and l2 is outside, r_p1 will always be between l1 and l2. Definition at line 1349 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, dot_v3v3(), len_squared_v3(), madd_v3_v3v3fl(), r, and sqrtf.
Referenced by M_Geometry_intersect_line_sphere().
bool isect_plane_plane_plane_v3 | ( | const float | plane_a[4], |
const float | plane_b[4], | ||
const float | plane_c[4], | ||
float | r_isect_co[3] | ||
) |
Intersect three planes, return the point where all 3 meet. See Graphics Gems 1 pg 305
plane_a,plane_b,plane_c | Planes. |
r_isect_co | The resulting intersection point. |
Definition at line 2101 of file math_geom.c.
References cross_v3_v3v3(), determinant_m3(), madd_v3_v3fl(), mul_v3_fl(), mul_v3_v3fl(), and UNPACK3.
Referenced by blender::nodes::node_geo_curve_primitive_arc_cc::create_arc_curve_from_points(), blender::nodes::node_geo_curve_primitive_circle_cc::create_point_circle_curve(), dist_squared_to_projected_aabb_precalc(), and interp_slerp_co_no_v3().
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] | ||
) |
Intersect two planes, return a point on the intersection and a vector that runs on the direction of the intersection.
plane_a,plane_b | Planes. |
r_isect_co | The resulting intersection point. |
r_isect_no | The resulting vector of the intersection. |
Definition at line 2134 of file math_geom.c.
References copy_v3_v3(), cross_v3_v3v3(), len_squared_v3(), madd_v3_v3fl(), mul_v3_fl(), and mul_v3_v3fl().
Referenced by camera_frame_fit_calc_from_data(), dist_squared_to_projected_aabb_precalc(), ED_view3d_win_to_3d_on_plane_with_fallback(), M_Geometry_intersect_plane_plane(), and UNUSED_FUNCTION().
bool isect_planes_v3_fn | ( | const float | planes[][4], |
int | planes_len, | ||
float | eps_coplanar, | ||
float | eps_isect, | ||
void(*)(const float co[3], int i, int j, int k, void *user_data) | callback_fn, | ||
void * | user_data | ||
) |
Intersect all planes, calling callback_fn
for each point that intersects 3 of the planes that isn't outside any of the other planes.
This can be thought of as calculating a convex-hull from an array of planes.
eps_coplanar | Epsilon for testing if two planes are aligned (co-planar). |
eps_isect | Epsilon for testing of a point is behind any of the planes. |
O(N^3)
, this is only suitable for small arrays.Definition at line 2168 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), ELEM, fabsf, len_squared_v3(), and user_data.
Referenced by ED_view3d_clipping_clamp_minmax(), and M_Geometry_points_in_planes().
Check if a point is behind all planes.
Definition at line 2054 of file math_geom.c.
References plane_point_side_v3().
Referenced by is_effected(), and sculpt_gesture_is_vertex_effected().
Check if a point is in front all planes. Same as isect_point_planes_v3 but with planes facing the opposite direction.
Definition at line 2067 of file math_geom.c.
References plane_point_side_v3().
Referenced by test_projected_vert_dist().
bool isect_point_poly_v2 | ( | const float | pt[2], |
const float | verts[][2], | ||
const unsigned int | nr, | ||
const bool | UNUSEDuse_holes | ||
) |
Definition at line 1459 of file math_geom.c.
References verts.
bool isect_point_poly_v2_int | ( | const int | pt[2], |
const int | verts[][2], | ||
const unsigned int | nr, | ||
const bool | UNUSEDuse_holes | ||
) |
Definition at line 1478 of file math_geom.c.
References verts.
int isect_point_quad_v2 | ( | const float | p[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2] | ||
) |
Point in quad - only convex quads.
Definition at line 1536 of file math_geom.c.
References line_point_side_v2(), v1, and v2.
Referenced by draw_marker_areas(), draw_marker_outline(), M_Geometry_intersect_point_quad_2d(), project_paint_face_init(), psys_particle_dm_face_lookup(), quad_co(), seq_box_select_rect_image_isect(), seq_image_transform_transparency_gained(), seq_point_image_isect(), and slide_check_corners().
bool isect_point_tri_prism_v3 | ( | const float | p[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 3380 of file math_geom.c.
References point_in_slice(), v1, and v2.
Referenced by isect_point_tri_v3(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), sb_detect_face_pointCached(), and sb_detect_vertex_collisionCached().
int isect_point_tri_v2 | ( | const float | pt[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2] | ||
) |
Definition at line 1516 of file math_geom.c.
References line_point_side_v2(), v1, and v2.
Referenced by dynamic_paint_create_uv_surface_direct_cb(), blender::compositor::PlaneDistortMaskOperation::execute_pixel_sampled(), isect_point_tri_v2_int(), layer_bucket_isect_test(), M_Geometry_intersect_point_tri_2d(), maskrasterize_layer_isect(), overlap_tri_tri_uv_test(), project_bucket_face_isect(), project_paint_face_init(), project_paint_occlude_ptv(), project_paint_PickFace(), psys_particle_dm_face_lookup(), and ui_mouse_motion_towards_check().
bool isect_point_tri_v2_cw | ( | const float | pt[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2] | ||
) |
Only single direction.
Definition at line 1500 of file math_geom.c.
References line_point_side_v2(), v1, and v2.
Referenced by bm_loop_collapse_is_degenerate(), and maskrasterize_layer_isect().
int isect_point_tri_v2_int | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | a, | ||
int | b | ||
) |
Definition at line 3309 of file math_geom.c.
References Freestyle::a, usdtokens::b(), float(), isect_point_tri_v2(), v1, v2, x2, and y1.
bool isect_point_tri_v3 | ( | const float | p[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
float | r_isect_co[3] | ||
) |
r_isect_co | The point p projected onto the triangle. |
Definition at line 3397 of file math_geom.c.
References BLI_assert, closest_to_plane_v3(), cross_tri_v3(), isect_point_tri_prism_v3(), len_squared_v3(), plane_from_point_normal_v3(), v1, and v2.
Referenced by bm_isect_tri_tri(), and M_Geometry_intersect_point_tri().
bool isect_ray_aabb_v3 | ( | const struct IsectRayAABB_Precalc * | data, |
const float | bb_min[3], | ||
const float | bb_max[3], | ||
float * | tmin_out | ||
) |
Definition at line 3072 of file math_geom.c.
References copy_v3_v3(), and data.
Referenced by BKE_pbvh_raycast_project_ray_root(), and ray_aabb_intersect().
void isect_ray_aabb_v3_precalc | ( | struct IsectRayAABB_Precalc * | data, |
const float | ray_origin[3], | ||
const float | ray_direction[3] | ||
) |
Definition at line 3057 of file math_geom.c.
References copy_v3_v3(), and data.
Referenced by BKE_pbvh_raycast(), and BKE_pbvh_raycast_project_ray_root().
bool isect_ray_aabb_v3_simple | ( | const float | orig[3], |
const float | dir[3], | ||
const float | bb_min[3], | ||
const float | bb_max[3], | ||
float * | tmin, | ||
float * | tmax | ||
) |
Test a bounding box (AABB) for ray intersection. Assumes the ray is already local to the boundbox space.
Definition at line 3124 of file math_geom.c.
References double(), float(), and t.
Referenced by raycastEditMesh(), and raycastMesh().
bool isect_ray_line_v3 | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
float * | r_lambda | ||
) |
Definition at line 2028 of file math_geom.c.
References Freestyle::a, Freestyle::c, cross_v3_v3v3(), dot_v3v3(), len_squared_v3(), sub_v3_v3v3(), t, and v1.
Referenced by dist_squared_ray_to_seg_v3(), snap_mesh_edge_verts_mixed(), and test_projected_edge_dist().
bool isect_ray_plane_v3 | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | plane[4], | ||
float * | r_lambda, | ||
bool | clip | ||
) |
if clip is nonzero, will only return true if lambda is >= 0.0 (i.e. intersection point is along positive ray_direction)
Definition at line 1713 of file math_geom.c.
References blender::math::dot(), dot_v3v3(), len_squared_v3(), mul_v3_v3fl(), DistProjectedAABBPrecalc::ray_direction, DistProjectedAABBPrecalc::ray_origin, and sub_v3_v3v3().
Referenced by add_vertex_invoke(), constraint_snap_plane_to_edge(), ED_view3d_win_to_3d(), ED_view3d_win_to_3d_on_plane(), gizmo_arrow_modal(), knife_snap_angle_relative(), knifetool_raycast_planes(), planeProjection(), transform_constraint_snap_axis_to_face(), update_location_for_2d_curve(), and workbench_shadow_object_shadow_distance().
bool isect_ray_ray_epsilon_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 | epsilon, | ||
float * | r_lambda_a, | ||
float * | r_lambda_b | ||
) |
Check if two rays are not parallel and returns a factor that indicates the distance from ray_origin_b to the closest point on ray-a to ray-b.
Definition at line 2996 of file math_geom.c.
References BLI_assert, Freestyle::c, cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, len_squared_v3(), NULL, sub_v3_v3v3(), t, and UNLIKELY.
Referenced by bm_edgexedge_isect_cb(), and isect_ray_ray_v3().
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 | ||
) |
Definition at line 3032 of file math_geom.c.
References isect_ray_ray_epsilon_v3().
Referenced by axisProjection(), bm_vert_pair_share_splittable_face_cb(), and transform_constraint_snap_axis_to_edge().
bool isect_ray_seg_v2 | ( | const float | ray_origin[2], |
const float | ray_direction[2], | ||
const float | v0[2], | ||
const float | v1[2], | ||
float * | r_lambda, | ||
float * | r_u | ||
) |
Definition at line 1982 of file math_geom.c.
References cross_v2v2(), dot_v2v2(), sub_v2_v2v2(), t, v, and v1.
Referenced by bvhtree_test_edges_isect_2d_ray_cb(), and test_edges_isect_2d_ray().
bool isect_ray_tri_epsilon_v3 | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2], | ||
const float | epsilon | ||
) |
Definition at line 1735 of file math_geom.c.
References Freestyle::a, cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, DistProjectedAABBPrecalc::ray_direction, DistProjectedAABBPrecalc::ray_origin, sub_v3_v3v3(), v, v1, and v2.
Referenced by bmbvh_ray_cast_cb(), bvhtree_ray_tri_intersection(), knife_bvh_raycast_cb(), knife_ray_intersect_face(), and raycast_callback().
bool isect_ray_tri_v3 | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2] | ||
) |
Test if the ray starting at p1 going in d direction intersects the triangle v0..v2 return non zero if it does.
Definition at line 1662 of file math_geom.c.
References Freestyle::a, cross_v3_v3v3(), dot_v3v3(), blender::robust_pred::epsilon, DistProjectedAABBPrecalc::ray_direction, DistProjectedAABBPrecalc::ray_origin, sub_v3_v3v3(), v, v1, and v2.
Referenced by bmbvh_ray_cast_cb(), bvh_callback(), compute_collision_point_edge_tri(), compute_collision_point_tri_tri(), distribute_from_volume_exec(), isect_ray_poly(), and knife_bvh_raycast_cb().
bool isect_ray_tri_watertight_v3 | ( | const float | ray_origin[3], |
const struct IsectRayPrecalc * | isect_precalc, | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2] | ||
) |
Definition at line 1811 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, float_as_int(), CCL_NAMESPACE_BEGIN::isfinite(), IsectRayPrecalc::kx, IsectRayPrecalc::ky, IsectRayPrecalc::kz, DistProjectedAABBPrecalc::ray_origin, sx, IsectRayPrecalc::sx, sy, IsectRayPrecalc::sy, IsectRayPrecalc::sz, t, UNLIKELY, v, v1, v2, w(), xor_fl(), and xor_signmask().
Referenced by bmbvh_ray_cast_cb(), bvh_callback(), bvhtree_ray_tri_intersection(), cloth_brush_collision_cb(), distribute_grid(), harmonic_ray_callback(), isect_ray_tri_watertight_v3_simple(), knife_bvh_raycast_cb(), ray_face_intersection_quad(), ray_face_intersection_tri(), and raycast_callback().
void isect_ray_tri_watertight_v3_precalc | ( | struct IsectRayPrecalc * | isect_precalc, |
const float | ray_direction[3] | ||
) |
Definition at line 1784 of file math_geom.c.
References axis_dominant_v3_single(), IsectRayPrecalc::kx, IsectRayPrecalc::ky, IsectRayPrecalc::kz, DistProjectedAABBPrecalc::ray_direction, SWAP, IsectRayPrecalc::sx, IsectRayPrecalc::sy, and IsectRayPrecalc::sz.
Referenced by bvhtree_ray_cast_data_precalc(), cloth_brush_solve_collision(), distribute_grid(), isect_ray_tri_watertight_v3_simple(), sample_detail_dyntopo(), SCULPT_cursor_geometry_info_update(), and SCULPT_stroke_get_location().
bool isect_ray_tri_watertight_v3_simple | ( | const float | ray_origin[3], |
const float | ray_direction[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2] | ||
) |
Slower version which calculates IsectRayPrecalc each time.
Definition at line 1886 of file math_geom.c.
References isect_ray_tri_watertight_v3(), isect_ray_tri_watertight_v3_precalc(), v1, and v2.
Intersect Line-Line, floats.
Definition at line 1108 of file math_geom.c.
References float(), ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, ISECT_LINE_LINE_NONE, v1, and v2.
Referenced by BM_face_splits_check_legal(), gpencil_stroke_need_flip(), is_quad_convex_v2(), blender::ed::space_node::node_links_intersect(), and project_bucket_face_isect().
int isect_seg_seg_v2_int | ( | const int | v1[2], |
const int | v2[2], | ||
const int | v3[2], | ||
const int | v4[2] | ||
) |
Intersect Line-Line, integer.
Definition at line 1063 of file math_geom.c.
References float(), ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, ISECT_LINE_LINE_NONE, v1, and v2.
Referenced by BLI_lasso_is_edge_inside().
int isect_seg_seg_v2_lambda_mu_db | ( | const double | v1[2], |
const double | v2[2], | ||
const double | v3[2], | ||
const double | v4[2], | ||
double * | r_lambda, | ||
double * | r_mu | ||
) |
If intersection == ISECT_LINE_LINE_CROSS or ISECT_LINE_LINE_NONE:
pt = v1 + lambda * (v2 - v1) = v3 + mu * (v4 - v3)
Definition at line 1315 of file math_geom.c.
References fabs(), ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, ISECT_LINE_LINE_NONE, v1, and v2.
int isect_seg_seg_v2_point | ( | const float | v0[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
float | r_vi[2] | ||
) |
Definition at line 1296 of file math_geom.c.
References isect_seg_seg_v2_point_ex(), v1, and v2.
Referenced by blender::ed::space_node::add_reroute_intersect_check(), feather_bucket_check_intersect(), gpencil_check_collision(), lineart_chain_create_crossing_point(), M_Geometry_intersect_line_line_2d(), scanfill_preprocess_self_isect(), testVoronoiEdge(), uv_image_outset(), and voronoi_clampEdgeVertex().
int isect_seg_seg_v2_point_ex | ( | const float | v0[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
float | endpoint_bias, | ||
float | vi[2] | ||
) |
Get intersection point of two 2D segments.
endpoint_bias | Bias to use when testing for end-point overlap. A positive value considers intersections that extend past the endpoints, negative values contract the endpoints. Note the bias is applied to a 0-1 factor, not scaled to the length of segments. |
Definition at line 1195 of file math_geom.c.
References copy_v2_v2(), cross_v2v2(), dot_v2v2(), eps, equals_v2v2(), len_squared_v2v2(), line_point_factor_v2(), madd_v2_v2v2fl(), max_ff(), min_ff(), square_f(), sub_v2_v2v2(), SWAP, v, v1, and v2.
Referenced by edge_isect_verts_point_2d(), isect_seg_seg_v2_point(), knife_find_line_hits(), and overlap_tri_tri_uv_test().
bool isect_seg_seg_v2_simple | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2] | ||
) |
Definition at line 1303 of file math_geom.c.
Referenced by closest_seg_seg_v2(), dist_seg_seg_v2(), feather_bucket_check_intersect(), and uv_image_outset().
void isect_seg_seg_v3 | ( | const float | a0[3], |
const float | a1[3], | ||
const float | b0[3], | ||
const float | b1[3], | ||
float | r_a[3], | ||
float | r_b[3] | ||
) |
Returns a point on each segment that is closest to the other.
Definition at line 1130 of file math_geom.c.
References Freestyle::c, CLAMP, cross_v3_v3v3(), dot_v3v3(), len_squared_v3(), madd_v3_v3v3fl(), and sub_v3_v3v3().
Referenced by compute_collision_point_edge_tri(), and compute_collision_point_tri_tri().
bool isect_sweeping_sphere_tri_v3 | ( | const float | p1[3], |
const float | p2[3], | ||
const float | radius, | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | ipoint[3] | ||
) |
Definition at line 2626 of file math_geom.c.
References Freestyle::a, add_v3_v3(), usdtokens::b(), Freestyle::c, CLAMP, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), e, fabsf, getLowestRoot(), mul_v3_fl(), negate_v3(), nor, normalize_v3(), point, sub_v3_v3v3(), SWAP, v1, v2, x, y, and z.
Referenced by bvhtree_sphereray_tri_intersection(), and particle_intersect_mesh().
|
static |
Definition at line 2507 of file math_geom.c.
References isect_tri_tri_v2_impl_edge(), isect_tri_tri_v2_impl_vert(), and line_point_side_v2().
Referenced by isect_tri_tri_v2().
bool isect_tri_tri_v2 | ( | const float | t_a0[2], |
const float | t_a1[2], | ||
const float | t_a2[2], | ||
const float | t_b0[2], | ||
const float | t_b1[2], | ||
const float | t_b2[2] | ||
) |
Definition at line 2541 of file math_geom.c.
References isect_tri_tri_impl_ccw_v2(), and line_point_side_v2().
Referenced by M_Geometry_intersect_tri_tri_2d().
|
static |
Definition at line 2459 of file math_geom.c.
References line_point_side_v2(), and UNUSED_VARS.
Referenced by isect_tri_tri_impl_ccw_v2().
|
static |
Definition at line 2396 of file math_geom.c.
References line_point_side_v2().
Referenced by isect_tri_tri_impl_ccw_v2().
bool isect_tri_tri_v3 | ( | const float | t_a0[3], |
const float | t_a1[3], | ||
const float | t_a2[3], | ||
const float | t_b0[3], | ||
const float | t_b1[3], | ||
const float | t_b2[3], | ||
float | r_i1[3], | ||
float | r_i2[3] | ||
) |
Definition at line 2367 of file math_geom.c.
References copy_v3_v3(), and isect_tri_tri_v3_ex().
Referenced by bmbvh_overlap_cb(), blender::draw::bvh_overlap_cb(), and py_bvhtree_overlap_cb().
bool isect_tri_tri_v3_ex | ( | const float | tri_a[3][3], |
const float | tri_b[3][3], | ||
float | r_i1[3], | ||
float | r_i2[3], | ||
int * | r_tri_a_edge_isect_count | ||
) |
Intersect two triangles.
r_i1,r_i2 | Retrieve the overlapping edge between the 2 triangles. |
r_tri_a_edge_isect_count | Indicates how many edges in the first triangle are intersected. |
Definition at line 2230 of file math_geom.c.
References copy_v3_v3(), cross_v3_v3v3_db(), dot_v3db_v3fl(), float(), interp_v3_v3v3(), max, min, sub_v3db_v3fl_v3fl(), and SWAP.
Referenced by compute_collision_point_tri_tri(), and isect_tri_tri_v3().
Ensure the distance between these points is no greater than 'dist'. If it is, scale them both into the center.
Definition at line 3292 of file math_geom.c.
References copy_v3_v3(), interp_v3_v3v3(), len_v3v3(), v1, and v2.
float line_plane_factor_v3 | ( | const float | plane_co[3], |
const float | plane_no[3], | ||
const float | l1[3], | ||
const float | l2[3] | ||
) |
Definition at line 3279 of file math_geom.c.
References blender::math::dot(), dot_v3v3(), and sub_v3_v3v3().
Referenced by apply_stroke_envelope().
Definition at line 3274 of file math_geom.c.
References line_point_factor_v2_ex().
Referenced by bvhtree_test_edges_isect_2d_vert_cb(), facetag_cut_cost_edge_uv(), find_nearest_edge__doClosest(), gizmo_ruler_invoke(), gradientVert_update(), interp_weights_poly_v2(), isect_seg_seg_v2_point_ex(), knife_find_closest_edge_of_face(), knife_snap_edge_constrained(), M_Geometry_intersect_line_sphere_2d(), project_paint_face_init(), screen_px_line_point_factor_v2_persp(), and test_edges_isect_2d_vert().
float line_point_factor_v2_ex | ( | const float | p[2], |
const float | l1[2], | ||
const float | l2[2], | ||
const float | epsilon, | ||
const float | fallback | ||
) |
Definition at line 3259 of file math_geom.c.
References blender::math::dot(), dot_v2v2(), blender::robust_pred::epsilon, len_squared_v2(), and sub_v2_v2v2().
Referenced by line_point_factor_v2().
Definition at line 3254 of file math_geom.c.
References line_point_factor_v3_ex().
Referenced by BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), bm_decim_edge_collapse(), bm_face_split_edge_find(), bm_isect_tri_tri(), bm_loop_calc_opposite_co(), BM_mesh_intersect(), cloth_collision_response_static(), createEdgeSlideVerts_single_side(), edbm_polybuild_face_at_cursor_invoke(), edbm_polybuild_split_at_cursor_invoke(), edge_slide_snap_apply(), facetag_cut_cost_edge(), gpencil_vertex_group_smooth_exec(), interp_line_v3_v3v3v3(), interp_weights_poly_v3(), knife_find_closest_edge_of_face(), knife_make_cuts(), M_Geometry_intersect_line_sphere(), mesh_edges_spherecast(), remap_hair_emitter(), snap_mesh_edge_verts_mixed(), transdata_elem_bend(), transform_point_by_seg_v3(), and vert_slide_snap_apply().
float line_point_factor_v3_ex | ( | const float | p[3], |
const float | l1[3], | ||
const float | l2[3], | ||
float | epsilon, | ||
float | fallback | ||
) |
A simplified version of closest_to_line_v3 we only need to return the lambda
epsilon | avoid approaching divide-by-zero. Passing a zero will just check for nonzero division. |
Definition at line 3239 of file math_geom.c.
References blender::math::dot(), dot_v3v3(), blender::robust_pred::epsilon, len_squared_v3(), and sub_v3_v3v3().
Referenced by line_point_factor_v3().
void lookat_m4 | ( | float | mat[4][4], |
float | vx, | ||
float | vy, | ||
float | vz, | ||
float | px, | ||
float | py, | ||
float | pz, | ||
float | twist | ||
) |
Definition at line 4782 of file math_geom.c.
References axis_angle_to_mat4_single(), i_multmatrix(), sqrtf, translate_m4(), and unit_m4().
void map_to_plane_axis_angle_v2_v3v3fl | ( | float | r_co[2], |
const float | co[3], | ||
const float | axis[3], | ||
const float | angle | ||
) |
Definition at line 4963 of file math_geom.c.
References angle(), copy_v2_v2(), and rotate_normalized_v3_v3v3fl().
Referenced by computeBindWeights(), and map_to_plane_v2_v3v3().
Definition at line 4952 of file math_geom.c.
References angle_normalized_v3v3(), cross_v3_v3v3(), map_to_plane_axis_angle_v2_v3v3fl(), and normalize_v3().
Definition at line 4932 of file math_geom.c.
References atan2f, float(), len, M_PI, saacos(), sqrtf, UNLIKELY, x, y, and z.
Referenced by dm_ts_GetTextureCoordinate(), do_2d_mapping(), emdm_ts_GetTextureCoordinate(), light_sample(), light_sample_from_intersection(), mikk_get_texture_coordinate(), psys_interpolate_face(), svm_node_tex_image(), and uv_sphere_project().
Definition at line 4917 of file math_geom.c.
References atan2f, float(), len, M_PI, sqrtf, x, y, and z.
Referenced by do_2d_mapping(), svm_node_tex_image(), and uv_cylinder_project().
|
static |
Mean value weights - same as mean_value_half_tan_v3 but for 2D vectors.
Definition at line 4058 of file math_geom.c.
References blender::compositor::area(), cross_v2v2_db(), Double2_Len::dir, blender::math::dot(), dot_v2v2_db(), CCL_NAMESPACE_BEGIN::isfinite(), Double2_Len::len, len, LIKELY, and result.
Referenced by interp_weights_poly_v2().
|
static |
Definition at line 4031 of file math_geom.c.
References blender::compositor::area(), blender::math::cross(), cross_v3_v3v3(), Float3_Len::dir, blender::math::dot(), dot_v3v3(), CCL_NAMESPACE_BEGIN::isfinite(), Float3_Len::len, len, len_v3(), LIKELY, and result.
Referenced by interp_weights_poly_v3().
Computes the normal of a planar polygon See Graphics Gems for computing newell normal.
Definition at line 71 of file math_geom.c.
References cross_poly_v3(), normalize_v3(), and verts.
Referenced by computeBindWeights(), deformVert(), M_Geometry_normal(), and sculpt_boundary_twist_data_init().
float normal_quad_v3 | ( | float | n[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Definition at line 50 of file math_geom.c.
References normalize_v3(), v1, and v2.
Referenced by BKE_displist_normals_add(), BKE_mesh_calc_poly_normal(), BKE_mesh_calc_poly_normal_coords(), BM_face_calc_normal(), BM_face_calc_normal_vcos(), BM_verts_calc_normal_from_cloud_ex(), bmesh_calc_tessellation_for_face_impl(), connect_frames(), dm_ts_GetNormal(), end_node_frames(), GPU_pbvh_grid_buffers_update(), make_face(), MOD_solidify_extrude_modifyMesh(), pbvh_grids_node_raycast(), psys_interpolate_face(), quad_co(), skin_hole_target_face(), and subdiv_ccg_recalc_inner_face_normals().
Definition at line 33 of file math_geom.c.
References normalize_v3(), v1, and v2.
Referenced by bindVert(), BKE_mesh_calc_normals_looptri(), BKE_mesh_calc_poly_normal(), BKE_mesh_calc_poly_normal_coords(), bm_edge_calc_rotate_beauty__angle(), bm_edge_collapse_is_degenerate_flip(), BM_face_calc_normal(), BM_face_calc_normal_vcos(), bm_isect_tri_tri(), BM_verts_calc_normal_from_cloud_ex(), bmesh_calc_tessellation_for_face_impl(), bmo_edgenet_prepare_exec(), bvh_callback(), C_BVHTree_FromPolygons(), calc_area_normal_and_center_task_cb(), cloth_bend_poly_dir(), cloth_brush_collision_cb(), blender::nodes::node_geo_distribute_points_on_faces_cc::compute_attribute_outputs(), compute_collision_point_edge_tri(), compute_collision_point_tri_tri(), blender::nodes::node_geo_curve_primitive_arc_cc::create_arc_curve_from_points(), dm_ts_GetNormal(), dynamic_paint_paint_mesh_cell_point_cb_ex(), ED_view3d_clipping_calc_from_boundbox(), editmesh_looptri_nearest_point(), editmesh_looptri_spherecast(), getTransformOrientation_ex(), harmonic_ray_callback(), heat_calc_vnormals(), initLaplacianMatrix(), Freestyle::BlenderFileLoader::insertShapeNode(), interp_weights_tri_v3(), knife_ray_intersect_face(), lineart_load_tri_task(), make_face(), mesh_faces_nearest_point(), mesh_faces_spherecast(), mesh_looptri_nearest_point(), mesh_looptri_spherecast(), pbvh_bmesh_node_raycast(), pbvh_faces_node_raycast(), poly_norm(), project_paint_uvpixel_mask(), psys_interpolate_face(), py_bvhtree_nearest_point_range_cb(), quad_calc_error(), rotateDifferentialCoordinates(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), sculpt_gesture_line_calculate_plane_points(), sculpt_gesture_line_plane_from_tri(), blender::draw::statvis_calc_distort(), blender::draw::statvis_calc_thickness(), transform_point_by_tri_v3(), tri_to_quat(), tri_to_quat_ex(), triatomat(), view3d_boxview_clip(), and voxel_size_edit_invoke().
void orthographic_m4 | ( | float | mat[4][4], |
float | left, | ||
float | right, | ||
float | bottom, | ||
float | top, | ||
float | nearClip, | ||
float | farClip | ||
) |
Matches glOrtho
result.
Definition at line 4517 of file math_geom.c.
References bottom, left, right, top, and unit_m4().
Referenced by BKE_camera_params_compute_matrix(), blender::draw::image_engine::ImageEngine< DrawingMode >::cache_init(), ED_view3d_draw_offscreen_imbuf(), gpencil_render_offscreen(), and wmGetProjectionMatrix().
void perspective_m4 | ( | float | mat[4][4], |
float | left, | ||
float | right, | ||
float | bottom, | ||
float | top, | ||
float | nearClip, | ||
float | farClip | ||
) |
Matches glFrustum
result.
Definition at line 4542 of file math_geom.c.
References bottom, left, right, and top.
Referenced by BKE_camera_params_compute_matrix(), BKE_tracking_get_projection_matrix(), blender::eevee::cubeface_winmat_get(), ED_view3d_draw_offscreen_imbuf(), eevee_ensure_cube_views(), gpencil_render_offscreen(), perspective_m4_fov(), render_cubemap(), blender::eevee::Camera::sync(), and blender::eevee::ShadingView::sync().
void perspective_m4_fov | ( | float | mat[4][4], |
const float | angle_left, | ||
const float | angle_right, | ||
const float | angle_up, | ||
const float | angle_down, | ||
const float | nearClip, | ||
const float | farClip | ||
) |
Definition at line 4568 of file math_geom.c.
References perspective_m4(), and tanf.
Referenced by wm_xr_draw_matrices_create().
void plane_from_point_normal_v3 | ( | float | r_plane[4], |
const float | plane_co[3], | ||
const float | plane_no[3] | ||
) |
Calculate a plane from a point and a direction,
Definition at line 209 of file math_geom.c.
References copy_v3_v3(), and dot_v3v3().
Referenced by BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(), bmo_bisect_plane_exec(), bmo_planar_faces_exec(), build_boundary_terminal_edge(), calc_clay_surface_task_cb(), calc_initial_placement_point_from_view(), camera_frame_fit_calc_from_data(), cloth_brush_solve_collision(), blender::nodes::node_geo_curve_primitive_arc_cc::create_arc_curve_from_points(), blender::nodes::node_geo_curve_primitive_circle_cc::create_point_circle_curve(), dial_ghostarc_get_angles(), dist_signed_squared_to_corner_v3v3v3(), do_clay_brush_task_cb_ex(), do_clay_strips_brush_task_cb_ex(), do_clay_thumb_brush_task_cb_ex(), do_cloth_brush_apply_forces_task_cb_ex(), do_fill_brush_task_cb_ex(), do_flatten_brush_task_cb_ex(), do_scrape_brush_task_cb_ex(), draw_primitive_view_impl(), ED_view3d_win_to_3d(), face_to_plane(), getVerticalAndHorizontalChange(), gizmo_arrow_modal(), gizmo_mesh_spin_redo_setup(), gizmo_window_project_2d(), gpencil_depth_plane(), gpencil_sculpt_compute_lock_axis(), interp_slerp_co_no_v3(), isect_point_tri_v3(), knife_find_line_hits(), knife_ray_intersect_face(), knife_snap_angle_relative(), M_Geometry_distance_point_to_plane(), M_Geometry_intersect_plane_plane(), modifyMesh(), offset_meet(), sculpt_boundary_displacement_from_grab_delta_get(), SCULPT_brush_test_init_with_falloff_shape(), SCULPT_do_multiplane_scrape_brush(), sculpt_gesture_line_plane_from_tri(), sculpt_gesture_trim_calculate_depth(), sculpt_gesture_trim_geometry_generate(), sculpt_pose_get_scale_from_grab_delta(), SCULPT_relax_vertex(), snap_to_pipe_profile(), transform_constraint_snap_axis_to_face(), transform_snap_context_project_view3d_mixed_impl(), UNUSED_FUNCTION(), v3d_cursor_snap_update(), view3d_interactive_add_begin(), and view3d_interactive_add_modal().
Get a point and a direction from a plane.
Definition at line 215 of file math_geom.c.
References copy_v3_v3(), len_squared_v3(), and mul_v3_v3fl().
void plane_to_point_vector_v3_normalized | ( | const float | plane[4], |
float | r_plane_co[3], | ||
float | r_plane_no[3] | ||
) |
Version of plane_to_point_vector_v3 that gets a unit length vector.
Definition at line 221 of file math_geom.c.
References blender::math::length(), mul_v3_v3fl(), and normalize_v3_v3().
void planes_from_projmat | ( | const float | mat[4][4], |
float | left[4], | ||
float | right[4], | ||
float | bottom[4], | ||
float | top[4], | ||
float | near[4], | ||
float | far[4] | ||
) |
Frustum planes extraction from a projection matrix (homogeneous 4d vector representations of planes).
plane parameters can be NULL if you do not need them.
Definition at line 4615 of file math_geom.c.
References bottom, left, right, and top.
Referenced by BLI_bvhtree_find_nearest_projected(), camera_frame_fit_data_init(), content_planes_from_clip_flag(), draw_frustum_culling_planes_calc(), knifetool_raycast_planes(), and transform_snap_context_project_view3d_mixed_impl().
|
static |
Definition at line 3329 of file math_geom.c.
References closest_to_line_v3(), dot_v3v3(), sub_v3_v3v3(), and v1.
Referenced by isect_point_tri_prism_v3().
|
static |
Definition at line 3360 of file math_geom.c.
References dot_v3v3(), normal, and sub_v3_v3v3().
Referenced by point_in_slice_seg().
Definition at line 3371 of file math_geom.c.
References normal, point_in_slice_as(), and sub_v3_v3v3().
Referenced by compute_collision_point_edge_tri(), and compute_collision_point_tri_tri().
Definition at line 4772 of file math_geom.c.
References rotate_m4(), translate_m4(), and unit_m4().
void projmat_dimensions | ( | const float | winmat[4][4], |
float * | r_left, | ||
float * | r_right, | ||
float * | r_bottom, | ||
float * | r_top, | ||
float * | r_near, | ||
float * | r_far | ||
) |
Definition at line 4668 of file math_geom.c.
Referenced by draw_frustum_boundbox_calc().
void projmat_dimensions_db | ( | const float | winmat_fl[4][4], |
double * | r_left, | ||
double * | r_right, | ||
double * | r_bottom, | ||
double * | r_top, | ||
double * | r_near, | ||
double * | r_far | ||
) |
Definition at line 4696 of file math_geom.c.
References copy_m4d_m4().
void projmat_from_subregion | ( | const float | projmat[4][4], |
const int | win_size[2], | ||
int | x_min, | ||
int | x_max, | ||
int | y_min, | ||
int | y_max, | ||
float | r_projmat[4][4] | ||
) |
Creates a projection matrix for a small region of the viewport.
projmat | Projection Matrix. |
win_size | Viewport Size. |
x_min,x_max,y_min,y_max | Coordinates of the subregion. |
Definition at line 4727 of file math_geom.c.
References copy_m4_m4(), float(), rect_height(), and rect_width().
Referenced by select_engine_init().
float ray_point_factor_v3 | ( | const float | p[3], |
const float | ray_origin[3], | ||
const float | ray_direction[3] | ||
) |
Definition at line 3232 of file math_geom.c.
References ray_point_factor_v3_ex().
Referenced by ED_view3d_win_to_3d().
float ray_point_factor_v3_ex | ( | const float | p[3], |
const float | ray_origin[3], | ||
const float | ray_direction[3], | ||
const float | epsilon, | ||
const float | fallback | ||
) |
Definition at line 3220 of file math_geom.c.
References blender::math::dot(), dot_v3v3(), blender::robust_pred::epsilon, len_squared_v3(), and sub_v3_v3v3().
Referenced by bm_edgexvert_isect_cb(), and ray_point_factor_v3().
float resolve_quad_u_v2 | ( | const float | st[2], |
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2], | ||
const float | st3[2] | ||
) |
A version of resolve_quad_uv_v2 that only calculates the 'u'.
Definition at line 4441 of file math_geom.c.
References Freestyle::a, usdtokens::b(), double(), IS_ZERO, sqrt(), and usdtokens::st().
Referenced by project_paint_face_init().
void resolve_quad_uv_v2 | ( | float | r_uv[2], |
const float | st[2], | ||
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2], | ||
const float | st3[2] | ||
) |
Bilinear reverse.
Definition at line 4341 of file math_geom.c.
References NULL, resolve_quad_uv_v2_deriv(), and usdtokens::st().
Referenced by apply_heights_callback(), apply_tangmat_callback(), and quad_co().
void resolve_quad_uv_v2_deriv | ( | float | r_uv[2], |
float | r_deriv[2][2], | ||
const float | st[2], | ||
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2], | ||
const float | st3[2] | ||
) |
Bilinear reverse with derivatives.
Definition at line 4351 of file math_geom.c.
References Freestyle::a, usdtokens::b(), double(), fabs(), float(), interp_v2_v2v2(), IS_ZERO, sqrt(), usdtokens::st(), sub_v2_v2v2(), t, and zero_v2().
Referenced by resolve_quad_uv_v2().
void resolve_tri_uv_v2 | ( | float | r_uv[2], |
const float | st[2], | ||
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2] | ||
) |
Barycentric reverse
Compute coordinates (u, v) for point st with respect to triangle (st0, st1, st2)
Definition at line 4288 of file math_geom.c.
References Freestyle::a, usdtokens::b(), Freestyle::c, float(), IS_ZERO, usdtokens::st(), x, and zero_v2().
Referenced by apply_heights_callback(), apply_tangmat_callback(), and flush_pixel().
void resolve_tri_uv_v3 | ( | float | r_uv[2], |
const float | st[3], | ||
const float | st0[3], | ||
const float | st1[3], | ||
const float | st2[3] | ||
) |
Barycentric reverse 3d
Compute coordinates (u, v) for point st with respect to triangle (st0, st1, st2)
Definition at line 4310 of file math_geom.c.
References dot_v3v3(), float(), IS_ZERO, usdtokens::st(), sub_v3_v3v3(), v1, v2, w(), and zero_v2().
void tangent_from_uv_v3 | ( | const float | uv1[2], |
const float | uv2[2], | ||
const float | uv3[2], | ||
const float | co1[3], | ||
const float | co2[3], | ||
const float | co3[3], | ||
const float | n[3], | ||
float | r_tang[3] | ||
) |
Definition at line 5095 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), negate_v3(), sub_v3_v3v3(), and zero_v3().
void transform_point_by_seg_v3 | ( | float | p_dst[3], |
const float | p_src[3], | ||
const float | l_dst_p1[3], | ||
const float | l_dst_p2[3], | ||
const float | l_src_p1[3], | ||
const float | l_src_p2[3] | ||
) |
Simply re-interpolates, assumes p_src is between l_src_p1-l_src_p2
Definition at line 3906 of file math_geom.c.
References interp_v3_v3v3(), line_point_factor_v3(), and t.
Referenced by knife_find_line_hits().
void transform_point_by_tri_v3 | ( | float | pt_tar[3], |
float const | pt_src[3], | ||
const float | tri_tar_p1[3], | ||
const float | tri_tar_p2[3], | ||
const float | tri_tar_p3[3], | ||
const float | tri_src_p1[3], | ||
const float | tri_src_p2[3], | ||
const float | tri_src_p3[3] | ||
) |
Given 2 triangles in 3D space, and a point in relation to the first triangle. calculate the location of a point in relation to the second triangle. Useful for finding relative positions with geometry.
Definition at line 3862 of file math_geom.c.
References area_tri_v2(), area_tri_v3(), axis_dominant_v3_to_m3(), barycentric_weights_v2(), interp_v3_v3v3v3(), madd_v3_v3v3fl(), mul_v3_m3v3(), normal_tri_v3(), and sqrtf.
Referenced by BKE_mesh_calc_relative_deform(), bm_edgering_pair_interpolate(), bm_grid_fill_array(), and M_Geometry_barycentric_transform().
|
static |
Definition at line 3562 of file math_geom.c.
Referenced by barycentric_weights().
void vcloud_estimate_transform_v3 | ( | int | list_size, |
const float(*) | pos[3], | ||
const float * | weight, | ||
const float(*) | rpos[3], | ||
const float * | rweight, | ||
float | lloc[3], | ||
float | rloc[3], | ||
float | lrot[3][3], | ||
float | lscale[3][3] | ||
) |
Input:
list_size | 4 lists as pointer to array[list_size] |
pos | current pos array of 'new' positions |
weight | current weight array of 'new'weights (may be NULL pointer if you have no weights) |
rpos | Reference rpos array of 'old' positions |
rweight | Reference rweight array of 'old'weights (may be NULL pointer if you have no weights). |
Output:
lloc | Center of mass pos. |
rloc | Center of mass rpos. |
lrot | Rotation matrix. |
lscale | Scale matrix. |
pointers may be NULL if not needed
Definition at line 5141 of file math_geom.c.
References Freestyle::a, add_m3_m3m3(), add_v3_v3(), copy_m3_m3(), copy_v3_v3(), determinant_m3_array(), eps, float(), invert_m3_m3(), len_v3(), mul_m3_fl(), mul_m3_m3m3(), mul_v3_fl(), pos, sub_v3_v3v3(), transpose_m3(), unit_m3(), v, zero_m3(), and zero_v3().
Referenced by SB_estimate_transform().
|
static |
Definition at line 5292 of file math_geom.c.
Referenced by form_factor_visible_quad().
float volume_tetrahedron_signed_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
The volume from a tetrahedron, normal pointing inside gives negative volume
Definition at line 243 of file math_geom.c.
References determinant_m3_array(), sub_v3_v3v3(), v1, and v2.
Referenced by BKE_mesh_calc_volume(), and compute_volume().
float volume_tetrahedron_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
The volume from a tetrahedron, points can be in any order
Definition at line 231 of file math_geom.c.
References determinant_m3_array(), fabsf, sub_v3_v3v3(), v1, and v2.
Referenced by M_Geometry_volume_tetrahedron().
Definition at line 263 of file math_geom.c.
References v1, v2, and volume_tri_tetrahedron_signed_v3_6x().
float volume_tri_tetrahedron_signed_v3_6x | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3] | ||
) |
The volume from a triangle that is made into a tetrahedron. This uses a simplified formula where the tip of the tetrahedron is in the world origin. Using this method, the total volume of a closed triangle mesh can be calculated. Note that you need to divide the result by 6 to get the actual volume.
Definition at line 255 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), v1, and v2.
Referenced by cloth_calc_rest_volume(), mesh_calc_poly_volume_centroid(), mesh_calc_poly_volume_centroid_with_reference_center(), SIM_tri_tetra_volume_signed_6x(), and volume_tri_tetrahedron_signed_v3().
Translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view).
Definition at line 4587 of file math_geom.c.
References len_v3(), v1, v2, x, and y.
Referenced by EEVEE_temporal_sampling_matrices_calc(), and workbench_antialiasing_setup().