Blender V2.61 - r43446
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 mult_m4_m4m4 (float m1[][4], float m3_[][4], float m2_[][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 mult_m3_m3m4 (float m1[][3], float m3[][4], float m2[][3])
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[3])
void mul_v3_m4v3 (float in[3], float mat[][4], const float vec[3])
void mul_mat3_m4_v3 (float mat[][4], float vec[3])
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[3])
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[3])
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])
void sub_m3_m3m3 (float m1[][3], float m2[][3], float m3[][3])
void sub_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[3], float mat[][3])
void mat4_to_size (float size[3], 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 440 of file math_matrix.c.

References i.

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

Definition at line 449 of file math_matrix.c.

References i.

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

Definition at line 848 of file math_matrix.c.

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

Definition at line 863 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 63 of file math_matrix.c.

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

Definition at line 74 of file math_matrix.c.

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

Definition at line 89 of file math_matrix.c.

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

Definition at line 69 of file math_matrix.c.

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

Definition at line 910 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 929 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 533 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(), AnimationImporter::apply_matrix_curves(), 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(), BKE_tracking_projection_matrix(), BKE_tracking_stabdata_to_mat4(), brush_add(), brush_edit_apply(), brush_puff(), calc_local_clipping(), child_get_inverse_matrix(), clip_draw_main(), clipMirrorModifier(), cloth_to_object(), connect_hair(), constraint_mat_convertspace(), constraints_clear_evalob(), convert_pose(), convert_tree(), AnimationExporter::create_4x4_source(), createTransParticleVerts(), cuboid_do(), database_fromscene_vectors(), database_init_objects(), deformVerts_do(), do_clay_tubes_brush(), do_rotate_brush(), docenter_armature(), doMirrorOnAxis(), draw_depth(), draw_depth_gpencil(), draw_ebones(), draw_forcefield(), draw_motion_path_instance(), draw_new_particle_system(), draw_object(), draw_pose_bones(), draw_viewport_object_reconstruction(), drawmball(), drawPropCircle(), drawSnapping(), dupli_extrude_cursor(), dynamicPaint_updateBrushMaterials(), ED_clip_point_stable_pos(), 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(), flushTransParticles(), followtrack_evaluate(), foreach_mouse_hit_key(), get_texture_coords(), gp_session_initdata(), 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(), make_object_duplilist_real(), mat4_to_dquat(), meshdeformModifier_do(), minmax_evaluate(), move_camera(), new_particle_duplilist(), NewBooleanDerivedMesh_intern(), node_composit_transform(), object_apply_mat4(), object_camera_dof_distance(), object_handle_update(), object_hook_reset_exec(), object_origin_set_exec(), objectsolver_evaluate(), 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_init_sample_material(), 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_axis(), set_dupli_tex_mat(), SimpleDeformModifier_do(), sk_convertStroke(), sk_retargetStroke(), snap_sel_to_curs(), snap_sel_to_grid(), snapArmature(), snapDerivedMesh(), softbody_to_object(), sort_faces_exec(), space_transform_from_matrixs(), sphere_do(), spin_exec(), AnimationImporter::translate_animation_OLD(), uvprojectModifier_do(), v3d_editvertex_buts(), vertex_parent_set_exec(), view3d_main_area_setup_view(), vpaint_stroke_test_start(), warpModifier_do(), waveModifier_do(), where_is_pose(), and wpaint_stroke_test_start().

int is_negative_m3 ( float  mat[][3])

Definition at line 1172 of file math_matrix.c.

References cross_v3_v3v3(), and dot_v3v3().

int is_negative_m4 ( float  mat[][4])

Definition at line 1179 of file math_matrix.c.

References cross_v3_v3v3(), and dot_v3v3().

int is_orthogonal_m3 ( float  mat[][3])

Definition at line 781 of file math_matrix.c.

References dot_v3v3(), and fabsf.

int is_orthogonal_m4 ( float  mat[][4])

Definition at line 795 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 1257 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] 
)

Definition at line 1189 of file math_matrix.c.

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

Referenced by armature_mat_pose_to_bone().

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 1003 of file math_matrix.c.

References len_v3(), and mul_m3_v3().

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

Definition at line 986 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 1011 of file math_matrix.c.

References copy_m3_m4(), and mat3_to_scale().

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

Definition at line 993 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 176 of file math_matrix.c.

References copy_m3_m3().

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

Definition at line 383 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(), camera_view_frame_fit_to_scene(), 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(), recalcData_view3d(), 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[3] 
)

Definition at line 429 of file math_matrix.c.

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

Definition at line 411 of file math_matrix.c.

References i.

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

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

Definition at line 234 of file math_matrix.c.

void mul_m4_m4m3 ( float(*)  m1[4],
float(*)  m3_[4],
float(*)  m2_[3] 
)

Definition at line 198 of file math_matrix.c.

References copy_m3_m3(), and copy_m4_m4().

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

Definition at line 313 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[3] 
)

Definition at line 336 of file math_matrix.c.

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

Definition at line 347 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 247 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 280 of file math_matrix.c.

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

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

Definition at line 391 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[3],
float  mat[][4],
const float  vec[3] 
)

Definition at line 324 of file math_matrix.c.

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

Definition at line 357 of file math_matrix.c.

Referenced by draw_tracking_tracks(), and mul_m4_v4().

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

Definition at line 218 of file math_matrix.c.

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

Definition at line 145 of file math_matrix.c.

References copy_m4_m4().

void normalize_m3 ( float  mat[][3])

Definition at line 809 of file math_matrix.c.

References normalize_v3().

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

Definition at line 816 of file math_matrix.c.

References normalize_v3_v3().

void normalize_m4 ( float  mat[][4])

Definition at line 824 of file math_matrix.c.

References len(), and normalize_v3().

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

Definition at line 836 of file math_matrix.c.

References len(), and normalize_v3_v3().

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

Definition at line 634 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 707 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 1266 of file math_matrix.c.

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

Definition at line 1275 of file math_matrix.c.

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

Definition at line 1718 of file math_matrix.c.

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

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

Definition at line 1086 of file math_matrix.c.

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

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

Definition at line 1061 of file math_matrix.c.

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

Definition at line 1069 of file math_matrix.c.

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

Definition at line 964 of file math_matrix.c.

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

Definition at line 977 of file math_matrix.c.

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

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

Definition at line 458 of file math_matrix.c.

References i.

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

Definition at line 467 of file math_matrix.c.

References i.

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

Definition at line 1295 of file math_matrix.c.

References A, copy_m4_m4(), credits_svn_gen::e, 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 115 of file math_matrix.c.

References i.

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

Definition at line 129 of file math_matrix.c.

References i.

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

Definition at line 1079 of file math_matrix.c.

void transpose_m3 ( float  mat[][3])

Definition at line 593 of file math_matrix.c.

void transpose_m4 ( float  mat[][4])

Definition at line 608 of file math_matrix.c.

void unit_m3 ( float  m[][3])

Definition at line 46 of file math_matrix.c.

void unit_m4 ( float  m[][4])

Definition at line 54 of file math_matrix.c.

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

Definition at line 41 of file math_matrix.c.

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