Commit Graph

86 Commits

Author SHA1 Message Date
cda4cd0705 Cleanup: comments (long lines) in blenlib 2019-04-22 06:30:08 +10:00
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
0e68751b8a Fix BLI_ASSERT_UNIT macro w/ non-finite numbers 2018-06-06 19:49:27 +02:00
995ccf8168 BLI_assert: extract from BLI_utildefines
BLI_utildefines is quite large, defining many unrelated things.
Add BLI_assert to include in inline headers, so math defines don't
pull in too much.
2018-03-16 06:03:29 +11:00
c09e4ae08a Math utils: Add clamping functions 2018-02-14 11:21:27 +01:00
Dalai Felinto
431d5772bb Fixup for integer digits commit 2018-01-19 17:04:19 -02:00
f0610563ee math utils: Add size_t version of min and max functions 2018-01-10 11:06:44 +01:00
43b4913051 Math Lib: Add non-clamped round_* functions
Replace iroundf with round_fl_to_int, add other types
2017-09-27 11:13:03 +10:00
c4fc9c4a8e Math Lib: clamped rounding utility functions 2017-09-18 23:55:41 +10:00
c1e177ad29 BLI_math: add simple helper to get amount of 'integer' digits in a float number. 2017-08-01 16:34:02 +02:00
1a01ef4ae9 Fix macOS build with openimageio 1.7.8 and openexr.
These macros conflict and are no longer needed with C99 or C++ anyway.
2016-12-03 15:19:49 +01:00
21fddf7d1c C99/C++11: replace deprecated finite() by isfinite(). 2016-05-17 21:39:16 +02: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
74b32a23f7 Cleanup: checks for unsupported MSVC versions 2015-06-20 15:17:32 +10:00
bdf6393c98 Math Lib: pow_i for int power-of 2015-04-24 11:37:48 +10:00
c9f9e29538 Math Lib: handling bits handling into own file 2015-04-22 04:44:24 +10:00
535de7ec1f Comment for math defines, also add M_PI_4 2015-02-01 00:37:55 +11:00
01c04333f5 Fix T43034: beautify-fill leaves zero area tri's 2014-12-27 16:47:42 +11:00
25c5542fe7 Math Lib: add constant: M_SQRT1_3 1/sqrt(3) 2014-11-22 18:21:52 +01:00
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
504370cafb Code cleanup: Fix silly duplication of typecheck and swap macro 2014-10-10 21:13:19 +06:00
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
28054d8e38 remove MAXFLOAT define 2014-08-14 10:36:07 +10:00
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
88a0d5ebe8 Make CHECK_TYPE_NONCONST macro portable
also replace __typeof -> typeof
2014-08-02 18:08:44 +10:00
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
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
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
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
2a82b8ade5 Math Lib: add power of 2 min/max for unsigned ints 2014-04-05 21:54:20 +11:00
c6252d6e60 Math Lib: add angle_qt functions 2014-03-20 15:15:29 +11:00
aa517ab3a4 Compile fix for 004decc1d940... 2014-02-15 14:38:49 +01:00
004decc1d9 Code cleanup: warnings 2014-02-15 18:21:07 +11:00
da8619fe23 Math Lib: add iroundf function for: (int)floorf(a + 0.5f) 2014-01-15 13:40:40 +11:00
a288644b1e Code Cleanup: WIN32 defines, check for _MSC_VER instead of !FREE_WINDOWS 2014-01-03 20:46:12 +11:00
46a3752a1f Fix :I broke the build for MSVC 2008 this fixes it 2014-01-02 23:32:44 +01:00
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
f64b3732be Util Macros: reduce multiple access & conversion for CLAMP/CLAMPIS/ABS 2013-12-07 14:29:27 +11:00
07ceb99213 Code Cleanup: use strict flags for math lib, add inline declarations 2013-12-06 03:57:17 +11:00
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
13896063bc Math library: minor additions sqrtf_signed and copy_v2_fl2 2013-11-26 20:53:26 +11:00
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
96c668b1dd add positive_mod() utility function. 2013-09-05 10:12:00 +00:00
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
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
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