ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/sm_del.c
(Generate patch)

Comparing ray/src/hd/sm_del.c (file contents):
Revision 3.8 by gwlarson, Mon Dec 28 18:07:34 1998 UTC vs.
Revision 3.11 by gwlarson, Fri Mar 5 16:32:22 1999 UTC

# Line 27 | Line 27 | int id;
27  
28    tri = SM_NTH_TRI(sm,id);
29    /* Add to the free_list */
30 <
30 >  smClear_tri_flags(sm,id);
31    T_NEXT_FREE(tri) = SM_FREE_TRIS(sm);
32    SM_FREE_TRIS(sm) = id;
33    T_VALID_FLAG(tri) = -1;
# Line 47 | Line 47 | int t_id;
47       to id because the vertices can no longer
48       point to tri id as being the first triangle pointer
49    */
50 <  if(!SM_IS_NTH_T_BASE(sm,t_id))
51 <  {
52 <    SM_SAMPLE_TRIS(sm)--;
53 <    if(SM_IS_NTH_T_NEW(sm,t_id))
54 <      smNew_tri_cnt--;
55 <  }
50 >  SM_SAMPLE_TRIS(sm)--;
51 >  if(SM_IS_NTH_T_NEW(sm,t_id))
52 >     smNew_tri_cnt--;
53 >
54    smClear_tri_flags(sm,t_id);
55  
56    smFree_tri(sm,t_id);
59
60 #if 0
61  {
62    int i;
63    TRI *t;
64    for(i=0; i < SM_NUM_TRI(sm);i++)
65    {
66      t = SM_NTH_TRI(sm,i);
67      if(!T_IS_VALID(t))
68        continue;
69      if(T_NTH_NBR(t,0)==t_id || T_NTH_NBR(t,1)==t_id || T_NTH_NBR(t,2)==t_id)
70        eputs("Stale pointer: smDelete_tri()\n");
71    }
72  }
73 #endif
57   }
58  
59  
# Line 84 | Line 67 | eNew_edge()
67    if(Ecnt >= Max_edges)
68      {
69        if(Max_edges > 10000)
70 <        error(CONSISTENCY,"Too many edges in vertex loop\n");
70 >      {
71 >        eputs("Too many edges in vertex loop\n");
72 >        return(-1);
73 >      }
74        Max_edges += 100;
75        if(!(Edges = (EDGE *)realloc(Edges,(Max_edges+1)*sizeof(EDGE))))
76          goto memerr;
# Line 99 | Line 85 | memerr:
85   adjacent to id. Return set of triangles adjacent to id to delete in delptr
86   */
87   LIST
88 < *smVertexPolygon(sm,id,del_ptr)
88 > *smVertexStar(sm,id,del_ptr)
89   SM *sm;
90   int id;
91   LIST **del_ptr;
# Line 116 | Line 102 | LIST **del_ptr;
102      tri = SM_NTH_TRI(sm,t_id);
103  
104      e = eNew_edge();
105 +
106      /* Get the  next vertex on the polygon boundary */
107      v_id = T_WHICH_V(tri,id);
108      b_id = (v_id + 1)%3;
# Line 135 | Line 122 | LIST **del_ptr;
122      while((t_next_id = T_NTH_NBR(t_next,b_id)) != t_id)
123      {
124        e = eNew_edge();
125 +      if(e== INVALID)
126 +        return(NULL);
127        t_next = SM_NTH_TRI(sm,t_next_id);
128        SET_E_NTH_VERT(e,0,v_next);
129        SET_E_NTH_TRI(e,0,INVALID);
# Line 419 | Line 408 | smFixEdges(sm,add_list)
408          v2_id = T_NTH_V(t0,e0);
409          p_id = T_NTH_V(t1,e1);
410  
411 <        smDir_in_cone(sm,v0,v0_id);
412 <        smDir_in_cone(sm,v1,v1_id);
413 <        smDir_in_cone(sm,v2,v2_id);
411 >        smDir(sm,v0,v0_id);
412 >        smDir(sm,v1,v1_id);
413 >        smDir(sm,v2,v2_id);
414          
415          VCOPY(p,SM_NTH_WV(sm,p_id));    
416          VSUB(p,p,SM_VIEW_CENTER(sm));
# Line 479 | Line 468 | smRemoveVertex(sm,id)
468         polygon formed by the triangles adjacent to vertex 'id'
469       */
470      del_list = NULL;
471 <    b_list = smVertexPolygon(sm,id,&del_list);
472 <
471 >    b_list = smVertexStar(sm,id,&del_list);
472 >    if(!b_list)
473 >    {
474 >      if(del_list)
475 >        free_list(del_list);
476 >      return(FALSE);
477 >    }
478      add_list = NULL;
479      /* Triangulate polygonal hole  */
480      if(!smTriangulate(sm,id,b_list,&add_list))
# Line 490 | Line 484 | smRemoveVertex(sm,id)
484      }
485      else
486      {
493 #ifdef DEBUG
494      b_list = del_list;
495      while(b_list)
496      {
497        t_id = LIST_DATA(b_list);
498        b_list = LIST_NEXT(b_list);
499        T_VALID_FLAG(SM_NTH_TRI(sm,t_id))=-1;
500      }
501 #endif
487        while(del_list)
488        {
489          t_id = pop_list(&del_list);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines