How would I go about refining a triangle?
So far this is what my code looks like,not finished by far

class point
{public:
        point(){}
        point(double i, double j,double k){x=i; y=j;z=k;}
        
        ~point(){}
        double getx(){return x;}
        double gety(){return y;}
        double getz(){return z;}
        bool operator == (point p){return (x==p.getx() && y==p.gety() && z==p.getz());}
        
        void operator = (point p){x=p.getx(); y=p.gety();z=p.getz();}
      
        void display(){cout<<"("<<x<<", "<<y<<", "<<z<<")";}
private:
        double x, y, z;

};
class triangle
{
 public:
        triangle(){}
        triangle(point p1, point p2,point p3)
            { C1=p1; C2=p2; C3=p3;}
        ~triangle(){}
        point getC1(){return C1;}
        point getC2(){return C2;}
        point getC3(){return C3;}
        void display(){
                       cout<<"Coordinate 1: "; C1.display();
                       cout<<"  Coordinate 2: "; C2.display(); 
                       cout<<"    Coordinate 3: "; C3.display();
                       cout<<endl;
                       }

        void refine(list<triangle> * lptr)
                {
                
                //bool coin;
                triangle * ntri;
                point * npoint;
                double midx, midy,midz;
                midx=(C1.getx()+C2.getx()+C3.getx())/3.0;
                midy=(C1.gety()+C2.gety()+C3.gety())/3.0;
                midz=(C1.getz()+C2.getz()+C3.getz())/3.0;

This is where im stuck,I dont know where to go from here to refine the triangle

1) Remove display functions from these classes
- Display should come from outside

2) Actually declare the C1, C2 and C3 in your triangle class\

3) Did you really want to pass a pointer to a list of triangles?
- What is "refine" supposed to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.