Commit Graph

126 Commits

Author SHA1 Message Date
b6caefdaa9 Fix T43711: dual quaternion deform bug with shearing in deform matrix.
This also increases the tolerances in is_orthogonal / is_orthonormal functions,
which were much too low for practical purposes.
2015-05-01 19:21:41 +02:00
441f68e2b0 Partial fix for T44219
Prevent crashes from out of bounds array access if an invalid rotation mode
is passed to the euler rotation blenlib calculations.
2015-04-08 14:34:07 +12:00
89a3e4deff Cleanup: redundant normalize in expmap_to_quat 2015-04-04 14:45:54 +11:00
9fa628f35b mathutils: added exponential map to Quaternion
Added conversion to and from exponential map representation. This
representation is useful for interpolation of > 2 quaternions, or in
PD controllers.

Implementation in C functions quat_to_expmap,
quat_normalized_to_expmap, and expmap_to_quat with Python API, unit
tests and documentation.

Added Quaternion.to_exponential_map() and Quaternion(3-vector) to
Python API.

Reviewers: campbellbarton

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D1049
2015-02-01 13:06:00 +01:00
391096252b Fix T42638: Roll angle inconsistent flip in edit mode.
Basically, `angle_compat_rad()` was completely broken -
example of result it could produce:

| new angle | compat angle |    result
| -0.000000 |   3.141593   | -> 3.141593

