Hi,
I have 3 classes one of them is Point the other is line and the last one is triangle
I'm trying to read the output of a mesh generator program.
When I create the points and set the points with a constructor ;
point::point(int listnumber,double x1, double y1,double z1)
{
x=x1;
y=y1;
z=z1;
plist=listnumber;
}
and then I define handles in line and triangle classes for point
like : point *ptrs[3]; in triangle and
point *ptrlinepoint[2]; in line class
and my constructors in line and triangle are
line::line(int linelist,point& pl11,point& pl12)
{ llist=linelist;
ptrlinepoint[0]=&pl11;
ptrlinepoint[1]=&pl12;
}
triangle::triangle(int trianglelist,point& rp1,point& rp2,point& rp3)
{
ptrs[0]=&rp1;
ptrs[1]=&rp2;
ptrs[2]=&rp3;
tlist=trianglelist;
}
when I set my triangles like
point *pp=new point [Npoint];
ppt[i]=triangle(i,ct[i],pp[temp_p1_list_number-1];
triangle *ppt=new triangle[NTriangle];// SET TRIANGLE//
ppt[i]=triangle(i,ct[i],[ppindex_of_first_point],pp[index_of_second_point],
pp[thirdpoint]);
and SET POINTS OF THE TRIANGLE EVERTHING IS OK.
AND WHEN I SET THE POINTS OF LINES THEN IT CHANGES EVERYTHING LIKE THE POINTS OF TRIANGLES
for (i=0;i<=Noflines-1;i++){
ppl[j]=line(j+1,pp[index_of_first_point],pp[index_of_second]);}
AFTER THIS WHEN I TRY TO READ THE POINTS IN TRIANGLE I SEE THAT THEY ARE CHANGED CAN SOMEBODG TELL ME WHAT COULD BE THE SOLUTION TO RECOVER THE POINTER MESS UP.