Changeset 11584


Ignore:
Timestamp:
03/01/12 10:52:22 (13 years ago)
Author:
Mathieu Morlighem
Message:

added functions to remove triangles in a triangulation if the triangles are weird

Location:
issm/trunk-jpl/src/c/objects/Bamg
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/objects/Bamg/Mesh.cpp

    r11093 r11584  
    10281028                                Triangle &t=triangles[i];
    10291029                                if (t.det>0 && !(t.Hidden(0)||t.Hidden(1) || t.Hidden(2) )){
    1030                                         index[num*3+0]=GetId(t[0])+1; //back to M indexing
    1031                                         index[num*3+1]=GetId(t[1])+1; //back to M indexing
    1032                                         index[num*3+2]=GetId(t[2])+1; //back to M indexing
    1033                                         num=num+1;
     1030                                        if(t.Anisotropy()<2 & t.Length()<1.e+5){
     1031                                                index[num*3+0]=GetId(t[0])+1; //back to M indexing
     1032                                                index[num*3+1]=GetId(t[1])+1; //back to M indexing
     1033                                                index[num*3+2]=GetId(t[2])+1; //back to M indexing
     1034                                                num=num+1;
     1035                                        }
    10341036                                }
    10351037                        }
     
    10381040                /*Assign output pointers*/
    10391041                *pindex=index;
    1040                 *pnels=k;
     1042                *pnels=num;
    10411043        }
    10421044        /*}}}1*/
  • issm/trunk-jpl/src/c/objects/Bamg/Triangle.cpp

    r9371 r11584  
    5050        AdjacentTriangle Triangle::Adj(int i)  const {
    5151                return AdjacentTriangle(adj[i],AdjEdgeIndex[i]&3);
     52        };/*}}}*/
     53        /*FUNCTION Triangle::Anisotropy{{{1*/
     54        double Triangle::Anisotropy() const{
     55
     56                double lmin,lmax;
     57
     58                /*Get three vertices A,B and C*/
     59                R2 A=*this->vertices[0];
     60                R2 B=*this->vertices[1];
     61                R2 C=*this->vertices[2];
     62
     63                /*Compute edges*/
     64                R2 e1=B-A;
     65                R2 e2=C-A;
     66                R2 e3=B-C;
     67
     68                /*Compute edge length*/
     69                double l1=Norme2(e1);
     70                double l2=Norme2(e2);
     71                double l3=Norme2(e3);
     72
     73                lmin=l1;
     74                lmin=min(lmin,l2);
     75                lmin=min(lmin,l3);
     76                lmax=l1;
     77                lmax=max(lmax,l2);
     78                lmax=max(lmax,l3);
     79
     80                return lmax/lmin;
     81        };/*}}}*/
     82        /*FUNCTION Triangle::Length{{{1*/
     83        double Triangle::Length() const{
     84
     85                double l;
     86
     87                /*Get three vertices A,B and C*/
     88                R2 A=*this->vertices[0];
     89                R2 B=*this->vertices[1];
     90                R2 C=*this->vertices[2];
     91
     92                /*Compute edges*/
     93                R2 e1=B-A;
     94                R2 e2=C-A;
     95                R2 e3=B-C;
     96
     97                /*Compute edge length*/
     98                l=Norme2(e1);
     99                l=max(l,Norme2(e2));
     100                l=max(l,Norme2(e3));
     101
     102                return l;
    52103        };/*}}}*/
    53104        /*FUNCTION Triangle::Echo {{{1*/
  • issm/trunk-jpl/src/c/objects/Bamg/Triangle.h

    r9371 r11584  
    4141                        //Methods
    4242                        void              Echo();
     43                        double            Anisotropy() const;
     44                        double            Length() const;
    4345                        int               swap(short a1,int=0);
    4446                        long              Optim(short a,int =0);
Note: See TracChangeset for help on using the changeset viewer.