Campbell Barton
535de7ec1f
Comment for math defines, also add M_PI_4
2015-02-01 00:37:55 +11:00
Campbell Barton
01c04333f5
Fix T43034: beautify-fill leaves zero area tri's
2014-12-27 16:47:42 +11:00
Campbell Barton
25c5542fe7
Math Lib: add constant: M_SQRT1_3 1/sqrt(3)
2014-11-22 18:21:52 +01:00
Sergej Reich
52d571e189
Avoid calling powf with integer exponent in more places
...
Move powX functions from particle code into math library and use them.
2014-11-11 18:16:20 +01:00
Sergey Sharybin
504370cafb
Code cleanup: Fix silly duplication of typecheck and swap macro
2014-10-10 21:13:19 +06:00
Sv. Lockal
5ecbd5c871
Use native float math functions for MSVC12
...
`double` surrogates are slow (e.g. pow is 2x slower than powf), and MSVC12
supports fp-math functions from C99.
2014-09-30 13:39:03 +04:00
Campbell Barton
28054d8e38
remove MAXFLOAT define
2014-08-14 10:36:07 +10:00
Thomas Dinges
e3ed13cbd4
Cleanup: Remove special code for Visual Studio 2008.
...
Goodbye VC2008, it has been a pleasure (more or less) :D SCons / CMake cleaenup will follow.
Differential Revision: https://developer.blender.org/D715
2014-08-07 13:52:15 +02:00
Campbell Barton
88a0d5ebe8
Make CHECK_TYPE_NONCONST macro portable
...
also replace __typeof -> typeof
2014-08-02 18:08:44 +10:00
Sergey Sharybin
9531091eb8
Fix compilation error with debug SCons
...
For some reason SCons defines _DEBUG, not DEBUG as mathutils was
expecting it to be.
Made it so mathutils checks for NDEBUG which mimics BLI_assert
define.
2014-05-13 19:52:50 +02:00
Campbell Barton
a51a0ca772
Math Lib: add shell_v3v3_normalized_to_dist and v2 version
...
bypass angle calculation to avoids (asin, sqrt, cos).
2014-04-19 22:17:10 +10:00
Campbell Barton
fabc46b41f
Math Lib: add rotation_between_vecs_to_mat3
...
- behaves like rotation_between_vecs_to_quat
- avoids calling sin,cos calls (approx 1.6x faster).
2014-04-19 15:36:47 +10:00
Campbell Barton
c04e73f386
Math Lib: use less strict epsilon with BLI_ASSERT_UNIT_QUAT
...
was causing issues with pointcache
2014-04-11 18:20:30 +10:00
Campbell Barton
2a82b8ade5
Math Lib: add power of 2 min/max for unsigned ints
2014-04-05 21:54:20 +11:00
Campbell Barton
c6252d6e60
Math Lib: add angle_qt functions
2014-03-20 15:15:29 +11:00
Thomas Dinges
aa517ab3a4
Compile fix for 004decc1d940...
2014-02-15 14:38:49 +01:00
Campbell Barton
004decc1d9
Code cleanup: warnings
2014-02-15 18:21:07 +11:00
Campbell Barton
da8619fe23
Math Lib: add iroundf function for: (int)floorf(a + 0.5f)
2014-01-15 13:40:40 +11:00
Campbell Barton
a288644b1e
Code Cleanup: WIN32 defines, check for _MSC_VER instead of !FREE_WINDOWS
2014-01-03 20:46:12 +11:00
Martijn Berger
46a3752a1f
Fix :I broke the build for MSVC 2008 this fixes it
2014-01-02 23:32:44 +01:00
Martijn Berger
1c8a12ee61
Fix T37987: MSVC 2013 has C99 headers and warns for out define hypot _hypot for good reason it seems
2014-01-02 22:19:10 +01:00
Campbell Barton
f64b3732be
Util Macros: reduce multiple access & conversion for CLAMP/CLAMPIS/ABS
2013-12-07 14:29:27 +11:00
Campbell Barton
07ceb99213
Code Cleanup: use strict flags for math lib, add inline declarations
2013-12-06 03:57:17 +11:00
Alexandr Kuznetsov
e2429d6492
Woo Hoo. First git commit.
...
Changes for VC2013
Now, I can build Blender with VC2013 with Cycles, Collada, OpenExr,OpenImageIO disabled. Also, you need VC2008 sp1 installed to make old libs compatible.
2013-11-29 15:13:12 -05:00
Campbell Barton
13896063bc
Math library: minor additions sqrtf_signed and copy_v2_fl2
2013-11-26 20:53:26 +11:00
Campbell Barton
3b72f1824c
rename positive_mod to mod_i, make it work with nagative numbers (matching pythons modulo), and use in a few more places.
...
allow mesh-checker-deselect to have a negative offset.
2013-09-05 20:54:32 +00:00
Campbell Barton
96c668b1dd
add positive_mod() utility function.
2013-09-05 10:12:00 +00:00
Campbell Barton
5096beb4a5
use __builtin_nanf with gcc and clang.
2013-08-13 10:40:23 +00:00
Lukas Toenne
4d5c64372a
Moved NAN_FLT define to BLI_math, this may come in useful.
2013-08-13 10:09:27 +00:00
Campbell Barton
562ed2b42e
add in asserts when rv3d->viewmatob, rv3d->persmatob are not initialized.
...
This is often hard to spot since in many cases it works correctly even
when not initialized but may still fail in other situations.
2013-05-08 13:00:52 +00:00
Brecht Van Lommel
c2d5c72245
Fix part of #34640 : colors darkening when using the vertex paint blur tool.
...
The problem was that vertex colors only have 8 bits of precision, and integer
division always rounds down, so after some color blending iterations everything
gets darker. Instead use integer division that behaves like round() instead of
floor() for blending operations.
2013-04-25 14:16:22 +00:00
Campbell Barton
80de3192a7
attempt to quiet warnings for gcc4.2
2013-03-13 15:41:14 +00:00
Campbell Barton
660be3da39
use gcc warning -Wredundant-decls, exposes some odd/duplicate declarations which have been removed.
2013-03-11 20:27:38 +00:00
Campbell Barton
917252175d
internal: increase error threshold for normalize assert since normals converted from shorts are not always exactly unit length.
2013-02-19 14:14:37 +00:00
Campbell Barton
f784856906
make asserts that check for unit length vectors into a macro.
...
this was really not nice logic to try to fit into an assert.
2013-02-19 13:15:34 +00:00
Brecht Van Lommel
08bc601aa5
Fix warnings about undefined _POSIX_C_SOURCE with gcc 4.2 on Mac.
2013-01-25 13:51:49 +00:00
Campbell Barton
c411cde415
header cleanup, include BLI before BKE, also use bool for ntreeShaderExecTree
2013-01-24 21:57:13 +00:00
Sv. Lockal
7539009d5b
Do not redefine math functions for floats if compiler complies with C99 or POSIX.1-2001
...
This is useful for gcc which does not define sqrtf/powf/... functions with preprocessor and therefore always used sqrt/pow/...
Float functions are generally 20-50% faster than their equivalents for double type.
2013-01-24 20:54:12 +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
Campbell Barton
f70d2c65d8
rename api functions...
...
- minf, maxf, mini, maxi --> min_ff, max_ff, min_ii, max_ii
2012-10-23 13:28:22 +00:00
Campbell Barton
25c96bc9f3
code cleanup: remove unused macros, commet some which may be useful later - or good to keep for completeness. quieted some warnings and add flags -Wmissing-include-dirs and -Wno-div-by-zero to cmake/gcc
2012-09-20 01:02:39 +00:00
Campbell Barton
a9f10b6bc2
style cleanup
2012-09-08 06:40:03 +00:00
Campbell Barton
a3c4b0f47d
make SWAP macros typesafe using CHECK_TYPE macro.
...
Its unlikely you want to do short -> int, int -> float etc, conversion during swapping (if its needed we could have a non type checking macro).
Double that the optimized assembler outbut using SWAP() remains unchanged from before.
This exposed quite a few places where redundant type conversion was going on.
Also remove curve.c's swapdata() and replace its use with swap_v3_v3()
2012-08-25 20:16:08 +00:00
Campbell Barton
ceea98be2f
math lib changes from tomato
2012-05-31 11:57:09 +00:00
Campbell Barton
2ab62ce126
code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function.
...
... without this some editors dont parse the source so well.
2012-05-27 12:21:13 +00:00
Campbell Barton
9892736206
code cleanup: header cleanup and remove some duplicate defines.
2012-05-12 20:39:39 +00:00
Campbell Barton
4f19c1a995
spelling cleanup
2012-03-18 07:38:51 +00:00
Campbell Barton
2b7ca2304a
unify include guard defines, __$FILENAME__
...
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Campbell Barton
2253b63c97
static functions for getting power of 2 values were being copied about too much, add to the BLI_math api.
...
- is_power_of_2_i
- power_of_2_min_i
- power_of_2_max_i
2011-12-16 09:25:07 +00:00
Campbell Barton
4a04f72069
remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n
2011-10-23 17:52:20 +00:00