... Where 0.0 (or 2 * PI) would be expected!
2014-11-20 15:02:48 +01:00
3a40aed3d5 Cleanup: use float versions of functions when in/output are floats 2014-09-24 14:55:02 +10:00
74758576fc Cleanup: general cleanup in BLI_math code (mostly, use 'const' where possible, true/false for booleans, format for float litterals). 2014-07-30 12:19:41 +02:00
8489b94e07 Math Lib: rename mul_serie_m3 to mul_m3_series & reorder args
Importantly, reversed mul_serie_m3 argument order (so it matches the m4 function)
2014-07-21 18:57:35 +10:00
7c7b7302d3 Math Lib: use variable length args for mul_serie_m3,m4 (instead of trailing NULL's) 2014-07-20 14:01:42 +10:00
94d4b31323 Math Lib: mat3_to_eulo2 & mat3_to_eul2 mixed float/double differently
replace sqrt with hypotf to avoid precision loss instead
2014-06-14 17:10:46 +10:00
48881ad1e0 Code cleanup: doxy comments 2014-05-14 15:00:47 +10:00
55d75f5020 Code cleanup: correct abs use
also minor cleanup to rotation code
2014-04-21 02:02:21 +10:00
f77207b1c3 Math Lib: faster version of rotation_between_vecs_to_mat3
Use axis/angle calculation but avoid calls to sin/cos
2014-04-20 20:56:40 +10:00
d6a53bb38f Minor change to recent commit (avoid transpose) 2014-04-19 19:48:07 +10:00
fabc46b41f Math Lib: add rotation_between_vecs_to_mat3
- behaves like rotation_between_vecs_to_quat
- avoids calling sin,cos calls (approx 1.6x faster).
2014-04-19 15:36:47 +10:00
fc9c790563 Math Lib: minor optimization for axis_angle_normalized_to_mat3 2014-04-19 14:10:22 +10:00
0055162b75 Tweak slerp assert to be less picky 2014-03-31 14:55:12 +11:00
55f83e36cc Py API: Vector.slerp(). also added interp_v3_v3v3_slerp(_safe) functions 2014-03-31 13:28:37 +11:00
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
c6252d6e60 Math Lib: add angle_qt functions 2014-03-20 15:15:29 +11:00
0e9084d5ec Fix T39210: Grid Fill is generating mesh that's inconsistent with selected edge loops
Issue was in BLI's rotation_between_vecs_to_quat(), which did not handled correctly cases where both vectors are colinear.

Patch by Campbell Barton and me.

Issue originaly tracked down by Yan Shi, many thanks!
2014-03-16 16:31:19 +01:00
b5d6f14290 Fix T38858: Crazy spaces was unpredictable with co-linear edges 2014-02-27 12:28:40 +11:00
5fce3457b7 Math lib: add axis_angle_normalized_to_quat, use when length is known 2014-02-02 02:24:47 +11:00
a025ff407e Math: Code cleanup
Remove stray #undef directives.
2014-01-17 20:44:34 +01:00
07ceb99213 Code Cleanup: use strict flags for math lib, add inline declarations 2013-12-06 03:57:17 +11:00
6193963daa style cleanup 2013-10-22 03:03:56 +00:00
6d9ccbc28d Further tweak for dual quaternion armature deform problem, tweak the epsilon
value to solve some more cases.
2013-10-12 12:54:09 +00:00
744f691af4 Fix dual quaternion armature deform giving erratic results in some cases. Bug
was encountered in a Kiribati rig file.

The problem was actually in the matrix to quaternion conversion function. One
problem is that it was using the wrong matrix indices in case of an ill defined
matrix trace. Besides that FLT_EPSILON was too small to detect cases where
float precision becomes a problem.
2013-10-12 00:08:34 +00:00
ab8d88ac18 add angle_to_mat2 utility function. 2013-09-10 20:45:47 +00:00
2e2ea1ae21 set function args in BLI_math_rotation as const where possible. 2013-08-23 09:46:11 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
a2492e0603 style cleanup: braces/indentation 2013-07-19 16:44:17 +00:00
adba695209 remove vec_rot_to_mat3(), replace with axis_angle_normalized_to_mat3() 2013-06-22 23:58:52 +00:00
44b3735078 fix error in own recent commit, also other minor changes. 2013-05-27 18:51:31 +00:00
ec8d277c64 BLI_math rename functions:
- mult_m4_m4m4 -> mul_m4_m4m4
- mult_m3_m3m4 -> mul_m3_m3m4

these temporary names were used to avoid problems when argument order was switched.
2013-05-26 18:36:25 +00:00
59ca83c3a9 rename axis_angle_to_mat3_no_norm() --> axis_angle_normalized_to_mat3().
this matches closer to convention from existing functions - angle_v3v3() angle_normalized_v3v3().

also added assert to ensure argument given to axis_angle_normalized_to_mat3() is in fact normalized.
2013-04-15 15:16:11 +00:00
f6604f7612 New implementation for twist brushes.
It has much better rotation and avoids the compression effect that old
twist brushes have. Also twisting is now non periodic, meaning you can
twist beyond 180 degrees. The amount of twist is also calculated
relative to the angle formed after first translating the mouse away from
the brush center.
2013-04-15 14:55:42 +00:00
2804caff4c code cleanup: use bools, (float)sin/(float)cos -> sinf/cosf, more meaningful var names. 2013-04-04 04:22:38 +00:00
c68d5325d0 fix for [#34283] wasn't working in my tests (attached to original report),
made bone roll get compatible angle values with the original roll.
2013-02-19 04:37:28 +00:00
2005f7c6c0 style cleanup: also some typos 2013-02-11 00:49:00 +00:00
2b875a947f skip calculating the normal for each face when triangulating, all callers make sure its valid. also remove some commented code (more then one generation of bmesh old). 2013-01-29 15:05:23 +00:00
caac27dcbc mesh-cache deform modifier,
supports MDD and PC2 formats.

see wiki docs:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Deform/Mesh_Cache
2013-01-21 15:41:00 +00:00
c93e127e7a code cleanup: style and replace (float)sin, (float)cos with sinf, cosf 2013-01-12 14:28:23 +00:00
7c699a217a define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00
b867f9f17e style cleanup: comments & spelling 2012-11-18 01:22:31 +00:00
fae6c35ca7 code cleanup: quiet -Wdouble-promotion, disabled this warnings for a few files since its done throughout the code in some places. 2012-11-04 07:18:29 +00:00
9b948717b0 code cleanup: float <> double conversion. 2012-11-03 18:23:30 +00:00
ddc2dbc2a4 style cleanup 2012-10-22 08:15:51 +00:00
c56a911cd9 style cleanup: comments 2012-10-20 20:20:02 +00:00
aa49ca25d5 incorrect spelling in comments 2012-09-26 20:05:38 +00:00