small bvh fixes:
*allow to create any tree type >= 2
*save split axis
changed shrinkwrap to perform normal cast with raytree and bvh tree and print both times:
Shrinkwrap (OBCube)24578 over (OBSuzanne)504482
target = raytree_create_from_mesh(calc->target): 1260.000000ms
shrinkwrap_calc_normal_projection_raytree(&calc): 1850.000000ms
tree = bvhtree_from_mesh_tri(calc->target): 3330.000000ms
shrinkwrap_calc_normal_projection(&calc): 3780.000000ms
On general query time is bit smaller on bvh tree..
but the build time of bvh is pretty big.
(build time can be removed from both if a cache system is added)
But I am still trying to see how fast I can make the bvh build
*Fixed a few UI things
*Make SimpleDeform and Shrinkwrap to use vertexgroup_get_vertex_weight, a similar function
"static float vert_weight(MDeformVert *dvert, int group)" existed on modifier.c, changed
it a bit and moved into BKE_deform.h
Changed code to remove faces (now quad faces that got one vertice projected are turned on tri)
Merge option is still not very usefull since shrinkwrap does not yet moves unprojected vertices
I'll work on making it more generic.
So far it querys faster than kdtree, but building the tree is slower.
And bvhtree NN uses an heuristic based on the last match.
Shrinkwrap (OBCube)24578 over (OBSuzanne)31658
kdtree
build: 30.000000ms
query: 1360.000000ms
bvhtree
build: 140.000000ms
query: 490.000000ms
Shrinkwrap now uses bvhtree (binary tree, 6dop) for nearest vertex.
+added option to remove faces where all vertices got unprojected
Nearest surface point
+15% faster closest point on point-tri function
(archived by projecting the point on tri-plane and solving the problem on 2D)
(its still using bruteforce on triangles.. I'll add the right data structure later)
+control for normal projection direction (default,inverted,both)
There are some bugs on projection over quads.. it seems to work 100% on fully triangulized meshs
+ Nearest surface point
+ Normal projection
+ Nearest vertex (gives similar results to nearest surface if the target mesh has many vertexs and is a lot faster to calculate)
^^ all bruteforce calculation for now
+ fixed matrix order multiplication
+ request for CD_MDEDEFORMVERT
+vertex weights supported
+target object now saves to file: load/save works :)
for now simple moves objects vertexs to the nearest vertexs on target object
(so that I can test if its working correctly with the modifier API)