Commit Graph

371 Commits

Author SHA1 Message Date
90b5697459 Fix mathutils.barycentric_transform()
Dummy typo, we need a 3D vector here...
2015-01-18 18:41:47 +01:00
1829c049be Correct args from recent mathutils refactor 2015-01-06 19:09:55 +11:00
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
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
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
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
4abe548527 cleanup: style 2015-01-02 19:29:00 +11:00
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
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
e182d43d3e cleanup: avoid ref-counting None for a new matrix 2014-12-28 15:13:01 +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
915235c87a Cleanup: unused headers 2014-11-28 22:16:14 +01:00
8b2fbd6bbf mathutils.kdtree: fix docstrings 2014-11-20 11:03:38 +01:00
a550d913bc Fix Python ray-cast failing to check hit direction 2014-10-08 09:47:41 +02:00
3a40aed3d5 Cleanup: use float versions of functions when in/output are floats 2014-09-24 14:55:02 +10:00
4e732b9860 Fix building as Python module (manpage-generation) 2014-09-08 11:22:40 +10:00
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
671f75a12a Math Lib: Add copy_m2_m2, unit_m2, zero_m2 2014-09-06 11:29:27 +10:00
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
3529913629 Math Lib: name signed versions of dist_to_plane_v3 explicitly
also add unsigned versions
2014-08-13 14:34:58 +10:00
a108532eb9 Fix for mathutils.Euler on big endian systems
D719 from jrestemeier with edits
2014-08-08 02:11:54 +10:00
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
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
ce47231cdb Math Lib: Add isect_point_tri_v3
Add to Python via mathutils.geometry
2014-07-21 16:58:17 +10:00
00b29156e0 Defines: replace ELEM3-16 with ELEM(...), that can take varargs 2014-07-20 01:33:40 +10:00
9f05588b68 Python: remove redundant casts 2014-07-01 14:10:59 +10:00
92a380d0b2 Minor changes for standalone mathutils 2014-05-17 12:06:29 +10:00
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
c034a252bb Code cleanup: quiet warnings 2014-04-29 22:37:44 +10:00
94bf67b78e Error in last commit 2014-04-29 20:41:28 +10:00
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
409fb4da0c Code cleanup: remove redundant matrix initialization 2014-04-29 18:13:20 +10:00
e73d0f57a3 Code cleanup: use 'const' for arrays (python) 2014-04-27 00:25:15 +10:00
dc847607b6 Change Vector.slerp to accept nonunit vectors 2014-04-18 20:49:39 +10:00
55f83e36cc Py API: Vector.slerp(). also added interp_v3_v3v3_slerp(_safe) functions 2014-03-31 13:28:37 +11:00
6aa75d3b2c Fix for error in normalize_vn_vn(), add len_squared_vn 2014-03-31 11:19:32 +11:00
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
e9a64e2770 Fix T39392: Python bindings for geometry.box_pack_2d() return invalid total height 2014-03-24 17:39:54 +01:00
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
a47137a2db Python API: add Vector.orthogonal() method 2014-03-18 00:39:46 +11:00
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
ab6157a06a PyAPI: noise.seed_set(), note that zero is a special case. 2014-01-30 17:56:07 +11:00
bd697dd4d7 Fix T38402: invalid message for bad type assignments (Quat, Vector) 2014-01-30 16:45:20 +11:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
63ccb26303 Code Cleanup: spelling 2014-01-17 17:35:03 +11:00
61ff3dfdda Code Cleanup: spelling 2014-01-13 15:31:57 +11:00
da6bc87b57 Fix T38138: incorrect API docs 2014-01-09 21:49:11 +11:00
55f7a4aebc Fix T38104: mathutils.cell_vector() always returns (0,0,0)
Reviewed By: brecht
2014-01-08 23:03:09 +01:00
cdeb3c3922 Fix for incorrect use of abs() in intersect_sphere_sphere_2d 2014-01-09 03:15:59 +11:00