Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Hamalainen <blender@miikah.org>2011-11-10 14:24:34 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-10 14:24:34 +0400
commitafeb0eeaf0e8caf5e46a5dd6fbea3786e9fb1354 (patch)
tree36ab74ff3fa36d27c0f35527d3b55e68e3d27fe5 /source/blender/blenlib/intern
parent1e035381d10068eb17345a88d42cebc0d579adf3 (diff)
parent1b4a54ad73c058baa59ffdc9e5f18b0b79030fb0 (diff)
Dynamic Paint merge:
Commit Dynamic Paint from "soc-2011-carrot" branch into trunk. End-user documentation: http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Simulation/Dynamic_Paint GSoC wiki page: http://wiki.blender.org/index.php/User:MiikaH/GSoC-2011-DynamicPaint
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/math_geom.c15
-rw-r--r--source/blender/blenlib/intern/threads.c14
2 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index b79ae9f0042..99ead8e9d6a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -207,6 +207,21 @@ float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float
return sqrtf(rc[0]*rc[0]+ rc[1]*rc[1]);
}
+/* point closest to v1 on line v2-v3 in 2D */
+void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2])
+{
+ float lambda, cp[2];
+
+ lambda= closest_to_line_v2(cp,p, l1, l2);
+
+ if(lambda <= 0.0f)
+ copy_v2_v2(closest, l1);
+ else if(lambda >= 1.0f)
+ copy_v2_v2(closest, l2);
+ else
+ copy_v2_v2(closest, cp);
+}
+
/* point closest to v1 on line v2-v3 in 3D */
void closest_to_line_segment_v3(float closest[3], const float v1[3], const float v2[3], const float v3[3])
{
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 8247b861a7a..38b3fe669b6 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -669,3 +669,17 @@ void BLI_thread_queue_nowait(ThreadQueue *queue)
pthread_mutex_unlock(&queue->mutex);
}
+void BLI_begin_threaded_malloc(void)
+{
+ if(thread_levels == 0) {
+ MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
+ }
+ thread_levels++;
+}
+
+void BLI_end_threaded_malloc(void)
+{
+ thread_levels--;
+ if(thread_levels==0)
+ MEM_set_lock_callback(NULL, NULL);
+} \ No newline at end of file