Commit Graph

82 Commits

Author SHA1 Message Date
Campbell Barton
c31aae0487 Use fabsf for floats 2015-03-19 06:13:50 +11:00
Bastien Montagne
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
Bastien Montagne
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
Campbell Barton
4a92620d3e Comments: clarify math lib 2014-09-28 15:08:55 +10:00
Campbell Barton
1dd17bed4a Knife tool: simplify hit-depth calculation 2014-08-17 12:50:48 +10:00
Bastien Montagne
74758576fc Cleanup: general cleanup in BLI_math code (mostly, use 'const' where possible, true/false for booleans, format for float litterals). 2014-07-30 12:19:41 +02:00
Campbell Barton
d9f39257f4 Math Lib: add compare_len_squared_v3v3 from paint branch 2014-07-14 11:55:38 +10:00
Campbell Barton
d56e6bf1bf Math Lib: accept a limit of 0.0 when comparing vectors 2014-07-14 11:33:19 +10:00
Campbell Barton
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
Campbell Barton
5981567ec6 Code cleanup: use len_v2v2_int for view zoom-scale 2014-03-28 15:02:57 +11:00
Campbell Barton
07ceb99213 Code Cleanup: use strict flags for math lib, add inline declarations 2013-12-06 03:57:17 +11:00
Campbell Barton
f3d13bec6d Code Cleanup: correct fabsf/fabs/abs use 2013-12-04 09:24:38 +11:00
Campbell Barton
13896063bc Math library: minor additions sqrtf_signed and copy_v2_fl2 2013-11-26 20:53:26 +11:00
Campbell Barton
4c01709018 Math Library: add dot_m4_v3_row_x/y/z 2013-11-20 11:48:12 +11:00
Campbell Barton
c80c1c6f5c add copy_v4_fl4, replace QUATSET macro. 2013-10-22 03:31:21 +00:00
Sergey Sharybin
fc8b0ed5e5 Move utility functions from mball to mathutils 2013-10-18 23:38:51 +00:00
Campbell Barton
38338a51c9 add is_finite_v# functions, use bool's 2013-08-20 09:34:52 +00:00
Campbell Barton
76e989d7b1 function renaming for own recently added BLI_math functions, suggested by Brecht. 2013-07-30 10:58:36 +00:00
Campbell Barton
c754eaa0f9 add inline functions getting a single axis from mul_m3_v3() 2013-07-28 19:46:33 +00:00
Brecht Van Lommel
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
Campbell Barton
b77acc2879 add 2d length functions for testing pixel coords. len_manhattan_v2_int, len_manhattan_v2v2_int 2013-04-11 02:23:45 +00:00
Antony Riakiotakis
1fea6220a2 Woot woot commit.
Stencil style texture mapping. Ready for field testing and user feedback.

This commit adds stencil like brushes, like those that existed on old ptex branch.
(with the exception of clip colour)
To control the position of the stencil, you use

Q: translation
Shift - Q: scaling
Ctrl - Q: rotation

There's extra work that has been done to make this work:

* Support for coloured overlay in vertex/texture painting
* Also made A button do stroke mode selection like in sculpt mode,
when mask painting is inactive.

There are some TODOs to work on during bcon3:

* Support tiled and stencil mode in 2D painting. Support alpha textures also.
* Tidy up overlay code. There's some confusion there due
to the way we use the primary brush texture sometimes for alpha, other times
for colour control.

WIP design docs will be in

