//------------------------------------------------------------------------------------
// irr::core::vector3di wrappers
//------------------------------------------------------------------------------------
// defaults: x=0, y=0, z=0

extern "C" 
{

	vector3di* IrrCore_Vector3di_new(s32 x,s32 y,s32 z)
	{
		vector3di* pRetVal=new vector3di(x,y,z);
		return pRetVal;
	}

	vector3di* IrrCore_Vector3di_newFromVal(s32 n)
	{
		return new vector3di(n);
	}
	
	vector3di* IrrCore_Vector3di_newFromVect(vector3di* other)
	{
		vector3di* pRetVal=new vector3di(*other);
		return pRetVal;
	}
	
	void IrrCore_Vector3di_del(vector3di* delVect)
	{
		if (delVect>0)
			delete delVect;
		delVect=0;
	}
	
	vector3di* IrrCore_Vector3di_set(vector3di* vect,s32 x,s32 y,s32 z)
	{
		if (vect>0)
			return &(vect->set(x,y,z));
		else return 0;
	}
	
	vector3di* IrrCore_Vector3di_setFromVect(vector3di* vect,vector3di* other)
	{
		if (vect>0)
			return &(vect->set(*other));
		else return 0;
	}
	
	s32 IrrCore_Vector3di_getX(vector3di* vect)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->X;
	
		return nRetVal;
	}
	
	s32 IrrCore_Vector3di_getY(vector3di* vect)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->Y;
	
		return nRetVal;
	}
	
	s32 IrrCore_Vector3di_getZ(vector3di* vect)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->Z;
	
		return nRetVal;
	}
	
	void IrrCore_Vector3di_setX(vector3di* vect,s32 x)
	{
		if (vect>0)
			vect->X=x;
	}
	
	void IrrCore_Vector3di_setY(vector3di* vect,s32 y)
	{
		if (vect>0)
			vect->Y=y;
	}
	
	void IrrCore_Vector3di_setZ(vector3di* vect,s32 z)
	{
		if (vect>0)
			vect->Z=z;
	}
	
	f64 IrrCore_Vector3di_getLength(vector3di* vect)
	{
		f64 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getLength();
	
		return fRetVal;
	}
	
	s32 IrrCore_Vector3di_getLengthSQ(vector3di* vect)
	{
		s32 fRetVal=0;
	
		if (vect>0)
			fRetVal=vect->getLengthSQ();
	
		return fRetVal;
	}
	
	s32 IrrCore_Vector3di_dotProduct(vector3di* vect,vector3di* other)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->dotProduct(*other);
	
		return nRetVal;
	}
	
	s32 IrrCore_Vector3di_getDistanceFrom(vector3di* vect,vector3di* other)
	{
		s32 fRetVal=0;
	
		if (vect>0)
			fRetVal=vect->getDistanceFrom(*other);
	
		return fRetVal;
	}
	
	s32 IrrCore_Vector3di_getDistanceFromSQ(vector3di* vect,vector3di* other)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->getDistanceFromSQ(*other);
	
		return nRetVal;
	}
	
	vector3di* IrrCore_Vector3di_crossProduct(vector3di* vect,vector3di* other)
	{
		vector3di* pRetVal=0;
	
		if (vect>0)
			pRetVal=new vector3di(vect->crossProduct(*other));
	
		return pRetVal;
	}
	
	bool IrrCore_Vector3di_isBetweenPoints (vector3di* vect,vector3di* begin,vector3di* end) 
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=vect->isBetweenPoints(*begin,*end);
	
		return lRetVal;
	}
	
	// do not delete
	vector3di* IrrCore_Vector3di_normalize(vector3di* vect)
	{
		if (vect>0)
			return &vect->normalize();	
		else return 0;
	}
	
	vector3di* IrrCore_Vector3di_setLength(vector3di* vect,s32 newlength)
	{
		if (vect>0)
			return &(vect->setLength(newlength));
		else return 0;	
	}
	
	vector3di* IrrCore_Vector3di_invert(vector3di* vect)
	{
		if (vect>0)
			return &(vect->invert());
		else return 0;	
	}
	
	// compiles but gives warnings
	vector3di* IrrCore_Vector3di_getInterpolated(vector3di* vect,vector3di* other,f64 d)
	{
		vector3di* pRetVal=0;
	
		if (vect>0)
			pRetVal=new vector3di(vect->getInterpolated(*other,d));
	
		return pRetVal;
	}
	
	
	void IrrCore_Vector3di_rotateXZBy(vector3di* vect,f64 degrees,vector3di* center = 0)
	{
		if (vect>0)
			vect->rotateXZBy(degrees,(center ? *center: vector3di()));
	}
	
	void IrrCore_Vector3di_rotateXYBy(vector3di* vect,f64 degrees,vector3di* center = 0)
	{
		if (vect>0)
			vect->rotateXYBy(degrees,(center ? *center: vector3di()));
	}
	
	void IrrCore_Vector3di_rotateYZBy(vector3di* vect,f64 degrees,vector3di* center = 0)
	{
		if (vect>0)
			vect->rotateYZBy(degrees,(center ? *center: vector3di()));
	}
	
	vector3di* IrrCore_Vector3di_setEq(vector3di* vect,vector3di* other)
	{
		if (vect>0) {
			*vect=*other;
			return vect;
		} else return 0;
	}
	
	bool IrrCore_Vector3di_EqEq(vector3di* vect,vector3di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect==*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3di_NotEq(vector3di* vect,vector3di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect!=*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3di_GreatEq(vector3di* vect,vector3di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect>=*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector3di_LessEq(vector3di* vect,vector3di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect<=*other);
	
		return lRetVal;
	}
	
	vector3di* IrrCore_Vector3di_Plus(vector3di* vect,vector3di* other)
	{
		vector3di* pRetVal=new vector3di((*vect+*other));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_PlusEq(vector3di* vect,vector3di* other)
	{
		if (vect>0) {
			*vect+=*other;
			return vect;
		} else return 0;
	}
	
	vector3di* IrrCore_Vector3di_PlusVal(vector3di* vect, s32 val)
	{
		vector3di* pRetVal=new vector3di((*vect+val));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_PlusEqVal(vector3di* vect, s32 val)
	{
		if (vect>0) {
			*vect+=val;
			return vect;
		} else return 0;
	}

	vector3di* IrrCore_Vector3di_Minus(vector3di* vect,vector3di* other)
	{
		vector3di* pRetVal=new vector3di((*vect-*other));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_MinusEq(vector3di* vect,vector3di* other)
	{
		if (vect>0) {
			*vect-=*other;
			return vect;
		} else return 0;
	}
	
	vector3di* IrrCore_Vector3di_MinusVal(vector3di* vect, s32 val)
	{
		vector3di* pRetVal=new vector3di((*vect-val));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_MinusEqVal(vector3di* vect, s32 val)
	{
		if (vect>0) {
			*vect-=val;
			return vect;
		} else return 0;
	}

	vector3di* IrrCore_Vector3di_MultVect(vector3di* vect,vector3di* other)
	{
		vector3di* pRetVal=new vector3di((*vect * *other));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_Mult(vector3di* vect,s32 v)
	{
		vector3di* pRetVal=new vector3di((*vect*v));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_MultEqVect(vector3di* vect,vector3di* other)
	{
		if (vect>0) {
			*vect*=*other;
			return vect;
		} else return 0;
	}
	
	vector3di* IrrCore_Vector3di_MultEq(vector3di* vect,s32 v)
	{
		if (vect>0) {
			*vect*=v;
			return vect;
		} else return 0;
	}
	
	vector3di* IrrCore_Vector3di_DivVect(vector3di* vect,vector3di* other)
	{
		vector3di* pRetVal=new vector3di((*vect / *other));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_Div(vector3di* vect,s32 v)
	{
		vector3di* pRetVal=new vector3di((*vect / v));
		return pRetVal;
	}
	
	vector3di* IrrCore_Vector3di_DivEqVect(vector3di* vect,vector3di* other)
	{
		if (vect>0) {
			*vect/=*other;
			return vect;
		} else return 0;
	}
	
	vector3di* IrrCore_Vector3di_DivEq(vector3di* vect,s32 v)
	{
		if (vect>0) {
			*vect/=v;
			return vect;
		} else return 0;
	}
	
	bool IrrCore_Vector3di_Equals(vector3di* vect,vector3di* other)
	{
		bool lRetVal=false;
	
		if (vect)
			lRetVal=(vect->equals(*other));
	
		return lRetVal;
	}
	
	void IrrCore_Vector3di_getAs4Values(vector3di* vect,s32* vals)
	{
		if (vect)
			vect->getAs4Values(vals);
	}
	
	vector3di* IrrCore_Vector3di_getHorizontalAngle(vector3di* vect)
	{
		if (vect)
			return new vector3di(vect->getHorizontalAngle());
		else return 0;
	}

	bool IrrCore_Vector3di_Less(vector3di* vect,const vector3di& other)
	{
		if (vect)
			return *vect < other;
		else return false;
	}
	
	bool IrrCore_Vector3di_Great(vector3di* vect,const vector3di& other)
	{
		if (vect)
			return *vect > other;
		else return false;
	}
		
	bool IrrCore_Vector3di_equals(vector3di* vect,const vector3di& other, const s32 tolerance = ROUNDING_ERROR_S32 )
	{
		if (vect)
			return vect->equals(other,tolerance);
		else return false;
	}
	
	vector3di* IrrCore_Vector3di_getInterpolated_quadratic(vector3di* vect,const vector3di& v2, const vector3di& v3, const f64 d)
	{
		if (vect)
			return new vector3di(vect->getInterpolated_quadratic(v2,v3,d));
		else return 0;
	}
	
	// do not delete
	vector3di* IrrCore_Vector3di_interpolate(vector3di* vect, const vector3di* a, const vector3di* b, f64 d)
	{
		if (vect)
			return &(vect->interpolate(*a, *b, d));
		else return 0;
	}
	
	// must delete
	vector3di* IrrCore_Vector3di_rotationToDirection(vector3di* vect, const vector3di* forwards = 0)
	{
		if (vect) 
			return new vector3di(vect->rotationToDirection((forwards ? *forwards : vector3di(0, 0, 1))));
		else return 0;
		
	}

	// must delete
	vector3di* IrrCore_Vector3di_getSphericalCoordinateAngles(vector3di* vect)
	{
		if (vect)
			return new vector3di(vect->getSphericalCoordinateAngles());
		else return 0;
	}
}
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------