Commit Graph

72 Commits

Author SHA1 Message Date
Campbell Barton
ce85aef0d9 mathutils: remove redundant read callback 2015-02-15 13:46:47 +11:00
Campbell Barton
4feb77cf03 mathutils: avoid extra alloc for Vector.lerp 2015-02-15 13:46:47 +11:00
Sybren A. Stüvel
baa8b63111 Documentation: updated mathutils documentation
Added descriptions of the constructors, and improved the module-level
documentation.
2015-02-01 18:16:12 +01:00
Campbell Barton
79ba5e52dd Revert "mathutils: let Vector.normalize() return the original length."
Please discuss changes to core mathutils functions first.

Changes like this should be considered and applied to all areas of the API (or not at all).
Missed quaternion, matrix normalize for eg.
2015-01-30 02:12:07 +11:00
Sybren A. Stüvel
6912fe132f mathutils: let Vector.normalize() return the original length.
The length has to be calculated for normalization anyway, and it is already
returned by normalize_vn(vec, size).
2015-01-29 15:29:01 +01:00
Campbell Barton
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
Tamito Kajiyama
8d3bfef538 Extended mathutils.Vector.orthogonal() to accept a 2D vector.
Reviewer: Campbell Barton

Differential revision: https://developer.blender.org/D668
2014-07-23 23:10:03 +09:00
Campbell Barton
dc847607b6 Change Vector.slerp to accept nonunit vectors 2014-04-18 20:49:39 +10: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
6aa75d3b2c Fix for error in normalize_vn_vn(), add len_squared_vn 2014-03-31 11:19:32 +11:00
Campbell Barton
a47137a2db Python API: add Vector.orthogonal() method 2014-03-18 00:39:46 +11:00
Campbell Barton
06b6cd8345 PyAPI: mathutils.Vector.cross now works for 2d vectors (returns a float)
also fixed crash when running on large vectors (raises exception now)
2014-02-05 23:36:30 +11:00
Campbell Barton
bd697dd4d7 Fix T38402: invalid message for bad type assignments (Quat, Vector) 2014-01-30 16:45:20 +11:00
Campbell Barton
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
Campbell Barton
da6bc87b57 Fix T38138: incorrect API docs 2014-01-09 21:49:11 +11:00
Campbell Barton
b6db417ee4 code cleanup: use const's for vector args. 2013-10-12 02:19:37 +00:00
Campbell Barton
1576565932 minor changes needed for building standalone mathutils. 2013-09-14 00:30:56 +00:00
Campbell Barton
f3654ce6b6 fix incorrect docs [#36518] Vector.rotate() does not return value as documented 2013-08-20 08:41:34 +00:00
Campbell Barton
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
Thomas Dinges
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
Campbell Barton
adf7bfa8bb ifdef out dynstr so mathutils can be compiled as an external module again. 2012-12-08 01:16:59 +00:00
Campbell Barton
cf6994b910 code cleanup: spelling,
also initialize bmesh-bevel settings struct to zero to avoid possible uninitialized memory later.
2012-11-12 07:33:01 +00:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
c56a911cd9 style cleanup: comments 2012-10-20 20:20:02 +00:00
Campbell Barton
aa49ca25d5 incorrect spelling in comments 2012-09-26 20:05:38 +00:00
Campbell Barton
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
Campbell Barton
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
Campbell Barton
200584e5c6 fix for a handful of memory leaks relating to parsing and allocating arbitrary sized vectors from python args.
Vector.dot() was always leaking memory, and would crash if args sizes didnt match.

These errors were introduced with n-dimensional vector support.

also fixed an error with bmesh py api allocation.
2012-06-26 16:58:58 +00:00
Campbell Barton
e32c467713 mathutils.Vector(kw=value) wasn't raising an error as it should. 2012-06-26 14:49:49 +00:00
Campbell Barton
f5f25b81e8 style cleanup:
also fix for building ghost test and fix double free in one of the tests
2012-06-17 09:58:26 +00:00
Bastien Montagne
cf0d350b51 Fixing first part of [#31760] Assignments not working properly for Object.dimensions
Problem was in fact that non-linear-contiguous axis assignement was broken (i.e. location.xy would work as expected, but location.xz would only affect .x part)... Now all possibilities should work fine.

Did not try to fix the problem specific to obj.dimension (when assigning multiple times to this array, only the last one is taken into account - in fact, a simple print() shows that assigning to dimension is not taken into account immediately), not sure whether this is normal behavior, or if we need a specific "update" of some kind for this prop?
2012-06-11 18:58:34 +00:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
11d12d945e style cleanup: python api 2012-03-26 06:55:09 +00:00
Campbell Barton
02f707e9da minor mathutils code cleanup - use mathutils callbacks as unsigned chars everywhere. 2012-03-17 10:46:02 +00:00
Campbell Barton
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
Campbell Barton
c2d93e8d4a comment cleanup 2012-03-14 22:39:56 +00:00
Campbell Barton
ee9a00948b mathutils py api:
Vector.angle_signed(other)
  for 2D vectors to get the clockwise angle between them.

  in BLI math its called - angle_signed_v2v2()

shorthand for...

  atan2f((v1[1] * v2[0]) - (v1[0] * v2[1]), dot_v2v2(v1, v2))

also corrects compile error in last commit.
2012-03-14 06:14:15 +00:00
Campbell Barton
89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
Campbell Barton
3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
Campbell Barton
b81bfd86b4 use ValueError when vector/matrix multiplications sizes are not supported, was using TypeError for mat*vec and ValueError for vec*mat. 2012-02-11 14:27:36 +00:00
Campbell Barton
1f74789d12 Correct mathutils documentation, also correct some python spelling errors and add makefile target check_spelling 2012-02-08 04:37:37 +00:00
Andrew Hale
5a221dd0de Fix for possible memory leak on creation of a vector using Vector.Range.
It was possible to allocate an array of size<2 which would then raise an error on vector creation without freeing.

Fix to ensure the behaviour of Vector.Range was the same as for builtin range() function. When specifying 3 arguments, the step argument wasn't being used to correctly calculate the vector size.

Minor formatting edits for error messages.
2012-02-02 01:07:04 +00:00
Campbell Barton
f0e3c3c68f fixes to mathutils from Andew Hale
- docstring edits
- normalize ignores W axis as its supposed to.
2012-01-03 14:34:41 +00:00
Campbell Barton
f48fb385ea formatting edits & minor corrections 2011-12-26 00:42:35 +00:00
Campbell Barton
67effc8aef use docstrings for mathutils getset's, also some formatting edits, no functional changes. 2011-12-25 11:36:26 +00:00
Campbell Barton
f3ac865cc0 picky formatting of mathutils 2011-12-24 13:26:30 +00:00
Campbell Barton
b42497b460 mathutils get/set function rename + minor changes to matrix functions (no functional changes) 2011-12-24 04:58:01 +00:00
Campbell Barton
840dfcd56d cleanup and some fixes to mathutils by Andrew Hale
* 1. Resize 4x4, code was ridiculously complex (cleanup only)
* 2. matrix * matrix checking for compatibility wasn't working right (bug in last release)
* 3. fix for result size for matrix * vector if matrix is 4x4 and vector size 3 (bug in recent patch)
* 4. fix for result size vector * matrix if matrix is 4x4 and vector size 3 (bug in recent patch)
2011-12-21 21:21:27 +00:00