http://wiki.blender.org/index.php/User:Psy-Fi/New_Brush_Tool_Design
2013-03-31 00:38:50 +00:00
Campbell Barton
2433404e4b add inline function mul_project_m4_v3_zfac() to get the z-depth value from a vector & mat4x4 2013-03-09 15:39:24 +00:00
Campbell Barton
2005f7c6c0 style cleanup: also some typos 2013-02-11 00:49:00 +00:00
Campbell Barton
e9a4dd202e fix for fix, ugh!, vertex slide with concave/convex ngons & normal flipping should now work properly in all cases.
... somehow I managed to make test-cases that worked in previous commits but failed in other cases.
2013-01-29 05:18:30 +00:00
Campbell Barton
9090049505 code cleanup 2012-12-23 16:09:26 +00:00
Campbell Barton
7c699a217a define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00
Jason Wilkins
69b88cf719 Patch [#33196] Warning Fixes 11-16-2012
* MEM_CacheLimitier - Size type to int conversion, should be safe for now (doing my best Bill Gates 640k impression)
* OpenNL CMakeLists.txt - MSVC and GCC have slightly different ways to remove definitions (DEBUG) without the compiler complaining
* BLI_math inlines - The include guard name and inline option macro name should be different. Suppressed warning about not exporting any symbols from inline math library
* BLI string / utf8 - Fixed some inconsistencies between declarations and definitions
* nodes - node_composite_util is apparently not used unless you enable the legacy compositor, so it should not be compiled in that case.

Leaving out changes to BLI_fileops for now, need to do more testing.
2012-11-23 15:12:13 +00:00
Daniel Genrich
cb634b9100 Google Summer of Code project: "Smoke Simulator Improvements & Fire".
Documentation & Test blend files:
------------------
http://wiki.blender.org/index.php/User:MiikaH/GSoC-2012-Smoke-Simulator-Improvements

Credits:
------------------
Miika Hamalainen (MiikaH): Student / Main programmer

Daniel Genrich (Genscher): Mentor / Programmer of merged patches from Smoke2 branch
Google: For Google Summer of Code 2012
2012-10-10 13:18:07 +00:00
Campbell Barton
c3ca19800c refactor screen foreach functions to accept float[2] arguments rather then int pairs.
overall means less converting between float and int (and short in some cases).
2012-10-10 01:22:19 +00:00
Campbell Barton
4cc29110aa fix writing past array bounds in imagewraposa().
also correct array sizes in othere areas.
2012-10-06 12:04:09 +00:00
Campbell Barton
db051f2b2d fix MESH_OT_tris_convert_to_quads() limit options (uv and vertex color) were not working at all. 2012-09-19 04:48:34 +00:00
Campbell Barton
df51ab27ed code cleanup: BM_face_legal_splits() was doing some redundant assignments. 2012-09-05 23:22:47 +00:00
Campbell Barton
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
Campbell Barton
e1241030db yse BLI_math for the compositor in more places. 2012-06-12 20:04:55 +00:00
Campbell Barton
305d341ec2 code cleanup: use vector math function minmax_v3v3_v3() and other minor vector function edits. 2012-05-13 11:05:52 +00:00
Campbell Barton
67f8e3a3a7 inline function for "Newell's Method" used for normal calc. 2012-04-16 16:49:37 +00:00
Antony Riakiotakis
eb10402365 Fix #30638 and part of #30646.
Problem was that area calculation of polygons was done relative to the xy plane, and with a very obscure (to me at least) algorithm. That meant that vertical ngons would get 0 area. 

Commented initial code in case this is a strange optimization case that someone wants to use and used a cleaner algorithm: first project vertices to the ngon plane, defined by the normal of the ngon and the center (mean) of the ngon vertices. This will only be exact for convex and mostly planar ngons, still it is much better than the previous code.

Also fixed memory leak when stretch display was on.
2012-03-25 19:02:28 +00:00
Campbell Barton
3f56ee3da7 style cleanup: issues missed last commit 2012-03-25 15:56:17 +00:00
Campbell Barton
53d32a0bd2 style cleanup: conform to style guide - mostly operator whitespace changes 2012-03-25 12:41:58 +00:00
Campbell Barton
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +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
dfdfa3d51b code cleanup: replace macros VECCOPY, VECADD, VECSUB, INPR - with BLI_math funcs.
added copy float/double funcs: copy_v3fl_v3db(), copy_v3db_v3fl(). 2d & 4d too.
2012-03-09 06:04:17 +00:00
Campbell Barton
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
Nicholas Bishop
b18794c3b6 Add blenlib function to initialize vectors from a single float.
The new functions are copy_v2_fl, copy_v3_fl, and copy_v4_fl.
2012-02-29 04:17:26 +00:00
Campbell Barton
c955272ec5 code cleanup
* correct cmake/clang warning.
* use same include guard names as everywhere else for BLI math inline.
* correct define for madd_sh_shfl
2012-02-25 09:02:05 +00:00
Campbell Barton
fe71f40f88 misc changes from bmesh, syncing across to trunk, no functional changes 2012-01-20 02:24:01 +00:00
Antony Riakiotakis
a8081c1d2b Uv Tools branch GSOC 2011
=========================
Documentation: http://wiki.blender.org/index.php/User:Psy-Fi/UV_Tools

Major features include:

*16 bit image support in viewport
*Subsurf aware unwrapping
*Smart Stitch(snap/rotate islands, preview, middlepoint/endpoint stitching)
*Seams from islands tool (marks seams and sharp, depending on settings)
*Uv Sculpting(Grab/Pinch/Rotate)

All tools are complete apart from stitching that is considered stable but with an extra edge mode under development(will be in soc-2011-onion-uv-tools).
2012-01-17 16:31:13 +00:00
Campbell Barton
c993ee678a new math utility function isect_plane_plane_v3 2011-11-13 16:28:52 +00:00
Campbell Barton
96d73bfdcf replace VECCOPY with copy_v3_v3, same for 2d copy, also added vec copy functions for int & char. 2011-11-07 01:38:32 +00:00