[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38033] branches/soc-2011-avocado/blender/ source/blender/bmesh/operators/primitiveops.c: incremental commit to " splines to bmesh" tool.
Dan Walters
dan683 at gmail.com
Sat Jul 2 11:27:35 CEST 2011
Revision: 38033
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38033
Author: dan_w
Date: 2011-07-02 09:27:35 +0000 (Sat, 02 Jul 2011)
Log Message:
-----------
incremental commit to "splines to bmesh" tool. Intersection search implemented with vertex inserting. Next to do is welding and mesh cleaning, then face filling
Modified Paths:
--------------
branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c
Modified: branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c 2011-07-02 07:55:06 UTC (rev 38032)
+++ branches/soc-2011-avocado/blender/source/blender/bmesh/operators/primitiveops.c 2011-07-02 09:27:35 UTC (rev 38033)
@@ -691,10 +691,11 @@
bGPDstroke *gps, *gpsn;
bGPDstroke *search_gps, *search_gpsn;
- float vec[3];
+ float vec[3], i_vec0[3], i_vec1[3], i_vec2[3], i_vec3[3], i_vec_intersect[3], intersect_lambda;
BMVert *bm_vertex;
BMVert *bm_previous;
+ BMVert *bm_intersect;
int i, j;
@@ -723,22 +724,46 @@
for (search_gps = p_frame->strokes.first; search_gps; search_gps = search_gpsn)
{
+ search_gpsn = search_gps->next;
+
if(gps == search_gps)
{
continue;
}
- search_gpsn = search_gps->next;
-
for(j = 0; j < search_gps->totpoints; j++)
{
if(j != 0)
{
// intersection test
- //if(isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *lambda))
+ i_vec0[0] = gps->points[i-1].x;
+ i_vec0[1] = gps->points[i-1].y;
+ i_vec0[2] = gps->points[i-1].z;
+
+ i_vec1[0] = gps->points[i].x;
+ i_vec1[1] = gps->points[i].y;
+ i_vec1[2] = gps->points[i].z;
+
+ i_vec2[0] = search_gps->points[j-1].x;
+ i_vec2[1] = search_gps->points[j-1].y;
+ i_vec2[2] = search_gps->points[j-1].z;
+
+ i_vec3[0] = search_gps->points[j].x;
+ i_vec3[1] = search_gps->points[j].y;
+ i_vec3[2] = search_gps->points[j].z;
+
+ if(isect_line_line_strict_v3(i_vec0, i_vec1, i_vec2, i_vec3, i_vec_intersect, &intersect_lambda))
{
- //
+ // there is an intersection hence we must add an extra vertex and 2 edges rather than just one edge
+ bm_intersect = BM_Make_Vert(bm, vec, NULL);
+
+ // create edge
+ BM_Make_Edge(bm, bm_intersect, bm_previous, NULL, 0);
+
+ bm_previous = bm_intersect;
+
+ break;
}
}
}
@@ -750,6 +775,10 @@
bm_previous = bm_vertex;
}
}
+
+ // perform weld on vertices that do not share an edge
+
+
// intersect each spline segment with each other spline segment
// generate bmesh edge list, using start of spline, end of spline, intersections as vertices
// weld / merge vertices
More information about the Bf-blender-cvs
mailing list