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
Sybren A. Stüvel
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
Bastien Montagne
12a38abac6
Fix T43473: mathtutils.geometry.interpolate_bezier returns only 2d coordinates
...
Fixed/enhanced a few usages of `mathutils_array_parse()` in this file actually...
2015-01-29 18:11:13 +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
Lukas Tönne
1727a165dd
Properly register the mathutils.interpolate submodule.
2015-01-20 09:30:09 +01:00
Lukas Tönne
658fc3ddbc
New python submodule mathutils.interpolate for various mesh interpolation and weighting methods.
...
This module will contain mirrored functions for calculating and applying
weights for points on a mesh. This includes barycentric and UV weighting
and possibly more advanced global weighting such as harmonic weights.
The naming should follow this scheme:
<type>_{2d,3d}_{calc,apply}
e.g.
poly_2d_calc
poly_2d_apply
uv_3d_calc
...
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D939
2015-01-20 09:30:09 +01:00
Bastien Montagne
90b5697459
Fix mathutils.barycentric_transform()
...
Dummy typo, we need a 3D vector here...
2015-01-18 18:41:47 +01:00
Campbell Barton
1829c049be
Correct args from recent mathutils refactor
2015-01-06 19:09:55 +11:00
Campbell Barton
bf0c8e116d
PyAPI: add PyList_APPEND
...
This appends while giving ownership to the list, avoiding temp assignment.
This matches PyList_SET_ITEM which bypasses refcount's
Note, this also reduce code-size, Py_DECREF is a rather heavy macro.
2015-01-06 19:09:53 +11:00
Campbell Barton
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
Bastien Montagne
e0db0f84ac
Fix T43119: mathutils.intersect_point_line always returns a 2D vector as first value.
...
Trivial, safe for final 2.73.
2015-01-04 10:11:21 +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
Campbell Barton
4abe548527
cleanup: style
2015-01-02 19:29:00 +11:00
Campbell Barton
cefb764269
PyAPI: geometry.normal, support polygons
...
Previously this only supported tri/quads,
now arbitrary size poly lines are supported.
2014-12-30 22:49:52 +11:00
Campbell Barton
68600920ce
PyAPI: allow non-vector args for geometry module
...
Previously only vector args were accepted,
now allow generic sequence of numbers.
Was annoying to create vectors just to pass in args.
2014-12-30 22:05:34 +11:00
Campbell Barton
e182d43d3e
cleanup: avoid ref-counting None for a new matrix
2014-12-28 15:13:01 +11:00
Tamito Kajiyama
27b58f0eb2
Fix mathutils docstring typos.
2014-12-19 00:43:41 +09:00
Bastien Montagne
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
Campbell Barton
915235c87a
Cleanup: unused headers
2014-11-28 22:16:14 +01:00
Campbell Barton
8b2fbd6bbf
mathutils.kdtree: fix docstrings
2014-11-20 11:03:38 +01:00
Campbell Barton
a550d913bc
Fix Python ray-cast failing to check hit direction
2014-10-08 09:47:41 +02:00
Campbell Barton
3a40aed3d5
Cleanup: use float versions of functions when in/output are floats
2014-09-24 14:55:02 +10:00
Campbell Barton
4e732b9860
Fix building as Python module (manpage-generation)
2014-09-08 11:22:40 +10:00
Bastien Montagne
e44c49d89d
Py Mathutils: add invert_safe() and inverted_safe() to Matrix.
...
Those two mimic our BLI invert_m4_m4_safe - they add a small offset to diagonal values,
in case org matrix is degenerated, and if still non-invertible, return identity matrix.
Org patch by me, final enhanced version by ideasman42, many thanks!
2014-09-06 14:58:38 +02:00
Campbell Barton
671f75a12a
Math Lib: Add copy_m2_m2, unit_m2, zero_m2
2014-09-06 11:29:27 +10:00
Campbell Barton
ff42afb6c5
Math Lib: rename barycentric_transform -> transform_point_by_tri_v3
...
also add transform_point_by_seg_v3
2014-08-13 14:55:45 +10:00
Campbell Barton
3529913629
Math Lib: name signed versions of dist_to_plane_v3 explicitly
...
also add unsigned versions
2014-08-13 14:34:58 +10:00
Campbell Barton
a108532eb9
Fix for mathutils.Euler on big endian systems
...
D719 from jrestemeier with edits
2014-08-08 02:11:54 +10: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
a7d8f602a6
Py/API: Improve intersect_line_line with parallel lines
...
Now comparing the distance between line-intersection points
to see how close lines are - doesn't fail in the parallel case.
2014-07-21 23:22:10 +10:00
Campbell Barton
ce47231cdb
Math Lib: Add isect_point_tri_v3
...
Add to Python via mathutils.geometry
2014-07-21 16:58:17 +10:00
Campbell Barton
00b29156e0
Defines: replace ELEM3-16 with ELEM(...), that can take varargs
2014-07-20 01:33:40 +10:00
Campbell Barton
9f05588b68
Python: remove redundant casts
2014-07-01 14:10:59 +10:00
Campbell Barton
92a380d0b2
Minor changes for standalone mathutils
2014-05-17 12:06:29 +10:00
Campbell Barton
4ca67869cc
Code cleanup: remove unused includes
...
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
Campbell Barton
c034a252bb
Code cleanup: quiet warnings
2014-04-29 22:37:44 +10:00
Campbell Barton
94bf67b78e
Error in last commit
2014-04-29 20:41:28 +10:00
Campbell Barton
232f19f0c2
PyAPI: Matrix.invert(ed): accept an optional fallback argument
...
This avoids try/except when its possible the matrix has no inverse.
2014-04-29 20:12:07 +10:00
Campbell Barton
409fb4da0c
Code cleanup: remove redundant matrix initialization
2014-04-29 18:13:20 +10:00
Campbell Barton
e73d0f57a3
Code cleanup: use 'const' for arrays (python)
2014-04-27 00:25:15 +10: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
7199e2288f
Code cleanup: use sqrtf when input and output are float
2014-03-28 14:53:37 +11:00
Bastien Montagne
e9a64e2770
Fix T39392: Python bindings for geometry.box_pack_2d() return invalid total height
2014-03-24 17:39:54 +01:00
Campbell Barton
7da2175271
KDTree: deprecate 'normal' argument
...
Normals for each kdtree node were allocated but never used,
and search args only use in particles/boids code.
2014-03-18 09:14:47 +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
ab6157a06a
PyAPI: noise.seed_set(), note that zero is a special case.
2014-01-30 17:56:07 +11:00