// ------------------------------------------------------------------------------------
// irr::core::line3df wrappers
// ------------------------------------------------------------------------------------

extern "C" {

	line3df* IrrCore_Line3df_new()
	{
		return new line3df();
	}

	line3df* IrrCore_Line3df_newFromVals(f32 xa,f32 ya,f32 za,f32 xb,f32 yb,f32 zb)
	{
		return new line3df(xa,ya,za,xb,yb,zb);
	}

	line3df* IrrCore_Line3df_newFromVects(vector3df* start,vector3df* end)
	{
		return new line3df(*start,*end);
	}

	line3df* IrrCore_Line3df_newFromLine(line3df* other)
	{
		line3df* line=new line3df();
		line->setLine(*other);
		return line;
	}

	void IrrCore_Line3df_del(line3df* del)
	{
		if (del)
			delete del;
			
		del=0;
	}

	void IrrCore_Line3df_setLineFromVals(line3df* line,f32 xa,f32 ya,f32 za,f32 xb,f32 yb,f32 zb)
	{
		if (line)
			line->setLine(xa,ya,za,xb,yb,zb);
	}

	void IrrCore_Line3df_setLineFromVects(line3df* line,vector3df* start,vector3df* end)
	{
		if (line)
			line->setLine(*start,*end);
	}

	void IrrCore_Line3df_setLineFromLine(line3df* line,line3df* line2)
	{
		if (line)
			line->setLine(*line2);
	}

	f32 IrrCore_Line3df_getLength(line3df* line)
	{
		f32 retval=0.0f;
		
		if (line)
			retval=line->getLength();
			
		return retval;
	}

	f32 IrrCore_Line3df_getLengthSQ(line3df* line)
	{
		f32 retval=0.0f;
		
		if (line)
			retval=line->getLengthSQ();
			
		return retval;
	}

	vector3df* IrrCore_Line3df_getMiddle(line3df* line)
	{
		vector3df* retval=0;
		
		if (line)
			retval=new vector3df(line->getMiddle());
		
		return retval;
	}

	vector3df* IrrCore_Line3df_getVector(line3df* line)
	{
		vector3df* retval=0;
		
		if (line)
			retval=new vector3df(line->getVector());
		
		return retval;
	}

	bool IrrCore_Line3df_isPointBetweenStartAndEnd(line3df* line,vector3df* point)
	{
		bool retval=false;
		if (line)
			retval=line->isPointBetweenStartAndEnd(*point);
		return retval;
	}

	vector3df* IrrCore_Line3df_getClosestPoint(line3df* line,vector3df* point)
	{
		vector3df* retval=0;
		
		if (line)
			retval=new vector3df(line->getClosestPoint(*point));
		
		return retval;
	}

	vector3df* IrrCore_Line3df_getStart(line3df* line)
	{
		vector3df* retval=0;
		
		if (line)
			retval=&line->start;
		
		return retval;
	}

	vector3df* IrrCore_Line3df_getEnd(line3df* line)
	{
		vector3df* retval=0;
		
		if (line)
			retval=&line->end;
		
		return retval;
	}

	bool IrrCore_Line3df_getIntersectionWithSphere(line3df* line,vector3df* sorigin,f32 sradius,f64* outdistance)
	{
		bool retval=false;
		if (line)
			retval=line->getIntersectionWithSphere(*sorigin,sradius,*outdistance);
		return retval;
	}

	line3df* IrrCore_Line3df_Plus(line3df* line,vector3df* point)
	{
		line3df* retval=0;
		if (line)
			retval=new line3df(*line + *point);

		return retval;
	}

	line3df* IrrCore_Line3df_Minus(line3df* line,vector3df* point)
	{
		line3df* retval=0;
		if (line)
			retval=new line3df(*line - *point);

		return retval;
	}

	void IrrCore_Line3df_PlusEq(line3df* line,vector3df* point)
	{
		if (line)
			*line+=*point;
	}

	void IrrCore_Line3df_MinusEq(line3df* line,vector3df* point)
	{
		if (line)
			*line+=*point;
	}

	bool IrrCore_Line3df_EqEq(line3df* line,line3df* line2)
	{
		bool retval=false;
		if (line)
			retval=(*line==*line2);
		return retval;
	}

	bool IrrCore_Line3df_NotEq(line3df* line,line3df* line2)
	{
		bool retval=true;
		if (line)
			retval=(*line!=*line2);
		return retval;
	}

}
