Commit Graph

58 Commits

Author SHA1 Message Date
21fddf7d1c C99/C++11: replace deprecated finite() by isfinite(). 2016-05-17 21:39:16 +02:00
c5945ebb2c Cleanup: use quat to eul w/ mathutils API 2015-10-24 17:50:20 +11:00
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
c439d14a9a missed this second last commit 2015-02-15 14:11:05 +11:00
fa2f7c69ac mathutils: Implement __hash__() functions
- all mathutils types
- only works on frozen data (so vectors can be used in sets/dict keys)
- uses same method as CPython, (matches hashing a tuple)

D1104 by @juicyfruit with own modifications
2015-02-15 14:02:08 +11:00
a9d979c8ef mathutils: add freeze() method, is_frozen attr
This allows you to make any mathutils object immutable.
2015-02-15 14:01:59 +11:00
baa8b63111 Documentation: updated mathutils documentation
Added descriptions of the constructors, and improved the module-level
documentation.
2015-02-01 18:16:12 +01: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
8c7e1b648b Fix: correctly describing Quaternion.normalize()
The original comment seems to suggest that only the rotation vector
is normalized, leaving the rotation angle alone. This is not what happens,
though. The new comment matches the actual implementation, and the
implementation matches what is commonly understood as quaternion
normalization.
2015-02-01 10:34:49 +01:00
9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
8106a6b75d mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped,
add new function for creating wrapped objects.

also fixes unlikely memory leak if the data-array can't be allocated.
2015-01-04 17:43:57 +11:00
27b58f0eb2 Fix mathutils docstring typos. 2014-12-19 00:43:41 +09:00
9c81833430 Fix T42885: We still had a few wrong doc in mathutils about methods returning
instance of self while actually returning None...
2014-12-13 14:07:46 +01:00
3a40aed3d5 Cleanup: use float versions of functions when in/output are floats 2014-09-24 14:55:02 +10:00
bd697dd4d7 Fix T38402: invalid message for bad type assignments (Quat, Vector) 2014-01-30 16:45:20 +11:00
b6db417ee4 code cleanup: use const's for vector args. 2013-10-12 02:19:37 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
858ff6b696 Fix for [#34898] Typo in error message of mathutils.Vector
* Also fixed some more cases of "more then" -> "more than".
2013-04-07 15:09:06 +00:00
adf7bfa8bb ifdef out dynstr so mathutils can be compiled as an external module again. 2012-12-08 01:16:59 +00:00
004f8d78ed default to Python3.3 on Linux for SCons and CMake, warn when building with python 3.2x or older.
also remove casts to keep Python3.2 warning quiet.
2012-11-05 13:48:42 +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
77f0be7fec support unary positive operators for vectors (same as numpy), so you can do 'vector_a = +vector_b', this makes a copy. 2012-08-27 13:40:19 +00:00
41ee294618 don't pass the same value to axis_angle_to_quat() for axis & quat.
-/-This line, and those below, will be ignored--

M    mathutils_Quaternion.c
2012-07-25 16:46:46 +00:00
2d2d36fe3b code cleanup:
- style - multi-line ifs move braces onto new lines.
- iterators - convert some to macros, other split up and move brace.
2012-05-20 19:49:27 +00:00
6520aa97a9 add 'idprop' module so we can document idprop.types.*, currently doc generator has no access to ID Property types. 2012-04-15 14:54:15 +00:00
89b83f0060 patch to add __deepcopy__ to mathutils types, this is no different to __copy__, except some py utilities expect __deepcopy__ to exist, so better have them. 2012-03-30 11:35:58 +00:00
11d12d945e style cleanup: python api 2012-03-26 06:55:09 +00:00
5935ff3aaa fix for Quaternion.to_axis_angle() returning a zero axis vector. 2012-03-20 23:37:54 +00:00
05612c0419 code cleanup: not all mathutils callback creation functions tool unsigned char for type & subtype args. 2012-03-17 22:31:57 +00:00
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
8646bb4464 workaround [#30480] Knife tool flicker
the problem was numeric precision when in ortho mode the start/end points for the view vector would be 2000 apart which caused trouble for the intersection test.
2012-03-13 01:11:08 +00:00
3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
1fbd91b8a1 typo cleanup, no functional changes. 2012-02-24 06:44:04 +00:00
f48fb385ea formatting edits & minor corrections 2011-12-26 00:42:35 +00:00
67effc8aef use docstrings for mathutils getset's, also some formatting edits, no functional changes. 2011-12-25 11:36:26 +00:00
f3ac865cc0 picky formatting of mathutils 2011-12-24 13:26:30 +00:00
b42497b460 mathutils get/set function rename + minor changes to matrix functions (no functional changes) 2011-12-24 04:58:01 +00:00
a8ed803b66 rename internal matrix struct member vars to avoid confusion
Matrix.contigPtr --> matrix
Matrix.row_size --> num_col
Matrix.col_size --> num_row
2011-12-20 04:11:23 +00:00
3d8ee28750 __str__ functions for other mathutils types 2011-12-20 03:37:55 +00:00
9c9099a805 formatting edits in py api, no functional changes 2011-12-18 08:50:06 +00:00
083297fbf1 formatting edits (120 width max) and remove some redundant casts 2011-11-29 20:22:35 +00:00
6e28ac2d7b pep8 edits and avoid naming conflicts with python builtins 2011-11-24 19:36:12 +00:00
3b9b6051d9 rename mathutils constructors to match other parts of the bpy/api (no functional changes) 2011-11-24 04:45:36 +00:00
ba7fbf6ae7 formatting edits & doc correction, no functional changes. 2011-11-16 03:56:34 +00:00
72a7101576 include invalid type name in mathutils error messages. 2011-11-13 09:20:04 +00:00
094c9799f9 quiet -Wdouble-promotion warnings 2011-11-11 12:00:08 +00:00
057bf2a02b misc doc edits
- remove recently added sphinx reference workaround.
- tested doxygen, correct some warnings, set tab width and added pymathutils group.
- added convenience target 'make doc_doxy'
2011-11-05 01:48:10 +00:00
e29aa363f2 new math function: Quaternion.to_axis_angle().
add in safety checks for inf/nan values which could happen in some cases.
2011-11-02 09:13:04 +00:00