Commit Graph

129 Commits

Author SHA1 Message Date
40ad1cf0b1 BLI: sync changes from 2.8 2017-11-14 16:10:48 +11:00
6e0fd239e3 Math Lib: normalized vector project functions 2017-09-07 00:12:43 +10:00
1d966ca7a1 Math Lib: add angle_on_axis_v3v3_v3
Use for calculating the angle between 2 directions on an axis.

Also signed version and normalized plane projection,
use when input is normalized.
2017-06-16 01:27:58 +10:00
1dbaf0dbcc Add mid_v3_v3_array function and remove redundant functions
Other than implementing a `mid_v3_v3_array` function, this removes
`cent_tri_v3` and `cent_quad_v3` in favor of `mid_v3_v3v3v3` and
`mid_v3_v3v3v3v3` respectively.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2459
2017-01-10 19:58:34 -02:00
b32408eff8 BLI_math: move interp_*_cubic to its own function 2016-07-11 17:16:35 +10:00
6035cf05bf BLI_math: add normalize functions which fit to a length
Convenient since its common to normalize then scale,
since these are inlined, use for regular normalize w/ 1.0 length.
2016-07-08 09:52:29 +10:00
47a5d7d1bc BLI_math: Add double versions of functions
- mul_v3_m3v3_db
- mul_m3_v3_db
- negate_v3_db
2016-06-16 19:20:08 +10:00
66b12ef4ab BLI_math: cleanup arg names
project functions arg naming made it hard to tell which vector was projected onto.
2016-06-12 15:39:04 +10:00
2630207ada Fix GCC/Linux build error after finite/isfinite changes. 2016-05-17 23:40:25 +02:00
dbf1257b14 Minor optimization for scanfill
Replace angle with with cosine calculation.
2016-04-20 09:53:40 +10:00
aad24468e2 Fix T47038: Particles in Particle Edit Mode get added in completely wrong location.
It also fixes another issue (crash) related to symmetric editing.

Quite involved, we (try to!) fix complete broken logic of parts of particle code, which would use poly index
as tessface one (or vice-versa). Issue most probably goes back to BMesh integration time...

This patch mostly fixes particle editing mode:
  - Adding/removing particles when using generative modifiers (like subsurf) should now work.
  - Adding/removing particles with a non-tessellated mesh (i.e. one having ngons) should also mostly work.
  - X-axis-mirror-editing particles over ngons does not really work, not sure why currently.
  - All this in both 'modes' (with or without using modifier stack for particles).

Tech side:
  - Store a deformed-only DM in particle modifier data.
  - Rename existing DM to make it clear it's a final one.
  - Use deformed-only DM's tessface2poly mapping to 'solve' poly/tessface mismatches.
  - Make (part of) mirror-editing code able to use a DM instead of raw mesh, so that we can mirror based on final DM
    when editing particles using modifier stack (mandatory, since there is no way currently to find orig tessface
    from an final DM tessface index).

Note that this patch is not really nice and clean (current particles are beyond hope on this side anyway),
it's more like some urgency bandage. Whole crap needs complete rewrite anyway,
BMesh's polygons make it really hard to work with current system (and looptri would not help much here).

Also, did not test everything possibly affected by those changes, so it needs some users' testing & validation too.

Reviewers: psy-fi

Subscribers: dfelinto, eyecandy

Maniphest Tasks: T47038

Differential Revision: https://developer.blender.org/D1685
2016-01-04 12:19:45 +01:00
6e66ddf5ed Fix warnings and remove casts by adding copy_vx_vx_uchar() functions. 2015-10-11 02:15:44 +02:00
ecf0529efd Quiet warning 2015-09-24 15:17:02 +10:00
7837f0e833 BLI_math 'compare' cleanup & enhancements.
This commit:
* Adds a 'compare_ff' function for absolute 'almost equal' comparison of floats.
* Makes 'compare_vxvx' functions use that new 'compare_ff' one.
* Adds a 'compare_ff_relative' function for secured ulp-based relative comparison of floats.
* Adds matching 'compare_vxvx_relative' functions.
* Adds some basic tests for compare_ff_relative.

See https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Note that we could replace our python/mathutils' EXPP_FloatsAreEqual() by BLI's compare_ff_relative
(using a very small absolute max_diff), but these do not have exact same behavior...
Left a comment there for now, we can do it later if/when we are sure it won't break anything!
2015-07-10 15:02:43 +02:00
6ee653352b Math Lib: double versions of vector funcs
- add_vn_vn_d
- add_vn_vnvn_d
- mul_vn_db
2015-05-21 21:06:29 +10:00
e5e73ccc90 Math Lib: rename fill_*, to copy_*
matching convention for fixed length api, eg: copy_v3_fl
2015-05-05 17:08:29 +10:00
a4965249ec Math Lib: add range_vn_u 2015-04-28 06:54:50 +10:00
01b1eb445c Math Lib: add project_plane_v3_v3v3
Useful for projecting one vector onto another (as a plane).

