/***************************************************************************
                          Generic_functions.h  -  description
                             -------------------
    begin                : Tue Nov 6 2001
    copyright            : (C) 2001 by Bryan Bell
    email                : Bryan@localhost.localdomain
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

# include "math.h"
 #include <iostream.h>
 enum Type{
 		TypeObject,
	 	TypeScripting,
	 	TypeBall
	 };
// enum  ObjectType{
//	TypepolygonObject,
//	TypeBall
//} ;

enum event{
        CheckCollisions,
        Calculate_Next_Position,
        Render,
		AddDeltaT,
		Find_Smallest_Delta_T,
		Stop,
		Object_Collision,
		Get_Closest_Object_Collision
        
    };
struct Event_Struct{
    bool b_CheckCollisions;
    bool b_CalculateNextPosition;
    bool b_Render;
    
    void CheckCollisions(){
            b_CheckCollisions=true;
        };
    };


struct vector{
	float i;
	float j;
};
struct point{
float	x;
float	y;
};
//the struct for the point in time and space where two objects collided if istrue is false that meens the objects neve collide.
struct t_point{
float	x;
float	y;
float t;
bool istrue;
};

struct Grid_Rect{
point	point1;
point	point2;
point	point3;
point	point4;
};



struct line{
	float x1;
	float y1;
	float x2;
	float y2;
	float slope(){
			if((x2-x1)==0){
				return 0;
			}else{
			return (y2-y1)/(x2-x1);
			}
	};
};


struct circle_vector{
		vector vector1;
		float radius;
		float x1;
		float y1;
		//float t1;
		//float t2;
	
	};

struct quadractic{
        float a;
        float b;
        float c;
        float xplus(){
                return (-b+sqrt(b*b-4*a*c))/(2*a);
            };
    
        float xminus(){
                return (-b-sqrt(b*b-4*a*c))/(2*a);
            };          
  };

struct Parametric_Line_Equation{
        float t1;
        float xa;
        float xb;
        float ya;
        float yb;
       //The parametric equation this describes is y=ya*t+yb
        //                                           x=xa*t+xb 
        /* float xa2;
        float xb2;
        float ya2;
        float yb2;*/        
    };





struct LineFunction{
    float slope;
    float b;
    bool IsFunction;
    float x;
};


struct circle{
		float radius;
		float x;
		float y;
	};

LineFunction MakeLine(line Line1);

point FindEnterSectionPoint(line Line1,line Line2);
bool CrossCircle(float Radius,float x,float y,line Line);
/*
CrossCircle will only test to
see if a horizontal or vertical line intercepts a circle
*/
t_point CirclesCross(circle_vector var_circle1,circle_vector var_circle2);
/*
tests to see if two circles intercept
*/
t_point CirclesCollide(Parametric_Line_Equation Circle1,float r1,Parametric_Line_Equation Circle2,float r2);
bool CrossLine(line Line1,line Line2);


