// ------------------------------------------------------------------------------------
// irr::core::line3di wrappers
// ------------------------------------------------------------------------------------

extern "C" {

	line3di* IrrCore_Line3di_new()
	{
		return new line3di();
	}

	line3di* IrrCore_Line3di_newFromVals(s32 xa,s32 ya,s32 za,s32 xb,s32 yb,s32 zb)
	{
		return new line3di(xa,ya,za,xb,yb,zb);
	}

	line3di* IrrCore_Line3di_newFromVects(vector3di* start,vector3di* end)
	{
		return new line3di(*start,*end);
	}

	line3di* IrrCore_Line3di_newFromLine(line3di* other)
	{
		line3di* line=new line3di();
		line->setLine(*other);
		return line;
	}

	void IrrCore_Line3di_del(line3di* del)
	{
		if (del)
			delete del;
			
		del=0;
	}

	void IrrCore_Line3di_setLineFromVals(line3di* line,s32 xa,s32 ya,s32 za,s32 xb,s32 yb,s32 zb)
	{
		if (line)
			line->setLine(xa,ya,za,xb,yb,zb);
	}

	void IrrCore_Line3di_setLineFromVects(line3di* line,vector3di* start,vector3di* end)
	{
		if (line)
			line->setLine(*start,*end);
	}

	void IrrCore_Line3di_setLineFromLine(line3di* line,line3di* line2)
	{
		if (line)
			line->setLine(*line2);
	}

	s32 IrrCore_Line3di_getLength(line3di* line)
	{
		s32 retval=0;
		
		if (line)
			retval=line->getLength();
			
		return retval;
	}

	s32 IrrCore_Line3di_getLengthSQ(line3di* line)
	{
		s32 retval=0;
		
		if (line)
			retval=line->getLengthSQ();
			
		return retval;
	}

	vector3di* IrrCore_Line3di_getMiddle(line3di* line)
	{
		vector3di* retval=0;
		
		if (line)
			retval=new vector3di(line->getMiddle());
		
		return retval;
	}

	vector3di* IrrCore_Line3di_getVector(line3di* line)
	{
		vector3di* retval=0;
		
		if (line)
			retval=new vector3di(line->getVector());
		
		return retval;
	}

	bool IrrCore_Line3di_isPointBetweenStartAndEnd(line3di* line,vector3di* point)
	{
		bool retval=false;
		if (line)
			retval=line->isPointBetweenStartAndEnd(*point);
		return retval;
	}

	vector3di* IrrCore_Line3di_getClosestPoint(line3di* line,vector3di* point)
	{
		vector3di* retval=0;
		
		if (line)
			retval=new vector3di(line->getClosestPoint(*point));
		
		return retval;
	}

	vector3di* IrrCore_Line3di_getStart(line3di* line)
	{
		vector3di* retval=0;
		
		if (line)
			retval=&line->start;
		
		return retval;
	}

	vector3di* IrrCore_Line3di_getEnd(line3di* line)
	{
		vector3di* retval=0;
		
		if (line)
			retval=&line->end;
		
		return retval;
	}

	bool IrrCore_Line3di_getIntersectionWithSphere(line3di* line,vector3di* sorigin,s32 sradius,f64* outdistance)
	{
		bool retval=false;
		if (line)
			retval=line->getIntersectionWithSphere(*sorigin,sradius,*outdistance);
		return retval;
	}

	line3di* IrrCore_Line3di_Plus(line3di* line,vector3di* point)
	{
		line3di* retval=0;
		if (line)
			retval=new line3di(*line + *point);

		return retval;
	}

	line3di* IrrCore_Line3di_Minus(line3di* line,vector3di* point)
	{
		line3di* retval=0;
		if (line)
			retval=new line3di(*line - *point);

		return retval;
	}

	void IrrCore_Line3di_PlusEq(line3di* line,vector3di* point)
	{
		if (line)
			*line+=*point;
	}

	void IrrCore_Line3di_MinusEq(line3di* line,vector3di* point)
	{
		if (line)
			*line+=*point;
	}

	bool IrrCore_Line3di_EqEq(line3di* line,line3di* line2)
	{
		bool retval=false;
		if (line)
			retval=(*line==*line2);
		return retval;
	}

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

}