Commit Graph

86 Commits

Author SHA1 Message Date
7729966af1 Fixed typo Python API
`mathutils.geometry.barycentric_transform` used `tri_a[1-3]` for the
target triangle, but in fact they are `tri_b[1-3]`
2018-03-19 08:19:48 +01:00
deacb3d6b8 Cleanup: add 2d suffix to BLI files
Some of these API's can have 3D versions, explicitly name them 2D.
2018-02-18 21:27:33 +11:00
959a58da9e Cleanup: redundant casts 2017-10-20 14:03:22 +11:00
691ed21842 PyAPI: replace PyC_FromArray with typed functions
This was meant to be generic but introduced possible type errors
and unnecessary complication.
Replace with typed PyC_Tuple_PackArray_* functions.

Also add PyC_Tuple_Pack_* macro which replaces some uses of
Py_BuildValue, with the advantage of not having to parse a string.
2017-08-22 18:10:57 +10:00
a1d7f67d81 cleanup: spelling / typos
no functional changes
2016-01-28 00:30:50 -05:00
4f8b7f4420 Docs: quiet warnings in reference doc syntax 2016-01-25 20:26:39 +11:00
e1b67c9bc0 Fix T46002: mathutils.geometry.intersect_line_line_2d doesn't operate on lines, but on line segments.
Ugly issue really, but at least doc now matches behavior of the function. :|
2015-10-13 09:59:42 +02:00
1d71ad2eaa Math Lib: Use plane intersect from graphics-gems 2015-09-04 22:13:20 +10:00
58c9a0b11a Cleanup: spelling 2015-08-22 21:17:32 +10:00
cff288cf3a Use PyC_ParseBool to parse bools
This could cause problems since they could be any int,
then passed directly to internal functions that assume bools.
2015-08-04 18:49:42 +10:00
dbee634572 Fix typos. 2015-05-04 01:53:34 +09:00
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
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
27b58f0eb2 Fix mathutils docstring typos. 2014-12-19 00:43:41 +09:00
a550d913bc Fix Python ray-cast failing to check hit direction 2014-10-08 09:47:41 +02: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
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
e73d0f57a3 Code cleanup: use 'const' for arrays (python) 2014-04-27 00:25:15 +10:00
e9a64e2770 Fix T39392: Python bindings for geometry.box_pack_2d() return invalid total height 2014-03-24 17:39:54 +01:00
61ff3dfdda Code Cleanup: spelling 2014-01-13 15:31:57 +11:00
cdeb3c3922 Fix for incorrect use of abs() in intersect_sphere_sphere_2d 2014-01-09 03:15:59 +11:00
4b30b22ecf Fix for recent kdtree py module with MSVC
also remove submodule includes from mathutils.h
2014-01-07 00:53:52 +11:00
eb4090dadf Fix missing check if isect_plane_plane_v3 fails to find an intersection. 2013-12-29 12:51:27 +11:00
c35fb528c5 Fix intersect_line_plane bug causing crash on Motion trail and other
similar potential bugs in mathutils_geometry

marking no_flip as TODO
2013-12-11 10:28:30 -02:00
2ef3f6159c Fix T37715: Incorrect docstring 2013-12-10 00:02:37 +11:00
4da651c8f0 Fix T37472: crash when packing UV islands. 2013-11-19 11:20:57 +11:00
1576565932 minor changes needed for building standalone mathutils. 2013-09-14 00:30:56 +00:00
2f6c748bb9 fix [#36020] SmartUV Project is messy on a cube
was using very simple/stupid check to rotate us islands, replace with box_fit_2d() function.

missed docstring last commit.
2013-09-11 07:10:15 +00:00
d2d1025e4a add mathutils.geometry.box_fit_2d() to wrap BLI_convexhull_aabb_fit_points_2d() 2013-09-11 06:56:51 +00:00
92d94ccb08 misc minor changes
- make cmake osx use of -ftemplate-depth match scons.
- use array size within sizeof(), more compact.
- replace AT with __func__ where the function is unique enough.
- BLI_box_pack_2D -> 2d to match other functions.
- rename new mesh normal calculation to mesh.calc_normals_split()
2013-09-10 19:23:39 +00:00
5dbe17cc12 add 2d convex hull utility function, BLI_convexhull_2d(), and python api mathutils.geometry.convex_hull_2d()
uses Andrew's monotone chain 2D convex hull algorithm.
2013-09-10 07:52:10 +00:00
8e46cf637c tweak mempool loop comparisons when we know there is no chance for skipping past the last value.
also correct typo.
2013-08-31 02:12:31 +00:00
11c988ba00 Simplify line/plane intersection, add line_plane_factor_v3().
Remove no_flip option for isect_line_plane_v3(), its quite specific and only used for ED_view3d_win_to_3d().
2013-08-31 02:06:23 +00:00
09ff49755f math api edits - replace point-normal form for a plane with dist_to_plane_v3()
also correct python mathutils api, was missing vector checks.
2013-08-23 14:37:22 +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
5018ea5e29 real fix for [#35097], (curve cap flipping).
previous commit was incorrect, the face flipping depended on the orientation of the curve.

fix by passing the bevel direction to the fill function so we can have a reliable front/back.

This also gives some speedup for all curve filling since we can avoid calculating the normal since its already known.
2013-04-26 21:04:12 +00:00
c667f1ff10 utility function volume_tetrahedron(), for mathutils and BLI math. 2013-04-21 13:24:45 +00:00
eb66c45301 correct pyapi function intersect_line_sphere_2d() using 3d vecs when only 2d are needed. 2013-04-14 11:57:35 +00:00