Blender V2.61 - r43446
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
Go to the source code of this file.
Defines | |
#define | IS_ZERO(x) ((x>(-DBL_EPSILON) && x<DBL_EPSILON) ? 1 : 0) |
#define | STD_UV_CONNECT_LIMIT 0.0001f |
Functions | |
void | cent_tri_v3 (float cent[3], const float v1[3], const float v2[3], const float v3[3]) |
void | cent_quad_v3 (float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[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 | area_tri_v2 (const float v1[2], const float v2[2], const float v3[2]) |
float | area_tri_signed_v2 (const float v1[2], const float v2[2], const float v3[2]) |
float | area_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_poly_v3 (int nr, float verts[][3], const float normal[3]) |
float | dist_to_line_v2 (const float v1[2], const float v2[2], const float v3[2]) |
float | dist_to_line_segment_v2 (const float v1[2], const float v2[2], const float v3[2]) |
void | closest_to_line_segment_v2 (float close_r[2], const float p[2], const float l1[2], const float l2[2]) |
void | closest_to_line_segment_v3 (float close_r[3], const float v1[3], const float v2[3], const float v3[3]) |
void | closest_to_plane_v3 (float close_r[3], const float plane_co[3], const float plane_no_unit[3], const float pt[3]) |
float | dist_to_plane_normalized_v3 (const float p[3], const float plane_co[3], const float plane_no_unit[3]) |
float | dist_to_plane_v3 (const float p[3], const float plane_co[3], const float plane_no[3]) |
float | dist_to_line_segment_v3 (const float v1[3], const float v2[3], const float v3[3]) |
int | isect_line_line_v2_int (const int v1[2], const int v2[2], const int v3[2], const int v4[2]) |
int | isect_line_line_v2 (const float v1[2], const float v2[2], const float v3[2], const float v4[2]) |
int | isect_seg_seg_v2_point (const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]) |
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]) |
static short | IsectLLPt2Df (const float x0, const float y0, const float x1, const float y1, const float x2, const float y2, const float x3, const float y3, float *xi, float *yi) |
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]) |
int | isect_line_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]) |
int | isect_ray_tri_v3 (const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]) |
int | isect_ray_plane_v3 (const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, const int clip) |
int | isect_ray_tri_epsilon_v3 (const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float uv[2], const float epsilon) |
int | isect_ray_tri_threshold_v3 (const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold) |
int | isect_line_plane_v3 (float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3], const short no_flip) |
void | isect_plane_plane_v3 (float r_isect_co[3], float r_isect_no[3], const float plane_a_co[3], const float plane_a_no[3], const float plane_b_co[3], const float plane_b_no[3]) |
static int | getLowestRoot (const float a, const float b, const float c, const float maxR, float *root) |
int | 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]) |
int | isect_axial_line_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_v3 (const float v1[3], const float v2[3], const float v3[3], const float v4[3], float i1[3], float i2[3]) |
int | 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) |
int | isect_aabb_aabb_v3 (const float min1[3], const float max1[3], const float min2[3], const float max2[3]) |
float | closest_to_line_v3 (float cp[3], const float p[3], const float l1[3], const float l2[3]) |
float | closest_to_line_v2 (float cp[2], const float p[2], const float l1[2], const float l2[2]) |
float | line_point_factor_v3 (const float p[3], const float l1[3], const float l2[3]) |
float | line_point_factor_v2 (const float p[2], const float l1[2], const float l2[2]) |
void | isect_point_quad_uv_v2 (const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2]) |
void | isect_point_face_uv_v2 (const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2]) |
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 int | point_in_slice (const float p[3], const float v1[3], const float l1[3], const float l2[3]) |
int | isect_point_tri_prism_v3 (const float p[3], const float v1[3], const float v2[3], const float v3[3]) |
int | clip_line_plane (float p1[3], float p2[3], const float plane[4]) |
void | plot_line_v2v2i (const int p1[2], const int p2[2], int(*callback)(int, int, void *), void *userData) |
void | axis_dominant_v3 (int *axis_a, int *axis_b, const float axis[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 int | 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_face_v3 (float w[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float co[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_transform (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]) |
int | interp_sparse_array (float *array, int const list_size, const float skipval) |
static float | mean_value_half_tan (const float v1[3], const float v2[3], const float v3[3]) |
void | interp_weights_poly_v3 (float *w, float v[][3], const int n, const float co[3]) |
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 (float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]) |
void | resolve_quad_uv (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 | orthographic_m4 (float matrix[][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 | window_translate_m4 (float winmat[][4], float perspmat[][4], const float x, const float y) |
static void | i_multmatrix (float icand[][4], float Vm[][4]) |
void | polarview_m4 (float Vm[][4], float dist, float azimuth, float incidence, float twist) |
void | lookat_m4 (float mat[][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 *u, float *v, const float x, const float y, const float z) |
void | map_to_sphere (float *u, float *v, const float x, const float y, const float z) |
void | accumulate_vertex_normals (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 | sum_or_add_vertex_tangent (void *arena, VertexTangent **vtang, const float tang[3], const float uv[2]) |
float * | find_vertex_tangent (VertexTangent *vtang, const float uv[2]) |
void | tangent_from_uv (float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3]) |
static float | _det_m3 (float m2[3][3]) |
void | vcloud_estimate_transform (int list_size, float(*pos)[3], float *weight, float(*rpos)[3], 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) |
static int | ff_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]) |
static float | ff_quad_form_factor (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]) |
Definition in file math_geom.c.
#define IS_ZERO | ( | x | ) | ((x>(-DBL_EPSILON) && x<DBL_EPSILON) ? 1 : 0) |
Definition at line 2032 of file math_geom.c.
Referenced by resolve_quad_uv(), and resolve_tri_uv().
#define STD_UV_CONNECT_LIMIT 0.0001f |
Definition at line 2394 of file math_geom.c.
Referenced by find_vertex_tangent(), and sum_or_add_vertex_tangent().
static float _det_m3 | ( | float | m2[3][3] | ) | [static] |
Definition at line 2490 of file math_geom.c.
Referenced by vcloud_estimate_transform().
void accumulate_vertex_normals | ( | 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 2344 of file math_geom.c.
References dot_v3v3(), i, madd_v3_v3fl(), normalize_v3(), NULL, saacos(), and sub_v3_v3v3().
Referenced by calc_vertexnormals(), mesh_calc_normals(), and recalc_editnormals().
float area_poly_v3 | ( | int | nr, |
float | verts[][3], | ||
const float | normal[3] | ||
) |
Definition at line 130 of file math_geom.c.
float area_quad_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Definition at line 101 of file math_geom.c.
References cross_v3_v3v3(), len(), normalize_v3(), and sub_v3_v3v3().
Referenced by distribute_threads_init_data(), draw_em_measure_stats(), EM_face_area(), face_duplilist(), occ_face(), and psys_render_simplify_distribution().
float area_tri_signed_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2] | ||
) |
Definition at line 96 of file math_geom.c.
Referenced by barycentric_weights_v2(), and barycentric_weights_v2_persp().
float area_tri_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2] | ||
) |
Definition at line 91 of file math_geom.c.
References fabsf.
Referenced by barycentric_transform(), IsectPT2Df_limit(), M_Geometry_area_tri(), and uv_area().
float area_tri_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 118 of file math_geom.c.
References cross_v3_v3v3(), len(), normalize_v3(), and sub_v3_v3v3().
Referenced by barycentric_transform(), beautify_fill(), distribute_threads_init_data(), draw_em_measure_stats(), EM_face_area(), face_duplilist(), init_render_curve(), laplacian_triangle_area(), M_Geometry_area_tri(), measure_facepair(), occ_face(), p_face_area(), and psys_render_simplify_distribution().
void axis_dominant_v3 | ( | int * | axis_a, |
int * | axis_b, | ||
const float | axis[3] | ||
) |
Definition at line 1715 of file math_geom.c.
References fabsf.
Referenced by barycentric_weights(), BLI_edgefill(), cube_project_exec(), shade_input_set_uv(), shade_ray_set_derivative(), and textured_face_generate_uv().
void barycentric_transform | ( | 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] | ||
) |
Definition at line 1835 of file math_geom.c.
References area_tri_v2(), area_tri_v3(), barycentric_weights_v2(), copy_v3_v3(), interp_v3_v3v3v3(), madd_v3_v3v3fl(), mul_qt_v3(), normal_tri_v3(), normalize_qt(), rotation_between_vecs_to_quat(), and sqrtf.
Referenced by M_Geometry_barycentric_transform().
static int 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] | ||
) | [static] |
Definition at line 1731 of file math_geom.c.
References axis_dominant_v3(), fabsf, i, and tri_signed_area().
Referenced by interp_weights_face_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 1812 of file math_geom.c.
References area_tri_signed_v2().
Referenced by barycentric_transform(), dynamicPaint_createUVSurface(), project_bucket_clip_face(), project_paint_face_init(), project_paint_occlude_ptv_clip(), rect_to_uvspace_ortho(), screen_px_from_ortho(), screen_px_from_persp(), and VecZDepthOrtho().
int box_clip_bounds_m4 | ( | float | boundbox[2][3], |
const float | bounds[4], | ||
float | winmat[4][4] | ||
) |
Definition at line 2254 of file math_geom.c.
References copy_m4_m4(), and mul_m4_v4().
void box_minmax_bounds_m4 | ( | float | min[3], |
float | max[3], | ||
float | boundbox[2][3], | ||
float | mat[4][4] | ||
) |
Definition at line 2291 of file math_geom.c.
References copy_v3_v3(), DO_MINMAX, and mul_m4_v3().
void cent_quad_v3 | ( | float | cent[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3] | ||
) |
Definition at line 47 of file math_geom.c.
Referenced by addfacelist(), edge_normal_compare(), face_duplilist(), and recalc_editnormals().
void cent_tri_v3 | ( | float | cent[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 40 of file math_geom.c.
Referenced by addfacelist(), edge_normal_compare(), EM_recalc_normal_direction(), exec_strandsurface_sample(), face_duplilist(), occ_face(), and recalc_editnormals().
int clip_line_plane | ( | float | p1[3], |
float | p2[3], | ||
const float | plane[4] | ||
) |
Definition at line 1598 of file math_geom.c.
References copy_v3_v3(), div, dot_v3v3(), madd_v3_v3v3fl(), sub_v3_v3v3(), and zero_v3().
Referenced by ED_view3d_win_to_segment_clip().
void closest_to_line_segment_v2 | ( | float | close_r[2], |
const float | p[2], | ||
const float | l1[2], | ||
const float | l2[2] | ||
) |
Definition at line 212 of file math_geom.c.
References closest_to_line_v2(), and copy_v2_v2().
void closest_to_line_segment_v3 | ( | float | close_r[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 227 of file math_geom.c.
References closest_to_line_v3(), and copy_v3_v3().
Referenced by dist_to_line_segment_v3(), heat_ray_source_visible(), heat_source_distance(), mesh_edges_nearest_point(), and sb_detect_vertex_collisionCached().
float closest_to_line_v2 | ( | float | cp[2], |
const float | p[2], | ||
const float | l1[2], | ||
const float | l2[2] | ||
) |
Definition at line 1314 of file math_geom.c.
References dot_v2v2(), and sub_v2_v2v2().
Referenced by closest_to_line_segment_v2(), dynamicPaint_findNeighbourPixel(), and project_paint_face_init().
float closest_to_line_v3 | ( | float | cp[3], |
const float | p[3], | ||
const float | l1[3], | ||
const float | l2[3] | ||
) |
Definition at line 1302 of file math_geom.c.
References dot_v3v3(), and sub_v3_v3v3().
Referenced by applyModifier(), closest_to_line_segment_v3(), ED_view3d_win_to_3d(), isect_point_quad_uv_v2(), M_Geometry_intersect_point_line(), point_in_slice(), and viewops_data_create().
void closest_to_plane_v3 | ( | float | close_r[3], |
const float | plane_co[3], | ||
const float | plane_no_unit[3], | ||
const float | pt[3] | ||
) |
Definition at line 249 of file math_geom.c.
References dot_v3v3(), and sub_v3_v3v3().
Referenced by getVerticalAndHorizontalChange().
float dist_to_line_segment_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2] | ||
) |
Definition at line 179 of file math_geom.c.
References len(), sqrt(), and sqrtf.
Referenced by dist_to_rect(), dynamicPaint_findNeighbourPixel(), edge_inside_circle(), find_nearest_tracking_segment_cb(), find_nearest_uv_edge(), findnearestedge__doClosest(), and mesh_rip_edgedist().
float dist_to_line_segment_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 284 of file math_geom.c.
References closest_to_line_segment_v3(), and len_v3v3().
float dist_to_line_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2] | ||
) |
Definition at line 165 of file math_geom.c.
Referenced by autocalchandlesNurb(), freetypechar_to_vchar(), stabilization_auto_scale_factor(), and testvertexnearedge().
float dist_to_plane_normalized_v3 | ( | const float | p[3], |
const float | plane_co[3], | ||
const float | plane_no_unit[3] | ||
) |
Definition at line 263 of file math_geom.c.
References add_v3_v3v3(), and line_point_factor_v3().
float dist_to_plane_v3 | ( | const float | p[3], |
const float | plane_co[3], | ||
const float | plane_no[3] | ||
) |
Definition at line 272 of file math_geom.c.
References add_v3_v3v3(), line_point_factor_v3(), and normalize_v3_v3().
Referenced by camera_to_frame_view_cb(), and M_Geometry_distance_point_to_plane().
static void ff_normalize | ( | float | n[3] | ) | [static] |
Definition at line 2976 of file math_geom.c.
References simple_enum_gen::d, dot_v3v3(), credits_svn_gen::e, F, and sqrtf.
Referenced by ff_quad_form_factor().
static float ff_quad_form_factor | ( | const float | p[3], |
const float | n[3], | ||
const float | q0[3], | ||
const float | q1[3], | ||
const float | q2[3], | ||
const float | q3[3] | ||
) | [static] |
Definition at line 2991 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), ff_normalize(), M_PI, MAX2, saacosf(), and sub_v3_v3v3().
Referenced by form_factor_hemi_poly().
static int ff_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] |
Definition at line 2632 of file math_geom.c.
References copy_v3_v3(), dot_v3v3(), credits_svn_gen::e, KDL::epsilon, fabsf, and vec_add_dir().
Referenced by form_factor_hemi_poly().
float* find_vertex_tangent | ( | VertexTangent * | vtang, |
const float | uv[2] | ||
) |
Definition at line 2419 of file math_geom.c.
References fabsf, VertexTangent::next, STD_UV_CONNECT_LIMIT, VertexTangent::tang, and VertexTangent::uv.
Referenced by calc_vertexnormals(), and DM_add_tangent_layer().
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 3027 of file math_geom.c.
References ff_quad_form_factor(), and ff_visible_quad().
static int getLowestRoot | ( | const float | a, |
const float | b, | ||
const float | c, | ||
const float | maxR, | ||
float * | root | ||
) | [static] |
Definition at line 892 of file math_geom.c.
References determinant(), sqrt(), and SWAP.
Referenced by isect_sweeping_sphere_tri_v3().
static void i_multmatrix | ( | float | icand[][4], |
float | Vm[][4] | ||
) | [static] |
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 | ||
) |
Definition at line 2006 of file math_geom.c.
Referenced by psys_interpolate_particle().
int interp_sparse_array | ( | float * | array, |
int const | list_size, | ||
const float | skipval | ||
) |
Definition at line 1882 of file math_geom.c.
References i, MEM_callocN(), and MEM_freeN().
Referenced by gp_stroke_newfrombuffer().
void interp_weights_face_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 1758 of file math_geom.c.
References barycentric_weights(), cross_v3_v3v3(), equals_v3v3(), sub_v3_v3v3(), and SWAP.
Referenced by calculate_speedvectors(), dynamicPaint_paintMesh(), facecopy(), InterpCSGFace(), and sample_occ_surface().
void interp_weights_poly_v3 | ( | float * | w, |
float | v[][3], | ||
const int | n, | ||
const float | co[3] | ||
) |
Definition at line 1980 of file math_geom.c.
References i, len(), len_v3v3(), and mean_value_half_tan().
int isect_aabb_aabb_v3 | ( | const float | min1[3], |
const float | max1[3], | ||
const float | min2[3], | ||
const float | max2[3] | ||
) |
Definition at line 1293 of file math_geom.c.
Referenced by particle_intersect_dm().
int isect_axial_line_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 | ||
) |
* first a simple bounding box test */
* then a full intersection test */
Definition at line 1129 of file math_geom.c.
References p, and sub_v3_v3v3().
Referenced by distribute_grid().
int 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 | ||
) |
Definition at line 1243 of file math_geom.c.
References add_v3_v3v3(), cross_v3_v3v3(), simple_enum_gen::d, dot_v3v3(), mul_v3_fl(), normalize_v3_v3(), and sub_v3_v3v3().
Referenced by sk_getIntersections(), and sk_getSelfIntersections().
int isect_line_line_v2 | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2] | ||
) |
Definition at line 315 of file math_geom.c.
References div, ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, and ISECT_LINE_LINE_NONE.
Referenced by convex(), cut_links_intersect(), and project_bucket_face_isect().
int isect_line_line_v2_int | ( | const int | v1[2], |
const int | v2[2], | ||
const int | v3[2], | ||
const int | v4[2] | ||
) |
Definition at line 296 of file math_geom.c.
References div, ISECT_LINE_LINE_COLINEAR, ISECT_LINE_LINE_CROSS, ISECT_LINE_LINE_EXACT, and ISECT_LINE_LINE_NONE.
Referenced by lasso_inside_edge().
int isect_line_line_v3 | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const float | v4[3], | ||
float | i1[3], | ||
float | i2[3] | ||
) |
Definition at line 1179 of file math_geom.c.
References add_v3_v3v3(), copy_v3_v3(), cross_v3_v3v3(), simple_enum_gen::d, dot_v3v3(), mul_v3_fl(), normalize_v3_v3(), project_v3_v3v3(), and sub_v3_v3v3().
Referenced by axisProjection(), camera_view_frame_fit_to_scene(), M_Geometry_intersect_line_line(), sk_getIntersections(), and snapEdge().
int isect_line_plane_v3 | ( | float | out[3], |
const float | l1[3], | ||
const float | l2[3], | ||
const float | plane_co[3], | ||
const float | plane_no[3], | ||
const short | no_flip | ||
) |
Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
out | 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). |
no_flip | When true, the intersection point will always be from l1 to l2, even if this is not on the plane. |
Definition at line 834 of file math_geom.c.
References add_v3_v3v3(), dot(), dot_v3v3(), line_point_factor_v3(), mul_v3_fl(), negate_v3(), normalize_v3(), normalize_v3_v3(), and sub_v3_v3v3().
Referenced by ED_view3d_win_to_3d(), isect_plane_plane_v3(), and M_Geometry_intersect_line_plane().
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 480 of file math_geom.c.
References dot_v2v2(), i, madd_v2_v2v2fl(), and sqrt().
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], | ||
const float | r, | ||
float | r_p1[3], | ||
float | r_p2[3] | ||
) |
Definition at line 406 of file math_geom.c.
References dot_v3v3(), i, madd_v3_v3v3fl(), and sqrt().
Referenced by M_Geometry_intersect_line_sphere().
int isect_line_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] | ||
) |
Definition at line 635 of file math_geom.c.
References cross_v3_v3v3(), simple_enum_gen::d, dot_v3v3(), p, and sub_v3_v3v3().
Referenced by distribute_threads_exec(), isect_point_face_uv_v2(), particle_intersect_dm(), sb_detect_edge_collisionCached(), and sb_detect_face_collisionCached().
void isect_plane_plane_v3 | ( | float | r_isect_co[3], |
float | r_isect_no[3], | ||
const float | plane_a_co[3], | ||
const float | plane_a_no[3], | ||
const float | plane_b_co[3], | ||
const float | plane_b_no[3] | ||
) |
Intersect two planes, return a point on the intersection and a vector that runs on the direction of the intersection. Return error code is the same as 'isect_line_line_v3'.
r_isect_co | The resulting intersection point. |
r_isect_no | The resulting vector of the intersection. |
plane_a_co | The point on the first plane. |
plane_a_no | The normal of the first plane. |
plane_b_co | The point on the second plane. |
plane_b_no | The normal of the second plane. |
Definition at line 878 of file math_geom.c.
References add_v3_v3(), cross_v3_v3v3(), FALSE, and isect_line_plane_v3().
Referenced by camera_view_frame_fit_to_scene(), and M_Geometry_intersect_plane_plane().
void isect_point_face_uv_v2 | ( | const int | isquad, |
const float | v0[2], | ||
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
const float | pt[2], | ||
float | r_uv[2] | ||
) |
Definition at line 1437 of file math_geom.c.
References copy_v2_v2(), isect_line_tri_v3(), and isect_point_quad_uv_v2().
void isect_point_quad_uv_v2 | ( | const float | v0[2], |
const float | v1[2], | ||
const float | v2[2], | ||
const float | v3[2], | ||
const float | pt[2], | ||
float | r_uv[2] | ||
) |
Definition at line 1343 of file math_geom.c.
References closest_to_line_v3(), IsectLLPt2Df(), and len_v2().
Referenced by isect_point_face_uv_v2().
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] | ||
) |
Definition at line 608 of file math_geom.c.
References line_point_side_v2().
Referenced by M_Geometry_intersect_point_quad_2d(), project_bucket_face_isect(), project_paint_face_init(), and psys_particle_dm_face_lookup().
int isect_point_tri_prism_v3 | ( | const float | p[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 1590 of file math_geom.c.
References point_in_slice().
Referenced by 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 589 of file math_geom.c.
References line_point_side_v2().
Referenced by isect_point_tri_v2_int(), M_Geometry_intersect_point_tri_2d(), project_bucket_face_isect(), project_paint_occlude_ptv(), project_paint_PickFace(), psys_particle_dm_face_lookup(), and ui_mouse_motion_towards_check().
int isect_point_tri_v2_int | ( | const int | x1, |
const int | y1, | ||
const int | x2, | ||
const int | y2, | ||
const int | a, | ||
const int | b | ||
) |
Definition at line 1523 of file math_geom.c.
References isect_point_tri_v2(), and p.
int isect_ray_plane_v3 | ( | const float | p1[3], |
const float | d[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
const int | clip | ||
) |
Definition at line 714 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), p, and sub_v3_v3v3().
Referenced by cloth_collision().
int isect_ray_tri_epsilon_v3 | ( | const float | p1[3], |
const float | d[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | uv[2], | ||
const float | epsilon | ||
) |
Definition at line 746 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), p, and sub_v3_v3v3().
Referenced by bvhtree_ray_tri_intersection(), and ray_face_intersection().
int isect_ray_tri_threshold_v3 | ( | const float | p1[3], |
const float | d[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2], | ||
const float | threshold | ||
) |
Definition at line 782 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), mul_v3_fl(), p, and sub_v3_v3v3().
Referenced by peelDerivedMesh().
int isect_ray_tri_v3 | ( | const float | p1[3], |
const float | d[3], | ||
const float | v0[3], | ||
const float | v1[3], | ||
const float | v2[3], | ||
float * | r_lambda, | ||
float | r_uv[2] | ||
) |
Definition at line 676 of file math_geom.c.
References cross_v3_v3v3(), dot_v3v3(), p, and sub_v3_v3v3().
Referenced by bvh_callback(), and ray_hit_boundbox().
int isect_seg_seg_v2_point | ( | const float | v1[2], |
const float | v2[2], | ||
const float | v3[2], | ||
const float | v4[2], | ||
float | vi[2] | ||
) |
Definition at line 336 of file math_geom.c.
References copy_v2_v2(), simple_enum_gen::d, dot_v2v2(), eps, equals_v2v2(), interp_v2_v2v2(), len_v2v2(), maxf(), minf(), sub_v2_v2v2(), and SWAP.
Referenced by M_Geometry_intersect_line_line_2d(), and mdisp_rot_crn_to_face().
int 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 929 of file math_geom.c.
References add_v3_v3(), CLAMP(), copy_v3_v3(), cross_v3_v3v3(), simple_enum_gen::d, dot_v3v3(), credits_svn_gen::e, fabsf, getLowestRoot(), mul_v3_fl(), negate_v3(), normalize_v3(), sub_v3_v3v3(), and SWAP.
Referenced by particle_intersect_dm(), and sphereray_tri_intersection().
static short IsectLLPt2Df | ( | const float | x0, |
const float | y0, | ||
const float | x1, | ||
const float | y1, | ||
const float | x2, | ||
const float | y2, | ||
const float | x3, | ||
const float | y3, | ||
float * | xi, | ||
float * | yi | ||
) | [static] |
Definition at line 538 of file math_geom.c.
References fabs().
Referenced by isect_point_quad_uv_v2().
float line_point_factor_v2 | ( | const float | p[2], |
const float | l1[2], | ||
const float | l2[2] | ||
) |
Definition at line 1334 of file math_geom.c.
References dot_v2v2(), and sub_v2_v2v2().
Referenced by M_Geometry_intersect_line_sphere_2d(), and project_paint_face_init().
float line_point_factor_v3 | ( | const float | p[3], |
const float | l1[3], | ||
const float | l2[3] | ||
) |
Definition at line 1326 of file math_geom.c.
References dot_v3v3(), and sub_v3_v3v3().
Referenced by dist_to_plane_normalized_v3(), dist_to_plane_v3(), isect_line_plane_v3(), and M_Geometry_intersect_line_sphere().
void lookat_m4 | ( | float | mat[][4], |
float | vx, | ||
float | vy, | ||
float | vz, | ||
float | px, | ||
float | py, | ||
float | pz, | ||
float | twist | ||
) |
Definition at line 2204 of file math_geom.c.
References i_multmatrix(), MAT4_UNITY, rotate_m4(), sqrt(), translate_m4(), and unit_m4().
void map_to_sphere | ( | float * | u, |
float * | v, | ||
const float | x, | ||
const float | y, | ||
const float | z | ||
) |
Definition at line 2327 of file math_geom.c.
References atan2f, len(), M_PI, saacos(), and sqrt().
Referenced by calc_tangent_vector(), DM_add_tangent_layer(), do_2d_mapping(), do_sky_tex(), GetTextureCoordinate(), psys_interpolate_face(), and uv_sphere_project().
void map_to_tube | ( | float * | u, |
float * | v, | ||
const float | x, | ||
const float | y, | ||
const float | z | ||
) |
Definition at line 2314 of file math_geom.c.
References KDL::atan2(), len(), M_PI, and sqrt().
Referenced by do_2d_mapping(), do_sky_tex(), and uv_cylinder_project().
static float mean_value_half_tan | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3] | ||
) | [static] |
Definition at line 1962 of file math_geom.c.
References cross(), cross_v3_v3v3(), dot(), dot_v3v3(), len(), len_v3(), and sub_v3_v3v3().
Referenced by interp_weights_poly_v3().
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 71 of file math_geom.c.
References normalize_v3().
Referenced by addfacelist(), addnormalsDispList(), applyModifier(), autosmooth(), BL_ConvertMesh(), cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesGLSL(), cdDM_drawMappedFacesMat(), cdDM_foreachMappedFaceCenter(), GeometryExporter::create_normals(), displace_render_face(), dl_surf_to_renderdata(), DM_add_tangent_layer(), dm_calc_normal(), editmesh_get_derived(), exec_strandsurface_sample(), flipface(), GetNormal(), GPU_buffer_copy_normal(), GPU_update_grid_buffers(), ImageRender::ImageRender(), init_render_curve(), init_render_dm(), init_render_mesh(), M_Geometry_normal(), mesh_calc_normals(), multiresbake_get_normal(), multiresModifier_base_apply(), particle_billboard(), pbvh_update_normals(), peelDerivedMesh(), psys_interpolate_face(), recalc_editnormals(), smoothmesh_from_derivedmesh(), static_particle_strand(), and uvprojectModifier_do().
float normal_tri_v3 | ( | float | n[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | v3[3] | ||
) |
Definition at line 54 of file math_geom.c.
References normalize_v3().
Referenced by addfacelist(), applyModifier(), autosmooth(), barycentric_transform(), BL_ConvertMesh(), BLI_edgefill(), bvh_callback(), calc_clipping_plane(), camera_view_frame_fit_to_scene(), cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesGLSL(), cdDM_drawMappedFacesMat(), cdDM_foreachMappedFaceCenter(), check_non_flat_quads(), cloth_collision(), convex(), GeometryExporter::create_normals(), cube_project_exec(), cubemap(), displace_render_face(), DM_add_tangent_layer(), dm_calc_normal(), draw_mesh_text(), dynamicPaint_paintMesh(), ED_view3d_calc_clipping(), editmesh_get_derived(), EM_recalc_normal_direction(), exec_strandsurface_sample(), face_in_node(), flipface(), GetNormal(), GPU_buffer_copy_normal(), heat_calc_vnormals(), ImageRender::ImageRender(), init_render_curve(), init_render_dm(), init_render_mball(), init_render_mesh(), M_Geometry_normal(), measure_facepair(), mesh_calc_normals(), mesh_faces_nearest_point(), mesh_faces_spherecast(), meshdeform_intersect(), multiresbake_get_normal(), multiresModifier_base_apply(), pbvh_update_normals(), peelDerivedMesh(), psys_interpolate_face(), RE_sample_material_color(), recalc_editnormals(), smoothmesh_from_derivedmesh(), sphereray_tri_intersection(), split_quads(), tri_to_quat(), triatomat(), uvprojectModifier_do(), and view3d_boxview_clip().
void orthographic_m4 | ( | float | matrix[][4], |
const float | left, | ||
const float | right, | ||
const float | bottom, | ||
const float | top, | ||
const float | nearClip, | ||
const float | farClip | ||
) |
Definition at line 2106 of file math_geom.c.
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 | ||
) |
Definition at line 2125 of file math_geom.c.
References left().
Referenced by BKE_tracking_projection_matrix(), camera_params_compute_matrix(), gpu_lamp_from_blender(), makeshadowbuf(), RE_SetWindow(), screen_opengl_render_apply(), and uvprojectModifier_do().
void plot_line_v2v2i | ( | const int | p1[2], |
const int | p2[2], | ||
int(*)(int, int, void *) | callback, | ||
void * | userData | ||
) |
Definition at line 1648 of file math_geom.c.
References error().
Referenced by ED_view3d_autodist_depth_seg().
static int point_in_slice | ( | const float | p[3], |
const float | v1[3], | ||
const float | l1[3], | ||
const float | l2[3] | ||
) | [static] |
Definition at line 1542 of file math_geom.c.
References closest_to_line_v3(), dot_v3v3(), and sub_v3_v3v3().
Referenced by isect_point_tri_prism_v3().
void polarview_m4 | ( | float | Vm[][4], |
float | dist, | ||
float | azimuth, | ||
float | incidence, | ||
float | twist | ||
) |
Definition at line 2193 of file math_geom.c.
References rotate_m4(), translate_m4(), and unit_m4().
void resolve_quad_uv | ( | float | r_uv[2], |
const float | st[2], | ||
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2], | ||
const float | st3[2] | ||
) |
Definition at line 2053 of file math_geom.c.
References fabs(), i, IS_ZERO, sqrt(), and zero_v2().
Referenced by apply_heights_callback(), and apply_tangmat_callback().
void resolve_tri_uv | ( | float | r_uv[2], |
const float | st[2], | ||
const float | st0[2], | ||
const float | st1[2], | ||
const float | st2[2] | ||
) |
Definition at line 2035 of file math_geom.c.
References simple_enum_gen::d, IS_ZERO, and zero_v2().
Referenced by apply_heights_callback(), apply_tangmat_callback(), and flush_pixel().
void sum_or_add_vertex_tangent | ( | void * | arena, |
VertexTangent ** | vtang, | ||
const float | tang[3], | ||
const float | uv[2] | ||
) |
Definition at line 2396 of file math_geom.c.
References add_v3_v3(), BLI_memarena_alloc(), copy_v3_v3(), fabsf, VertexTangent::next, STD_UV_CONNECT_LIMIT, VertexTangent::tang, and VertexTangent::uv.
Referenced by calc_tangent_vector(), and DM_add_tangent_layer().
void tangent_from_uv | ( | float | uv1[2], |
float | uv2[2], | ||
float | uv3[3], | ||
float | co1[3], | ||
float | co2[3], | ||
float | co3[3], | ||
float | n[3], | ||
float | tang[3] | ||
) |
Definition at line 2431 of file math_geom.c.
References cross_v3_v3v3(), negate_v3(), and sub_v3_v3v3().
static float tri_signed_area | ( | const float | v1[3], |
const float | v2[3], | ||
const float | v3[3], | ||
const int | i, | ||
const int | j | ||
) | [static] |
void vcloud_estimate_transform | ( | int | list_size, |
float(*) | pos[3], | ||
float * | weight, | ||
float(*) | rpos[3], | ||
float * | rweight, | ||
float | lloc[3], | ||
float | rloc[3], | ||
float | lrot[3][3], | ||
float | lscale[3][3] | ||
) |
Definition at line 2502 of file math_geom.c.
References _det_m3(), add_m3_m3m3(), add_v3_v3(), copy_m3_m3(), copy_v3_v3(), eps, i, invert_m3_m3(), len_v3(), mul_m3_fl(), mul_m3_m3m3(), mul_v3_fl(), sub_v3_v3v3(), transpose_m3(), unit_m3(), zero_m3(), and zero_v3().
Referenced by SB_estimate_transform().
static void vec_add_dir | ( | float | r[3], |
const float | v1[3], | ||
const float | v2[3], | ||
const float | fac | ||
) | [static] |
Definition at line 2625 of file math_geom.c.
Referenced by ff_visible_quad().
void window_translate_m4 | ( | float | winmat[][4], |
float | perspmat[][4], | ||
const float | x, | ||
const float | y | ||
) |
Definition at line 2150 of file math_geom.c.
References len_v3().
Referenced by screen_opengl_render_apply().