/*objects.h */

class object
{
	surface *s;
public:
	virtual double intersect(xyz *origin,xyz *dir)  //accepts the xyz pointer ray of the raytracer classd as the input direction and returns the distance;
	{
	return(0.0);
	}
	virtual void normal(xyz * hitp,xyz *normal)//accepts the reference to intersection point and returns the reference to the normal as xyz object;
	{}
	virtual xy get_uv(xyz * hitp)
	{
		xy cor;
	return(cor);
	}

	virtual surface get_surface()
	{
	return(*s);
	}

};

class sphere :public object
{
public:
	surface *s;
	double r,x,y,z;
	sphere(double a,double b,double c,double d,surface * surf)
	{
	r=a;
	x=b;
	y=c;
	z=d;
	s=surf;
	}
	double intersect(xyz *origin,xyz *dir);
	
	void normal(xyz * hitp,xyz *normal);
	xy get_uv(xyz * hitp);
	
	surface get_surface();

};

class quad :public object
{
public:
	surface *s;
	xyz pnta,pntb,pntc,pntd,n;
	xy p1,p2,p3,p4;
	double max_coefficient;
	quad(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3,double x4,double y4,double z4,surface * surf): n(),pnta(),pntb(),pntc(),pntd(),p1(),p2(),p3(),p4()
	{
		pnta.x=x1;
		pnta.y=y1;
		pnta.z=z1;
		pntb.x=x2;
		pntb.y=y2;
		pntb.z=z2;
		pntc.x=x3;
		pntc.y=y3;
		pntc.z=z3;
		pntd.x=x4;
		pntd.y=y4;
		pntd.z=z4;
		s=surf;
	}
	double intersect(xyz *origin,xyz *dir);
	
	void normal(xyz * hitp,xyz *normal);

	xy get_uv(xyz * hitp);
	

	surface get_surface();
};