Blender  V2.59
Functions
math_matrix.c File Reference
#include <assert.h>
#include "BLI_math.h"

Go to the source code of this file.

Functions

void zero_m3 (float m[3][3])
void zero_m4 (float m[4][4])
void unit_m3 (float m[][3])
void unit_m4 (float m[][4])
void copy_m3_m3 (float m1[][3], float m2[][3])
void copy_m4_m4 (float m1[][4], float m2[][4])
void copy_m3_m4 (float m1[][3], float m2[][4])
void copy_m4_m3 (float m1[][4], float m2[][3])
void swap_m3m3 (float m1[][3], float m2[][3])
void swap_m4m4 (float m1[][4], float m2[][4])
void mul_m4_m4m4 (float m1[][4], float m2_[][4], float m3_[][4])
void mul_m3_m3m3 (float m1[][3], float m3_[][3], float m2_[][3])
void mul_m4_m4m3 (float(*m1)[4], float(*m3)[4], float(*m2)[3])
void mul_m3_m3m4 (float m1[][3], float m2[][3], float m3[][4])
void mul_m4_m3m4 (float(*m1)[4], float(*m3)[3], float(*m2)[4])
void mul_serie_m3 (float answ[][3], float m1[][3], float m2[][3], float m3[][3], float m4[][3], float m5[][3], float m6[][3], float m7[][3], float m8[][3])
void mul_serie_m4 (float answ[][4], float m1[][4], float m2[][4], float m3[][4], float m4[][4], float m5[][4], float m6[][4], float m7[][4], float m8[][4])
void mul_m4_v3 (float mat[][4], float *vec)
void mul_v3_m4v3 (float *in, float mat[][4], float *vec)
void mul_mat3_m4_v3 (float mat[][4], float *vec)
void mul_project_m4_v3 (float mat[][4], float vec[3])
void mul_v4_m4v4 (float r[4], float mat[4][4], float v[4])
void mul_m4_v4 (float mat[4][4], float r[4])
void mul_v3_m3v3 (float r[3], float M[3][3], float a[3])
void mul_m3_v3 (float M[3][3], float r[3])
void mul_transposed_m3_v3 (float mat[][3], float *vec)
void mul_m3_fl (float m[3][3], float f)
void mul_m4_fl (float m[4][4], float f)
void mul_mat3_m4_fl (float m[4][4], float f)
void mul_m3_v3_double (float mat[][3], double *vec)
void add_m3_m3m3 (float m1[][3], float m2[][3], float m3[][3])
void add_m4_m4m4 (float m1[][4], float m2[][4], float m3[][4])
int invert_m3 (float m[3][3])
int invert_m3_m3 (float m1[3][3], float m2[3][3])
int invert_m4 (float m[4][4])
int invert_m4_m4 (float inverse[4][4], float mat[4][4])
void transpose_m3 (float mat[][3])
void transpose_m4 (float mat[][4])
void orthogonalize_m3 (float mat[][3], int axis)
void orthogonalize_m4 (float mat[][4], int axis)
int is_orthogonal_m3 (float mat[][3])
int is_orthogonal_m4 (float mat[][4])
void normalize_m3 (float mat[][3])
void normalize_m3_m3 (float rmat[][3], float mat[][3])
void normalize_m4 (float mat[][4])
void normalize_m4_m4 (float rmat[][4], float mat[][4])
void adjoint_m3_m3 (float m1[][3], float m[][3])
void adjoint_m4_m4 (float out[][4], float in[][4])
float determinant_m2 (float a, float b, float c, float d)
float determinant_m3 (float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
float determinant_m4 (float m[][4])
void size_to_mat3 (float mat[][3], const float size[3])
void size_to_mat4 (float mat[][4], const float size[3])
void mat3_to_size (float *size, float mat[][3])
void mat4_to_size (float *size, float mat[][4])
float mat3_to_scale (float mat[][3])
float mat4_to_scale (float mat[][4])
void mat3_to_rot_size (float rot[3][3], float size[3], float mat3[3][3])
void mat4_to_loc_rot_size (float loc[3], float rot[3][3], float size[3], float wmat[][4])
void scale_m3_fl (float m[][3], float scale)
void scale_m4_fl (float m[][4], float scale)
void translate_m4 (float mat[][4], float Tx, float Ty, float Tz)
void rotate_m4 (float mat[][4], const char axis, const float angle)
void blend_m3_m3m3 (float out[][3], float dst[][3], float src[][3], const float srcweight)
void blend_m4_m4m4 (float out[][4], float dst[][4], float src[][4], const float srcweight)
int is_negative_m3 (float mat[][3])
int is_negative_m4 (float mat[][4])
void loc_eul_size_to_mat4 (float mat[4][4], const float loc[3], const float eul[3], const float size[3])
void loc_eulO_size_to_mat4 (float mat[4][4], const float loc[3], const float eul[3], const float size[3], const short rotOrder)
void loc_quat_size_to_mat4 (float mat[4][4], const float loc[3], const float quat[4], const float size[3])
void loc_axisangle_size_to_mat4 (float mat[4][4], const float loc[3], const float axis[3], const float angle, const float size[3])
void print_m3 (const char *str, float m[][3])
void print_m4 (const char *str, float m[][4])
void svd_m4 (float U[4][4], float s[4], float V[4][4], float A_[4][4])
void pseudoinverse_m4_m4 (float Ainv[4][4], float A[4][4], float epsilon)

Detailed Description

Definition in file math_matrix.c.


Function Documentation

void add_m3_m3m3 ( float  m1[][3],
float  m2[][3],
float  m3[][3] 
)

Definition at line 436 of file math_matrix.c.

References i.

void add_m4_m4m4 ( float  m1[][4],
float  m2[][4],
float  m3[][4] 
)

Definition at line 445 of file math_matrix.c.

References i.

void adjoint_m3_m3 ( float  m1[][3],
float  m[][3] 
)

Definition at line 826 of file math_matrix.c.

void adjoint_m4_m4 ( float  out[][4],
float  in[][4] 
)

Definition at line 841 of file math_matrix.c.

References determinant_m3().

void blend_m3_m3m3 ( float  out[][3],
float  dst[][3],
float  src[][3],
const float  srcweight 
)
void blend_m4_m4m4 ( float  out[][4],
float  dst[][4],
float  src[][4],
const float  srcweight 
)
void copy_m3_m3 ( float  m1[][3],
float  m2[][3] 
)

Definition at line 65 of file math_matrix.c.

void copy_m3_m4 ( float  m1[][3],
float  m2[][4] 
)

Definition at line 76 of file math_matrix.c.

void copy_m4_m3 ( float  m1[][4],
float  m2[][3] 
)

Definition at line 91 of file math_matrix.c.

void copy_m4_m4 ( float  m1[][4],
float  m2[][4] 
)

Definition at line 71 of file math_matrix.c.

float determinant_m2 ( float  a,
float  b,
float  c,
float  d 
)

Definition at line 888 of file math_matrix.c.

Referenced by determinant_m3(), and matrix_determinant_internal().

float determinant_m3 ( float  a1,
float  a2,
float  a3,
float  b1,
float  b2,
float  b3,
float  c1,
float  c2,
float  c3 
)
float determinant_m4 ( float  m[][4])

Definition at line 907 of file math_matrix.c.

References determinant_m3().

int invert_m3 ( float  m[3][3])
int invert_m3_m3 ( float  m1[3][3],
float  m2[3][3] 
)
int invert_m4 ( float  m[4][4])
int invert_m4_m4 ( float  inverse[4][4],
float  mat[4][4] 
)

Definition at line 511 of file math_matrix.c.

References fabs(), fabsf, i, max, and SWAP.

Referenced by add_hook_object(), TransformWriter::add_node_transform(), TransformWriter::add_node_transform_ob(), add_object_to_effectors(), add_primitive_bone(), add_render_lamp(), addvert_Nurb(), apply_targetless_ik(), applyarmature_fix_boneparents(), applyModifier(), applyProject(), armature_bone_primitive_add_exec(), armature_deform_verts(), armature_fill_bones_exec(), armature_mat_pose_to_bone(), armature_mat_pose_to_delta(), armature_mat_world_to_pose(), arrayModifier_doArray(), assign_dupligroup_dupli(), b_bone_spline_setup(), base_callback(), bc_set_parent(), BKE_text_to_curve(), brush_add(), brush_edit_apply(), brush_puff(), calc_local_clipping(), childof_set_inverse_exec(), clipMirrorModifier(), cloth_to_object(), connect_hair(), constraint_mat_convertspace(), constraints_clear_evalob(), convert_pose(), convert_tree(), createTransParticleVerts(), cuboid_do(), database_fromscene_vectors(), database_init_objects(), deformVerts(), do_clay_tubes_brush(), docenter_armature(), dof_camera(), doMirrorOnAxis(), draw_depth(), draw_depth_gpencil(), draw_ebones(), draw_forcefield(), draw_motion_path_instance(), draw_new_particle_system(), draw_object(), draw_pose_bones(), drawmball(), drawPropCircle(), drawSnapping(), dupli_extrude_cursor(), ED_view3d_camera_lock_sync(), ED_view3d_draw_offscreen_imbuf_simple(), ED_view3d_from_m4(), em_snap_to_cursor(), env_rotate_scene(), env_set_imats(), execute_posetree(), explodeMesh(), extrudeflag_edge(), extrudeflag_vert(), find_dupli_instances(), fluidsimBake(), flushTransParticles(), foreach_mouse_hit_key(), get_texture_coords(), GPU_lamp_shadow_buffer_bind(), GPU_lamp_update(), GPU_material_bind_uniforms(), gpu_update_lamps_shadows(), ignore_parent_tx(), init_curve_deform(), init_latt_deform(), init_meta(), init_render_curve(), init_render_mball(), init_render_mesh(), init_render_object(), init_render_surf(), initshadowbuf(), invert_m4(), join_armature_exec(), join_curve_exec(), join_mesh_exec(), SkinInfo::link_armature(), load_fluidsimspeedvectors(), make_dmats(), make_envmaps(), mat4_to_dquat(), meshdeformModifier_do(), minmax_evaluate(), move_camera(), NewBooleanDerivedMesh_intern(), object_apply_mat4(), object_handle_update(), object_hook_reset_exec(), object_origin_set_exec(), obmat_to_viewmat(), parent_set_exec(), particle_system_update(), pchan_b_bone_defmats(), pe_deflect_emitter(), PE_mirror_particle(), peelDerivedMesh(), pointdensity_cache_psys(), project_paint_begin(), psys_apply_hair_lattice(), RE_Database_Baking(), RE_Database_FromScene(), RE_make_stars(), RE_make_sticky(), RE_rayobject_instance_create(), RE_SetView(), render_envmap(), render_new_particle_system(), AnimationExporter::sample_animation(), save_hair(), sculpt_stroke_get_location(), sculpt_update_brush_delta(), set_dupli_tex_mat(), SimpleDeformModifier_do(), sk_convertStroke(), sk_retargetStroke(), snap_sel_to_curs(), snapArmature(), snapDerivedMesh(), softbody_to_object(), sort_faces_exec(), space_transform_from_matrixs(), sphere_do(), spin_exec(), AnimationImporter::translate_animation(), uvprojectModifier_do(), v3d_editvertex_buts(), vertex_parent_set_exec(), view3d_main_area_setup_view(), vpaint_stroke_test_start(), warpModifier_do(), wavemod_get_texture_coords(), waveModifier_do(), where_is_pose(), and wpaint_stroke_test_start().

int is_negative_m3 ( float  mat[][3])

Definition at line 1150 of file math_matrix.c.

References cross_v3_v3v3(), and dot_v3v3().

int is_negative_m4 ( float  mat[][4])

Definition at line 1157 of file math_matrix.c.

References cross_v3_v3v3(), and dot_v3v3().

int is_orthogonal_m3 ( float  mat[][3])

Definition at line 759 of file math_matrix.c.

References dot_v3v3(), and fabsf.

int is_orthogonal_m4 ( float  mat[][4])

Definition at line 773 of file math_matrix.c.

References dot_v3v3(), and fabsf.

void loc_axisangle_size_to_mat4 ( float  mat[4][4],
const float  loc[3],
const float  axis[3],
const float  angle,
const float  size[3] 
)

Definition at line 1235 of file math_matrix.c.

References axis_angle_to_quat(), and loc_quat_size_to_mat4().

void loc_eul_size_to_mat4 ( float  mat[4][4],
const float  loc[3],
const float  eul[3],
const float  size[3] 
)
void loc_eulO_size_to_mat4 ( float  mat[4][4],
const float  loc[3],
const float  eul[3],
const float  size[3],
const short  rotOrder 
)
void loc_quat_size_to_mat4 ( float  mat[4][4],
const float  loc[3],
const float  quat[4],
const float  size[3] 
)
void mat3_to_rot_size ( float  rot[3][3],
float  size[3],
float  mat3[3][3] 
)
float mat3_to_scale ( float  mat[][3])

Definition at line 981 of file math_matrix.c.

References len_v3(), and mul_m3_v3().

void mat3_to_size ( float *  size,
float  mat[][3] 
)

Definition at line 964 of file math_matrix.c.

References len_v3().

void mat4_to_loc_rot_size ( float  loc[3],
float  rot[3][3],
float  size[3],
float  wmat[][4] 
)
float mat4_to_scale ( float  mat[][4])

Definition at line 989 of file math_matrix.c.

References copy_m3_m4(), and mat3_to_scale().

void mat4_to_size ( float *  size,
float  mat[][4] 
)

Definition at line 971 of file math_matrix.c.

References len_v3().

void mul_m3_fl ( float  m[3][3],
float  f 
)
void mul_m3_m3m3 ( float  m1[][3],
float  m3_[][3],
float  m2_[][3] 
)

Definition at line 178 of file math_matrix.c.

References copy_m3_m3().

void mul_m3_m3m4 ( float  m1[][3],
float  m2[][3],
float  m3[][4] 
)

Definition at line 214 of file math_matrix.c.

void mul_m3_v3 ( float  M[3][3],
float  r[3] 
)

Definition at line 379 of file math_matrix.c.

References copy_v3_v3(), and mul_v3_m3v3().

Referenced by add_render_lamp(), apply_objects_internal(), applyAxisConstraintVec(), applyObjectConstraintVec(), applyProject(), applyTranslation(), area_lamp_energy_multisample(), armature_calc_roll_exec(), armature_click_extrude_exec(), bake_set_vlr_dxyco(), bake_shade(), calculateCenterCursor(), connectivity_edge(), contarget_get_mesh_mat(), displace_render_vert(), do_lamp_tex(), drawlamp(), ED_armature_from_edit(), ED_object_new_primitive_matrix(), ED_view3d_from_m4(), ElementResize(), ElementRotation(), env_rotate_scene(), envmaptex(), execute_posetree(), extrude_repeat_mesh_exec(), flyApply(), flyEnd(), getTransformOrientation(), ImageRender::ImageRender(), imapaint_tri_weights(), initFlyInfo(), initWarp(), lamp_get_visibility(), mat3_to_quat_is_ok(), mat3_to_scale(), meshdeformModifier_do(), minmax_verts(), mul_v3m3_dq(), multires_apply_smat(), ntap_bump_compute(), ob_draw_RE_motion(), object_hook_recenter_exec(), object_origin_clear_exec(), occ_face(), peelDerivedMesh(), pivotcon_evaluate(), postConstraintChecks(), project_paint_begin(), psys_get_dupli_path_transform(), ray_shadow_jitter(), ray_shadow_qmc(), RE_vlakren_get_normal(), render_lighting_halo(), render_new_particle_system(), ResizeBetween(), rotateflag(), rotateflagNurb(), RotationBetween(), sculpt_flush_pbvhvert_deform(), set_prop_dist(), setBoneRollFromNormal(), shade_input_set_shade_texco(), shade_input_set_triangle_i(), shadeSkyView(), shadeSunView(), Shear(), sk_pointToNode(), sk_strokeToArc(), snap_curs_to_sel(), snap_sel_to_curs(), snap_sel_to_grid(), snapDerivedMesh(), snapEdge(), snapVertex(), spin_mesh(), spothalo(), spotvolume(), tri_to_quat(), Vector_rotate(), viewops_data_create(), viewrotate_apply(), and Warp().

void mul_m3_v3_double ( float  mat[][3],
double *  vec 
)

Definition at line 425 of file math_matrix.c.

void mul_m4_fl ( float  m[4][4],
float  f 
)

Definition at line 407 of file math_matrix.c.

References i.

Referenced by add_weighted_dq_dq(), normalize_dq(), and sculpt_get_redraw_planes().

void mul_m4_m3m4 ( float(*)  m1[4],
float(*)  m3[3],
float(*)  m2[4] 
)

Definition at line 230 of file math_matrix.c.

void mul_m4_m4m3 ( float(*)  m1[4],
float(*)  m3[4],
float(*)  m2[3] 
)

Definition at line 200 of file math_matrix.c.

void mul_m4_m4m4 ( float  m1[][4],
float  m2_[][4],
float  m3_[][4] 
)

Definition at line 147 of file math_matrix.c.

References copy_m4_m4().

void mul_m4_v3 ( float  mat[][4],
float *  vec 
)

Definition at line 309 of file math_matrix.c.

void mul_m4_v4 ( float  mat[4][4],
float  r[4] 
)
void mul_mat3_m4_fl ( float  m[4][4],
float  f 
)
void mul_mat3_m4_v3 ( float  mat[][4],
float *  vec 
)

Definition at line 332 of file math_matrix.c.

void mul_project_m4_v3 ( float  mat[][4],
float  vec[3] 
)

Definition at line 343 of file math_matrix.c.

References mul_m4_v3(), and simple_enum_gen::w.

void mul_serie_m3 ( float  answ[][3],
float  m1[][3],
float  m2[][3],
float  m3[][3],
float  m4[][3],
float  m5[][3],
float  m6[][3],
float  m7[][3],
float  m8[][3] 
)

Definition at line 243 of file math_matrix.c.

References copy_m3_m3(), mul_m3_m3m3(), and NULL.

void mul_serie_m4 ( float  answ[][4],
float  m1[][4],
float  m2[][4],
float  m3[][4],
float  m4[][4],
float  m5[][4],
float  m6[][4],
float  m7[][4],
float  m8[][4] 
)

Definition at line 276 of file math_matrix.c.

References copy_m4_m4(), mul_m4_m4m4(), and NULL.

void mul_transposed_m3_v3 ( float  mat[][3],
float *  vec 
)

Definition at line 387 of file math_matrix.c.

void mul_v3_m3v3 ( float  r[3],
float  M[3][3],
float  a[3] 
)
void mul_v3_m4v3 ( float *  in,
float  mat[][4],
float *  vec 
)

Definition at line 320 of file math_matrix.c.

void mul_v4_m4v4 ( float  r[4],
float  mat[4][4],
float  v[4] 
)

Definition at line 353 of file math_matrix.c.

Referenced by mul_m4_v4().

void normalize_m3 ( float  mat[][3])

Definition at line 787 of file math_matrix.c.

References normalize_v3().

void normalize_m3_m3 ( float  rmat[][3],
float  mat[][3] 
)

Definition at line 794 of file math_matrix.c.

References normalize_v3_v3().

void normalize_m4 ( float  mat[][4])

Definition at line 802 of file math_matrix.c.

References normalize_v3().

void normalize_m4_m4 ( float  rmat[][4],
float  mat[][4] 
)

Definition at line 814 of file math_matrix.c.

References normalize_v3_v3().

void orthogonalize_m3 ( float  mat[][3],
int  axis 
)

Definition at line 612 of file math_matrix.c.

References cross_v3_v3v3(), dot_v3v3(), mat3_to_size(), mul_v3_fl(), normalize_v3(), and size().

void orthogonalize_m4 ( float  mat[][4],
int  axis 
)

Definition at line 685 of file math_matrix.c.

References cross_v3_v3v3(), dot_v3v3(), mat4_to_size(), mul_v3_fl(), normalize_v3(), and size().

void print_m3 ( const char *  str,
float  m[][3] 
)

Definition at line 1244 of file math_matrix.c.

void print_m4 ( const char *  str,
float  m[][4] 
)

Definition at line 1253 of file math_matrix.c.

void pseudoinverse_m4_m4 ( float  Ainv[4][4],
float  A[4][4],
float  epsilon 
)

Definition at line 1696 of file math_matrix.c.

References i, mul_serie_m4(), NULL, svd_m4(), transpose_m4(), and zero_m4().

void rotate_m4 ( float  mat[][4],
const char  axis,
const float  angle 
)

Definition at line 1064 of file math_matrix.c.

References assert, cos(), and sin().

void scale_m3_fl ( float  m[][3],
float  scale 
)

Definition at line 1039 of file math_matrix.c.

void scale_m4_fl ( float  m[][4],
float  scale 
)

Definition at line 1047 of file math_matrix.c.

void size_to_mat3 ( float  mat[][3],
const float  size[3] 
)

Definition at line 942 of file math_matrix.c.

void size_to_mat4 ( float  mat[][4],
const float  size[3] 
)

Definition at line 955 of file math_matrix.c.

References copy_m4_m3(), size_to_mat3(), and unit_m4().

void svd_m4 ( float  U[4][4],
float  s[4],
float  V[4][4],
float  A_[4][4] 
)

Definition at line 1273 of file math_matrix.c.

References A, copy_m4_m4(), eps, fabsf, g, hypotf, i, maxf(), minf(), p, powf, pp, sqrtf, zero_m4(), and zero_v4().

Referenced by pseudoinverse_m4_m4().

void swap_m3m3 ( float  m1[][3],
float  m2[][3] 
)

Definition at line 117 of file math_matrix.c.

References i.

void swap_m4m4 ( float  m1[][4],
float  m2[][4] 
)

Definition at line 131 of file math_matrix.c.

References i.

void translate_m4 ( float  mat[][4],
float  Tx,
float  Ty,
float  Tz 
)

Definition at line 1057 of file math_matrix.c.

void transpose_m3 ( float  mat[][3])

Definition at line 571 of file math_matrix.c.

void transpose_m4 ( float  mat[][4])

Definition at line 586 of file math_matrix.c.

void unit_m3 ( float  m[][3])

Definition at line 48 of file math_matrix.c.

void unit_m4 ( float  m[][4])

Definition at line 56 of file math_matrix.c.

void zero_m3 ( float  m[3][3])

Definition at line 38 of file math_matrix.c.

Referenced by armature_deform_verts(), and vcloud_estimate_transform().

void zero_m4 ( float  m[4][4])

Definition at line 43 of file math_matrix.c.

Referenced by pseudoinverse_m4_m4(), svd_m4(), and uv_map_rotation_matrix().