Commit Graph

282 Commits

Author SHA1 Message Date
3c05662f5e fix error where BKE_mesh_cd_validate layer renaming would use invalid index values. from r60260
also correct some comments.
2013-09-25 11:11:41 +00:00
1576565932 minor changes needed for building standalone mathutils. 2013-09-14 00:30:56 +00:00
65fcc29d0c missing NULL check in recent commit, also skip some calculations in mean_value_half_tan functions for degenerate cases. 2013-09-07 06:56:27 +00:00
6439ae9d51 fix for barycentric_weights_v2_quad() divide by zero when the location we're checking the weight of touches one of the weighting coords exactly. 2013-09-06 05:44:18 +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
33e0bc6b48 code cleanup: avoid sqrt in isect_seg_seg_v2_point 2013-07-19 10:39:37 +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
a3a4386991 fix [#36105] Bevel UV Flicker
interp_weights_poly_v2/3 functions used much too small an epsilon value, caused flickering.
2013-07-11 15:57:22 +00:00
a02d256f5e fix [#35987] bevel gives nan vertices
The line intersection function bevel uses could give nan intersections.
2013-07-05 00:30:00 +00:00
fad1da062d correct typos in comments. 2013-06-25 22:58:23 +00:00
2df82a2a2b Code cleanup: fix some vs2012 compiler warnings 2013-06-21 12:33:19 +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
2a78a14369 knife sort_by_frac_along was re-calculating the reference factor for every test, change to only calculate once and use line_point_factor_v3().
also add zero division check for line_point_factor_v3() since the 2d version already checked for this.
2013-05-03 05:57:33 +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
bf51e80799 code cleanup: remove duplicate function _det_m3(), clip_line_plane was copying a vector for no reason. 2013-04-22 18:32:06 +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
6a51379bf7 tweaks to clang so blender can build with -Werror 2013-03-14 07:25:54 +00:00
ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
8db7a34167 math: Use len_v3() instead of normalize_v3() for area calculation
We only need the length, avoids unnecessary calculations.
2013-03-07 19:16:02 +00:00
79e80d8322 code cleanup: ~400 duplicate lines for AO form factor math. 2013-03-03 05:07:58 +00:00
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
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
e3944f5bfa Divide by 3 instead of multiplying by variations of 0.333
Fixes small precision problems.
2013-02-14 17:35:43 +00:00
3cf0c93be1 modify own changes to is_quad_convex_v3() to allow quads with a co-linear side to be considered convex (as it did in last release).
this is needed so zero area faces be dealt with by beauty fill.
2013-02-14 09:17:50 +00:00
0e740f58ba make is_quad_convex_v3() more strict, check if normal is OK before using as a rotation axis.
make is_quad_convex_v2,3() check for ISECT_LINE_LINE_CROSS intersection (that the lines actually cross each other).
2013-02-13 03:13:12 +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
518bfbb1c9 style cleanup 2013-02-02 04:58:03 +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
682df047a0 style cleanup 2013-01-08 02:06:16 +00:00
08358a60b0 style cleanup 2013-01-08 01:48:14 +00:00
44ab30caf6 comment fix.
Looks like no scaling is done elsewhere on blender for this code. I hope
this bug is squashed for good.
2013-01-07 21:56:13 +00:00
c3b5c726c7 * Fix for #31581. The issue was that we scaled the face prior to
projecting it. The original paper suggests to simply interpolate between
the two points of an edge if the distance of the point to that edge is
smaller than a threshold.

* Fixed both 3D and 2D code to utilize this. Possibly other places in
blender where this scaling is done will have to be adjusted.

* Changed vertex interpolation to use 2D interpolation, since it already
did projection on plane and 2d calculations are faster.

* Also added notifier on hard recalc when uvcalc_transfor_correction is
used. Results in instant feedback on UV editor when edge sliding.
2013-01-07 21:42:40 +00:00
0e26a67c85 add area_poly_v3_max() for use with area_poly_v3 2013-01-07 12:16:11 +00:00
6747dec926 style cleanup 2013-01-07 03:24:22 +00:00
ec1681fae7 style cleanup 2013-01-02 01:49:07 +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
4a427d8e0d style cleanup 2012-12-29 01:54:58 +00:00
b2c66e268f replace MIN/MAX 3,4 with inline functions 2012-12-21 05:07:26 +00:00
7c699a217a define the size of matrix args for both rows/cols. 2012-12-11 14:29:01 +00:00