Commit Graph

91 Commits

Author SHA1 Message Date
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
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
86f8470a5d Some knife fixes. Avoids duplicating verts; better handling of cut-through ortho.
Now cut lines detect vertices that they pass (almost) exactly over
and snap to them, to avoid making verts vert close to other ones.

Added radius arg to BKE_bmbvh_ray_cast so that can detect an obscuring
face when the ray might otherwise go exactly between two triangles.
Needed an isect_line_tri_epsilon function for similar reason.

Fixes last part of bug #35002. Other knife bugs still present but
getting this commit in now before continuing bug fixing.
2013-08-30 16:34:44 +00:00
6f26acb009 simplify dist_to_plane_v3 and add dist_squared_to_plane_v3 2013-08-23 15:19:20 +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
77fa1aaab5 modify closest_to_plane_v3 not to use point-normal form. 2013-08-23 05:15:12 +00:00
2ee6c0ac6b add utility functions for dealing with planes
- plane_point_side_v3(), a bit like line_point_side_v2()
- isect_point_planes_v3(), moved from paint_hide.c

functions to convert between point/normal pairs.
- plane_from_point_normal_v3()
- plane_to_point_normal_v3()
2013-08-22 15:30:24 +00:00
ccc1fc1499 minor internal change: isect_point_poly_v2 was assigning a value past the array bounds,
not that bad since it wasn't read but this isnt good practice and its simple to avoid.
2013-08-21 23:33:50 +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
55c79821b9 optimize interp_weights_poly_v2(), well tested, was calculating the area twice as much as was needed. 2013-07-12 00:18:27 +00:00
a91964e0e2 code cleanup: use boolean for intersection functions. 2013-06-09 21:25:27 +00:00
4392fc6f1d Optimize BKE_mesh_calc_normals(), gives approx 25% speedup.
- no need to allocate polygon normal array.
- no need to use BLI_array_ functions (realloc's).
- reduce some of the looping.
2013-05-10 10:07:01 +00:00
556705f84e add clip_segment_v3_plane_n() to clip a line segment to planes (as used for view clipping).
use in ED_view3d_win_to_segment_clip() and fix error, was clipping by only 4 planes rather then 6.
2013-04-22 19:39:10 +00:00
c667f1ff10 utility function volume_tetrahedron(), for mathutils and BLI math. 2013-04-21 13:24:45 +00:00
8655be437d code cleanup: use bool where values are true/false, for view3d and related functions. 2013-03-20 23:14:18 +00:00
113f2367a0 move polygon intersection out of BLI_lasso into BLI_math_geom since its a generally useful function.
adds:
- isect_point_poly_v2()
- isect_point_poly_v2_int()
2013-03-14 21:44:16 +00:00
80de3192a7 attempt to quiet warnings for gcc4.2 2013-03-13 15:41:14 +00:00
660be3da39 use gcc warning -Wredundant-decls, exposes some odd/duplicate declarations which have been removed. 2013-03-11 20:27:38 +00:00
79e80d8322 code cleanup: ~400 duplicate lines for AO form factor math. 2013-03-03 05:07:58 +00:00
10305de3ac Fix "Origin to Center of Mass" not working well with ngons
Now we do simple triangulation and calculate signed area of triangles to
account for concave polygons.

This only works correct for planar polygons but gives better results
overall.
2013-02-14 17:35:46 +00:00
d65135ed93 correct arg order in header for isect_point_tri_v2(), Made for confusing calltips. 2013-02-10 08:21:39 +00:00
d03befd0db fix for is_quad_convex_v3(), getting the dominant axis wasn't accurate enough in some cases and would make beauty fill fail.
now rotate the coords before calculation.
2013-02-09 07:59:56 +00:00
bb22b7c580 add dist_to_line_v3() for completeness, (had dist_to_line_v2 already) 2013-02-03 07:24:31 +00:00
7c64109bce bmesh todo: uv stretch area draw mode wasn't calculating ngon area - added area_poly_v2(). 2013-01-10 08:16:19 +00:00
0e26a67c85 add area_poly_v3_max() for use with area_poly_v3 2013-01-07 12:16:11 +00:00
66e70e6caa Add function to find closest point in triangle to another point
New function is closest_to_tri_v3() in BLI_math_geom.
2012-12-30 18:23:03 +00:00
1d6c3ccf09 display the number of tri's in object mode status, often requested feature from users who model for realtime/game-engine output,
the total number of faces wasn't so useful and could be especially misleading with ngons.
2012-12-27 03:51:45 +00:00
7c699a217a define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00
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
987f6a7d4f code cleanup: move local math functions into math_geom.c, math_vector.c, no functional changes. 2012-11-15 13:24:14 +00:00
879d92062a code cleanup: move doxy comments into the C files. 2012-10-24 06:08:28 +00:00
2da6039e63 rename axis_primary_v3() to max_axis_v3() to avoid confusion with axis_dominant_v3(). also add min_axis_v3(). 2012-10-24 02:25:00 +00:00
e038a1c613 reduce float comparisons for keying operation and despill. 2012-10-23 16:32:39 +00:00
b131359834 Fix #32867: normal map baking issue with flat shaded faces since bmesh. Also
removed the old unused normal map tangent computation code.
2012-10-23 14:57:49 +00:00
92205486e7 Masks: feather self-intersection collapse function
This implements simple function which collapses internal loops
caused by self-intersections into a singularity.

This loops can't be removed because rasterizer expects points
of feather be aligned with points from spline itself.
2012-07-16 17:54:28 +00:00
9a385d12e3 add 2d version of interp_weights_poly_v3 2012-07-16 10:36:40 +00:00
6f01b0b11f small speedup for mask rasterizer, only do single sided check for triangle intersection. 2012-07-16 06:39:40 +00:00
380c5d66a8 math function to get the intersection point between 2 lines (not 2 segments which we already have). 2012-07-15 11:35:13 +00:00
a52153a618 mask rasterization: use a simpler method to check if a bucket intersects with a triangle. 2012-07-14 18:42:59 +00:00
9e09005e49 add is_quad_convex_v2(), SET_UINT_IN_POINTER, GET_UINT_FROM_POINTER macros & some minor edits. 2012-07-14 00:33:58 +00:00
73c2abe83d new function barycentric_weights_v2_quad(), like barycentric_weights_v2 but for quads.
takes vecs and a point and assigns 4 weights, needed for nice quad interpolation for mask feathering.
2012-07-13 09:19:05 +00:00
0085c7110b Code cleanup: move PBVH ray/AABB intersection test to BLI_math_geom 2012-07-05 03:55:55 +00:00
ceea98be2f math lib changes from tomato 2012-05-31 11:57:09 +00:00
9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
e701f9b670 style cleanup: whitespace / commas 2012-04-29 15:47:02 +00:00
8646bb4464 workaround [#30480] Knife tool flicker
the problem was numeric precision when in ortho mode the start/end points for the view vector would be 2000 apart which caused trouble for the intersection test.
2012-03-13 01:11:08 +00:00
07ffbbfcb6 better fix for [#30529], find the right axis rather then checking for folded quads. 2012-03-12 21:38:13 +00:00
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
7bbf4b7831 style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
2012-03-02 16:05:54 +00:00
ed04c21374 code cleanup: use float vector size in function definitions, and const's where the values are unchanged. 2012-02-28 14:05:00 +00:00