[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59782] trunk/blender/source/blender: replace sqrt(dot()) with length functions.
Campbell Barton
ideasman42 at gmail.com
Wed Sep 4 00:32:04 CEST 2013
Revision: 59782
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59782
Author: campbellbarton
Date: 2013-09-03 22:32:03 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
replace sqrt(dot()) with length functions.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/collision.c
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
trunk/blender/source/blender/modifiers/intern/MOD_array.c
trunk/blender/source/blender/render/intern/source/shadeoutput.c
Modified: trunk/blender/source/blender/blenkernel/intern/collision.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/collision.c 2013-09-03 22:22:45 UTC (rev 59781)
+++ trunk/blender/source/blender/blenkernel/intern/collision.c 2013-09-03 22:32:03 UTC (rev 59782)
@@ -281,7 +281,7 @@
/* Decrease in magnitude of relative tangential velocity due to coulomb friction
* in original formula "magrelVel" should be the "change of relative velocity in normal direction" */
- magtangent = min_ff(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
+ magtangent = min_ff(clmd->coll_parms->friction * 0.01f * magrelVel, len_v3(vrel_t_pre));
/* Apply friction impulse. */
if ( magtangent > ALMOST_ZERO ) {
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2013-09-03 22:22:45 UTC (rev 59781)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2013-09-03 22:32:03 UTC (rev 59782)
@@ -919,15 +919,13 @@
co, co_ss,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
- float delta[2];
- float dist_squared;
- float factor = 1.0;
+ const float dist_squared = len_squared_v2v2(mval, co_ss);
- sub_v2_v2v2(delta, mval, co_ss);
- dist_squared = dot_v2v2(delta, delta); /* len squared */
if (dist_squared <= brush_size_pressure * brush_size_pressure) {
Brush *brush = BKE_paint_brush(&vp->paint);
const float dist = sqrtf(dist_squared);
+ float factor;
+
if (brush->mtex.tex && rgba) {
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
BKE_brush_sample_tex_3D(vc->scene, brush, co, rgba, 0, NULL);
@@ -938,6 +936,9 @@
}
factor = rgba[3];
}
+ else {
+ factor = 1.0f;
+ }
return factor * BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure);
}
}
Modified: trunk/blender/source/blender/modifiers/intern/MOD_array.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_array.c 2013-09-03 22:22:45 UTC (rev 59781)
+++ trunk/blender/source/blender/modifiers/intern/MOD_array.c 2013-09-03 22:32:03 UTC (rev 59782)
@@ -402,7 +402,7 @@
/* calculate the maximum number of copies which will fit within the
* prescribed length */
if (amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) {
- float dist = sqrt(dot_v3v3(offset[3], offset[3]));
+ float dist = len_v3(offset[3]);
if (dist > 1e-6f)
/* this gives length = first copy start to last copy end
Modified: trunk/blender/source/blender/render/intern/source/shadeoutput.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/shadeoutput.c 2013-09-03 22:22:45 UTC (rev 59781)
+++ trunk/blender/source/blender/render/intern/source/shadeoutput.c 2013-09-03 22:32:03 UTC (rev 59782)
@@ -1191,8 +1191,8 @@
float visifac= 1.0f, t;
sub_v3_v3v3(lv, co, lar->co);
- *dist= sqrtf(dot_v3v3(lv, lv));
- t= 1.0f/dist[0];
+ *dist = len_v3(lv);
+ t = 1.0f / (*dist);
mul_v3_fl(lv, t);
/* area type has no quad or sphere option */
More information about the Bf-blender-cvs
mailing list