//------------------------------------------------------------------------------------
// irr::core::aabbox3df wrappers (done)
//------------------------------------------------------------------------------------

extern "C" 
{

	aabbox3df* IrrCore_AABbox3df_new()
	{
		return new aabbox3df();
	}
	
	aabbox3df* IrrCore_AABbox3df_newFromBox(const aabbox3df& other)
	{
		return new aabbox3df(other.MinEdge,other.MaxEdge);
	}
	
	aabbox3df* IrrCore_AABbox3df_newFromVect(const vector3df& init)
	{
		return new aabbox3df(init);
	}
	
	aabbox3df* IrrCore_AABbox3df_newFromVectWithMax(const vector3df& init,const vector3df& max)
	{
		return new aabbox3df(init,max);
	}
	
	aabbox3df* IrrCore_AABbox3df_newFromVals(f32 minx,f32 miny,f32 minz,f32 maxx,f32 maxy,f32 maxz)
	{
		return new aabbox3df(minx,miny,minz,maxx,maxy,maxz);
	}
	
	void IrrCore_AABbox3df_del(aabbox3df* del)
	{
		if (del)
			delete del;
			
		del=0;
	}
	
	void IrrCore_AABbox3df_addInternalPoint(aabbox3df* box,const vector3df& point)
	{
		if (box)
			box->addInternalPoint(point);
	}
	
	void IrrCore_AABbox3df_addInternalPointFromVals(aabbox3df* box,f32 x,f32 y,f32 z)
	{
		if (box)
			box->addInternalPoint(x,y,z);
	}
	
	void IrrCore_AABbox3df_addInternalBox(aabbox3df* box,const aabbox3df& addbox)
	{
		if (box)
			box->addInternalBox(addbox);
	}
	
	void IrrCore_AABbox3df_resetFromVals(aabbox3df* box,f32 x,f32 y,f32 z)
	{
		if (box)
			box->reset(x,y,z);
	}
	
	void IrrCore_AABbox3df_resetFromBox(aabbox3df* box,const aabbox3df& initvalue)
	{
		if (box)
			box->reset(initvalue);
	}
	
	void IrrCore_AABbox3df_resetFromVect(aabbox3df* box,const vector3df& initvalue)
	{
		if (box)
			box->reset(initvalue);
	}
	
	bool IrrCore_AABbox3df_isPointInside(aabbox3df* box,const vector3df& point)
	{
		if (box)
			return box->isPointInside(point);
		else
			return false;
	}
	
	bool IrrCore_AABbox3df_isPointTotalInside(aabbox3df* box,const vector3df& point)
	{
		if (box)
			return box->isPointTotalInside(point);
		else
			return false;
	}
	
	bool IrrCore_AABbox3df_intersectsWithBox(aabbox3df* box,const aabbox3df& other)
	{
		if (box)
			return box->intersectsWithBox(other);
		else
			return false;
	}
	
	bool IrrCore_AABbox3df_intersectsWithLine(aabbox3df* box,const line3d<f32>& line)
	{
		if (box)
			return box->intersectsWithLine(line);
		else
			return false;
	}
	
	bool IrrCore_AABbox3df_intersectsWithLineUsingVects(aabbox3df* box,const vector3df& linemiddle,const vector3df& linevect,f32 halflength)
	{
		if (box)
			return box->intersectsWithLine(linemiddle,linevect,halflength);
		else
			return false;
	}
	
	s32 IrrCore_AABbox3df_classifyPlaneRelation(aabbox3df* box,const plane3df& plane)
	{
		if (box)
			return box->classifyPlaneRelation(plane);
		else
			return 0;
	}
	
	vector3df* IrrCore_AABbox3df_getCenter(aabbox3df* box)
	{
		if (box)
			return new vector3df(box->getCenter());
		else
			return 0;
	}
	
	vector3df* IrrCore_AABbox3df_getExtent(aabbox3df* box)
	{
		if (box)
			return new vector3df(box->getExtent());
		else
			return 0;
	}
	
	vector3df* IrrCore_AABbox3df_getMinEdge(aabbox3df* box)
	{
		if (box)
			return &box->MinEdge;
		else
			return 0;
	}
	
	vector3df* IrrCore_AABbox3df_getMaxEdge(aabbox3df* box)
	{
		if (box)
			return &box->MaxEdge;
		else
			return 0;
	}
	
	bool IrrCore_AABbox3df_isEmpty(aabbox3df* box)
	{
		if (box)
			return box->isEmpty();
		else
			return true;
	}
	
	void IrrCore_AABbox3df_repair(aabbox3df* box)
	{
		if (box)
			box->repair();
	}
	
	aabbox3df* IrrCore_AABbox3df_getInterpolated(aabbox3df* box,const aabbox3df& other,f32 d)
	{
		if (box)
			return new aabbox3df(box->getInterpolated(other,d));
		else
			return 0;
	}
	
	// note, use array<vector3df> to get a pointer for the edges array
	void IrrCore_AABbox3df_getEdges(aabbox3df* box,vector3df** edges)
	{			
		if (box) {
			array<vector3df> theEdges(8);
			box->getEdges(theEdges.pointer());
			
			for (int i=0; i<8; i++) {
				edges[i]->set(theEdges[i]);
			}
		}
	}
	
	bool IrrCore_AABbox3df_EqEq(aabbox3df* box,const aabbox3df& other)
	{
		if (box)
			return (*box==other);
		else
			return false;
	}
	
	bool IrrCore_AABbox3df_NotEq(aabbox3df* box,const aabbox3df& other)
	{
		if (box)
			return (*box!=other);
		else
			return true;
	}
	
	bool IrrCore_AABbox3df_isFullInside(aabbox3df* box,const aabbox3df& other)
	{
		if (box)
			return box->isFullInside(other);
		else return false;
	}
	
	f32 IrrCore_AABbox3df_getVolume(aabbox3df* box) 
	{
		if (box)
			return box->getVolume();
		else return 0.0;
	}	

	f32 IrrCore_AABbox3df_getArea(aabbox3df* box)
	{
		if (box) 
			return box->getArea();
		else return 0.0;
	}	
}
