Campbell Barton
d7f33668d6
Math Lib: Add mat3_from_axis_conversion_single
...
Single axis version of mat3_from_axis_conversion,
when the second axis isn't important (orienting an arrow for eg).
2017-06-09 19:31:27 +10:00
Campbell Barton
9bb8e46460
Docs: move note (was mixed up)
2017-04-20 17:11:12 +10:00
Campbell Barton
e1e49fd1a8
Math Lib: rotate matrix cleanup
...
- Remove 'rotate_m2', unlike 'rotate_m4' it created a new matrix
duplicating 'angle_to_mat2' - now used instead.
(better avoid matching functions having different behavior).
- Add 'axis_angle_to_mat4_single',
convenience wrapper for 'axis_angle_to_mat3_single'.
- Replace 'unit_m4(), rotate_m4()' with a single call to 'axis_angle_to_mat4_single'.
2016-11-25 16:39:34 +11:00
Campbell Barton
7a3ea87bbf
Cleanup: use normalize_v#_length
2016-07-08 10:14:49 +10:00
Campbell Barton
60505728d9
Correct error in own matrix normalize commit
2015-11-12 18:54:26 +11:00
Campbell Barton
fbca69c69a
BLI_math: add mat3_normalized_to_* functions
...
Many uses of matrices for rotation keep them normalized,
so no need to normalize each time.
2015-10-24 07:02:51 +11:00
Campbell Barton
3a98426ed6
Cleanup: remove redundant math calls
2015-10-24 06:03:48 +11:00
Campbell Barton
9d8a01dba1
BLI_math: add invert_qt_normalized
...
When the quat is known to be unit length, so we can avoid scaling
(just conjugate_qt which asserts on non unit quats).
2015-10-24 03:51:00 +11:00
Campbell Barton
80470b639c
BLI_math: axis_angle_to_quat_single
...
Useful to avoid defining a vector for an axis-aligned rotation.
Matches axis_angle_to_mat3_single behavior.
2015-10-23 03:09:28 +11:00
Campbell Barton
f1422c40af
Use squared length where possible
2015-09-18 16:40:55 +10:00
Brecht Van Lommel
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
Joshua Leung
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
Campbell Barton
89a3e4deff
Cleanup: redundant normalize in expmap_to_quat
2015-04-04 14:45:54 +11:00
Sybren A. Stüvel
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
Bastien Montagne
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
Campbell Barton
3a40aed3d5
Cleanup: use float versions of functions when in/output are floats
2014-09-24 14:55:02 +10:00
Bastien Montagne
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
48881ad1e0
Code cleanup: doxy comments
2014-05-14 15:00:47 +10:00
Campbell Barton
55d75f5020
Code cleanup: correct abs use
...
also minor cleanup to rotation code
2014-04-21 02:02:21 +10:00
Campbell Barton
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
Campbell Barton
d6a53bb38f
Minor change to recent commit (avoid transpose)
2014-04-19 19:48:07 +10:00
Campbell Barton
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
Campbell Barton
fc9c790563
Math Lib: minor optimization for axis_angle_normalized_to_mat3
2014-04-19 14:10:22 +10:00
Campbell Barton
0055162b75
Tweak slerp assert to be less picky
2014-03-31 14:55:12 +11:00
Campbell Barton
55f83e36cc
Py API: Vector.slerp(). also added interp_v3_v3v3_slerp(_safe) functions
2014-03-31 13:28:37 +11:00
Campbell Barton
7199e2288f
Code cleanup: use sqrtf when input and output are float
2014-03-28 14:53:37 +11:00
Campbell Barton
c6252d6e60
Math Lib: add angle_qt functions
2014-03-20 15:15:29 +11:00
Bastien Montagne
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
Campbell Barton
b5d6f14290
Fix T38858: Crazy spaces was unpredictable with co-linear edges
2014-02-27 12:28:40 +11:00
Campbell Barton
5fce3457b7
Math lib: add axis_angle_normalized_to_quat, use when length is known
2014-02-02 02:24:47 +11:00
Sergej Reich
a025ff407e
Math: Code cleanup
...
Remove stray #undef directives.
2014-01-17 20:44:34 +01:00
Campbell Barton
07ceb99213
Code Cleanup: use strict flags for math lib, add inline declarations
2013-12-06 03:57:17 +11:00
Campbell Barton
6193963daa
style cleanup
2013-10-22 03:03:56 +00:00
Brecht Van Lommel
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
Brecht Van Lommel
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
Campbell Barton
ab8d88ac18
add angle_to_mat2 utility function.
2013-09-10 20:45:47 +00:00
Campbell Barton
2e2ea1ae21
set function args in BLI_math_rotation as const where possible.
2013-08-23 09:46:11 +00:00
Campbell Barton
7db1d6556d
code cleanup: add break statements in switch ()'s, (even at the last case).
2013-07-21 08:16:37 +00:00
Campbell Barton
a2492e0603
style cleanup: braces/indentation
2013-07-19 16:44:17 +00:00
Campbell Barton
adba695209
remove vec_rot_to_mat3(), replace with axis_angle_normalized_to_mat3()
2013-06-22 23:58:52 +00:00
Campbell Barton
44b3735078
fix error in own recent commit, also other minor changes.
2013-05-27 18:51:31 +00:00
Campbell Barton
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
Campbell Barton
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
Antony Riakiotakis
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
Campbell Barton
2804caff4c
code cleanup: use bools, (float)sin/(float)cos -> sinf/cosf, more meaningful var names.
2013-04-04 04:22:38 +00:00
Campbell Barton
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
Campbell Barton
2005f7c6c0
style cleanup: also some typos
2013-02-11 00:49:00 +00:00