This is a rather common operation,
doing inline isn't always obvious whats happening.
2015-04-08 23:01:37 +10:00
6ceb84c217 BLI math vec: add 'abs' functions to get absolute values of a vector.
Unseful when handling e.g. scale, sometimes.
2015-03-17 19:57:16 +01:00
9ffc66b1c0 Math Lib: add mid_v3_v3v3v3v3 2015-03-09 20:26:09 +11:00
225f68c324 Fix interpolation functions ignoring number of components when doing early output 2015-02-24 00:36:33 +05:00
e442b9916e BLI_math vectors: add minmax_v3v3_v3_array to get min and max values on each components of an array of 3D vectors. 2015-02-05 14:00:58 +01:00
1794186053 BLI_math: add vector's dot_v3v3v3() func, for when you have three points instead of two vectors. 2015-01-09 13:03:55 +01:00
f745564e4e GSOC 2013 paint
Yep, at last it's here!

There are a few minor issues remaining but development can go on in
master after discussion at blender institute.

For full list of features see:

http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Painting

Thanks to Sergey and Campbell for the extensive review and to the
countless artists that have given their input and reported issues during
development.
2014-07-21 12:02:05 +02:00
9c48ea3979 Math Lib: add function to get signed angle about an axis 2014-07-09 11:15:08 +10:00
c6a34e047c Correct ortho_v2_v2 arg size 2014-05-27 14:42:22 +10:00
35380cdcad Fix for uninitialized unit_use_radians variable with inset and bevel 2014-05-06 19:20:03 +10:00
233dac1494 Math Lib: increase epsilon for ortho_basis_v3v3_v3
passing in a unit length vector wouldn't always compute unit length vectors because the epsilon tested was too small.
2014-04-16 21:07:28 +10:00
5770d691bb Optimize BLI_convexhull_aabb_fit_hull_2d, avoid atan2, sin, cos
add utility functions for using a 2d unit vector as a rotation matrix
mul_v2_v2_cw & mul_v2_v2_ccw
2014-04-03 21:47:03 +11: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
a6e8137983 Convenience macro for print_ funcs, saves passing id each time 2014-03-30 15:04:20 +11:00
5981567ec6 Code cleanup: use len_v2v2_int for view zoom-scale 2014-03-28 15:02:57 +11:00
0e9084d5ec Fix T39210: Grid Fill is generating mesh that's inconsistent with selected edge loops
Issue was in BLI's rotation_between_vecs_to_quat(), which did not handled correctly cases where both vectors are colinear.

Patch by Campbell Barton and me.

Issue originaly tracked down by Yan Shi, many thanks!
2014-03-16 16:31:19 +01:00
2f01be2b2f UI: panel tabs, use simple color interpolation that ignores alpha 2014-02-10 17:06:56 +11:00
07ceb99213 Code Cleanup: use strict flags for math lib, add inline declarations 2013-12-06 03:57:17 +11:00
f3d13bec6d Code Cleanup: correct fabsf/fabs/abs use 2013-12-04 09:24:38 +11:00
13896063bc Math library: minor additions sqrtf_signed and copy_v2_fl2 2013-11-26 20:53:26 +11:00
4c01709018 Math Library: add dot_m4_v3_row_x/y/z 2013-11-20 11:48:12 +11:00
c80c1c6f5c add copy_v4_fl4, replace QUATSET macro. 2013-10-22 03:31:21 +00:00
fc8b0ed5e5 Move utility functions from mball to mathutils 2013-10-18 23:38:51 +00:00
35b61a7512 Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers
to use special compiler's hints use a special file where
all things like this are concentrated.

Makes code easier to follow and allows to manage special
attributes in more efficient way.

Thanks Campbell for review!
2013-09-01 15:01:15 +00:00
38338a51c9 add is_finite_v# functions, use bool's 2013-08-20 09:34:52 +00:00
83617429cf Fix build warnings with clang and UNUSED_RESULT_ATTR (attribute declaration must precede definition). 2013-08-05 12:49:13 +00:00
e03b1668e0 code cleanup: remove unused functions
- IsectLLPt2Df
- isect_point_quad_uv_v2
- isect_point_face_uv_v2

These are obsoleted by resolve_tri_uv, resolve_quad_uv

also add attributes for unused function results for some math functions.
2013-08-01 17:15:11 +00:00
76e989d7b1 function renaming for own recently added BLI_math functions, suggested by Brecht. 2013-07-30 10:58:36 +00:00
c754eaa0f9 add inline functions getting a single axis from mul_m3_v3() 2013-07-28 19:46:33 +00:00
e6b22d287f utility function for printing arbitrary sizes vectors. 2013-07-11 15:32:26 +00:00
8b2c5e693c Fix #35634: weight paint did not do z-buffer culling anymore on Windows after recent change to size of bool. 2013-06-13 17:11:09 +00:00
0ee45c9301 more optimal method of calculating the normal for the solidify modifier.
When adding 2 unit length vectors, the length can be used to calculate the angle.
2013-05-08 14:33:02 +00:00