text: // Generated by Haxe 4.1.4
  #include <hxcpp.h>
  
  #ifndef INCLUDED_95f339a1d026d52c
  #define INCLUDED_95f339a1d026d52c
  #include "hxMath.h"
  #endif
  #ifndef INCLUDED_verb_core_BoundingBox
  #include <verb/core/BoundingBox.h>
  #endif
  #ifndef INCLUDED_verb_core_Mesh
  #include <verb/core/Mesh.h>
  #endif
  #ifndef INCLUDED_verb_core_MeshData
  #include <verb/core/MeshData.h>
  #endif
  #ifndef INCLUDED_verb_core_Pair
  #include <verb/core/Pair.h>
  #endif
  #ifndef INCLUDED_verb_core_SerializableBase
  #include <verb/core/SerializableBase.h>
  #endif
  #ifndef INCLUDED_verb_core_Vec
  #include <verb/core/Vec.h>
  #endif
  
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_25_getTriangleNorm,"verb.core.Mesh","getTriangleNorm",0x2cd51359,"verb.core.Mesh.getTriangleNorm","verb/core/Mesh.hx",25,0xa73a1991)
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_50_makeMeshAabb,"verb.core.Mesh","makeMeshAabb",0xc8d3395c,"verb.core.Mesh.makeMeshAabb","verb/core/Mesh.hx",50,0xa73a1991)
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_86_sortTrianglesOnLongestAxis,"verb.core.Mesh","sortTrianglesOnLongestAxis",0xdd3d9760,"verb.core.Mesh.sortTrianglesOnLongestAxis","verb/core/Mesh.hx",86,0xa73a1991)
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_76_sortTrianglesOnLongestAxis,"verb.core.Mesh","sortTrianglesOnLongestAxis",0xdd3d9760,"verb.core.Mesh.sortTrianglesOnLongestAxis","verb/core/Mesh.hx",76,0xa73a1991)
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_113_getMinCoordOnAxis,"verb.core.Mesh","getMinCoordOnAxis",0x7af73af8,"verb.core.Mesh.getMinCoordOnAxis","verb/core/Mesh.hx",113,0xa73a1991)
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_137_getTriangleCentroid,"verb.core.Mesh","getTriangleCentroid",0x3c122fdd,"verb.core.Mesh.getTriangleCentroid","verb/core/Mesh.hx",137,0xa73a1991)
  static const Float _hx_array_data_6111eaed_9[] = {
  	0.0,0.0,0.0,
  };
  HX_LOCAL_STACK_FRAME(_hx_pos_ec5f9bbfd835186b_166_triangleUVFromPoint,"verb.core.Mesh","triangleUVFromPoint",0x9c146a1c,"verb.core.Mesh.triangleUVFromPoint","verb/core/Mesh.hx",166,0xa73a1991)
  namespace verb{
  namespace core{
  
  void Mesh_obj::__construct() { }
  
  Dynamic Mesh_obj::__CreateEmpty() { return new Mesh_obj; }
  
  void *Mesh_obj::_hx_vtable = 0;
  
  Dynamic Mesh_obj::__Create(::hx::DynamicArray inArgs)
  {
  	::hx::ObjectPtr< Mesh_obj > _hx_result = new Mesh_obj();
  	_hx_result->__construct();
  	return _hx_result;
  }
  
  bool Mesh_obj::_hx_isInstanceOf(int inClassId) {
  	return inClassId==(int)0x00000001 || inClassId==(int)0x6707940b;
  }
  
  ::Array< Float > Mesh_obj::getTriangleNorm(::Array< ::Dynamic> points,::Array< int > tri){
              	HX_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_25_getTriangleNorm)
  HXLINE(  27)		::Array< Float > v0 = points->__get(tri->__get(0)).StaticCast< ::Array< Float > >();
  HXDLIN(  27)		::Array< Float > v1 = points->__get(tri->__get(1)).StaticCast< ::Array< Float > >();
  HXDLIN(  27)		::Array< Float > v2 = points->__get(tri->__get(2)).StaticCast< ::Array< Float > >();
  HXDLIN(  27)		::Array< Float > u = ::verb::core::Vec_obj::sub(v1,v0);
  HXDLIN(  27)		::Array< Float > v = ::verb::core::Vec_obj::sub(v2,v0);
  HXDLIN(  27)		::Array< Float > n = ::verb::core::Vec_obj::cross(u,v);
  HXLINE(  34)		return ::verb::core::Vec_obj::mul((( (Float)(1) ) / ::verb::core::Vec_obj::norm(n)),n);
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC2(Mesh_obj,getTriangleNorm,return )
  
   ::verb::core::BoundingBox Mesh_obj::makeMeshAabb( ::verb::core::MeshData mesh,::Array< int > faceIndices){
              	HX_GC_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_50_makeMeshAabb)
  HXLINE(  52)		 ::verb::core::BoundingBox bb =  ::verb::core::BoundingBox_obj::__alloc( HX_CTX ,null());
  HXLINE(  54)		{
  HXLINE(  54)			int _g = 0;
  HXDLIN(  54)			while((_g < faceIndices->length)){
  HXLINE(  54)				int x = faceIndices->__get(_g);
  HXDLIN(  54)				_g = (_g + 1);
  HXLINE(  55)				bb->add(mesh->points->__get(mesh->faces->__get(x).StaticCast< ::Array< int > >()->__get(0)).StaticCast< ::Array< Float > >());
  HXLINE(  56)				bb->add(mesh->points->__get(mesh->faces->__get(x).StaticCast< ::Array< int > >()->__get(1)).StaticCast< ::Array< Float > >());
  HXLINE(  57)				bb->add(mesh->points->__get(mesh->faces->__get(x).StaticCast< ::Array< int > >()->__get(2)).StaticCast< ::Array< Float > >());
              			}
              		}
  HXLINE(  60)		return bb;
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC2(Mesh_obj,makeMeshAabb,return )
  
  ::Array< int > Mesh_obj::sortTrianglesOnLongestAxis( ::verb::core::BoundingBox bb, ::verb::core::MeshData mesh,::Array< int > faceIndices){
              		HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
              		int _hx_run( ::verb::core::Pair a, ::verb::core::Pair b){
              			HX_GC_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_86_sortTrianglesOnLongestAxis)
  HXLINE(  87)			Float a0 = ( (Float)(a->item0) );
  HXLINE(  88)			Float b0 = ( (Float)(b->item0) );
  HXLINE(  90)			if ((a0 == b0)) {
  HXLINE(  90)				return 0;
              			}
              			else {
  HXLINE(  90)				if ((a0 > b0)) {
  HXLINE(  90)					return 1;
              				}
              				else {
  HXLINE(  90)					return -1;
              				}
              			}
  HXDLIN(  90)			return 0;
              		}
              		HX_END_LOCAL_FUNC2(return)
  
              	HX_GC_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_76_sortTrianglesOnLongestAxis)
  HXLINE(  78)		int longAxis = bb->getLongestAxis();
  HXLINE(  80)		::Array< ::Dynamic> minCoordFaceMap = ::Array_obj< ::Dynamic>::__new();
  HXLINE(  81)		{
  HXLINE(  81)			int _g = 0;
  HXDLIN(  81)			while((_g < faceIndices->length)){
  HXLINE(  81)				int faceIndex = faceIndices->__get(_g);
  HXDLIN(  81)				_g = (_g + 1);
  HXLINE(  82)				Float tri_min = ::verb::core::Mesh_obj::getMinCoordOnAxis(mesh->points,mesh->faces->__get(faceIndex).StaticCast< ::Array< int > >(),longAxis);
  HXLINE(  83)				minCoordFaceMap->push( ::verb::core::Pair_obj::__alloc( HX_CTX ,tri_min,faceIndex));
              			}
              		}
  HXLINE(  86)		minCoordFaceMap->sort( ::Dynamic(new _hx_Closure_0()));
  HXLINE(  93)		::Array< int > sortedFaceIndices = ::Array_obj< int >::__new();
  HXLINE(  94)		{
  HXLINE(  94)			int _g1 = 0;
  HXDLIN(  94)			int _g2 = minCoordFaceMap->length;
  HXDLIN(  94)			while((_g1 < _g2)){
  HXLINE(  94)				_g1 = (_g1 + 1);
  HXDLIN(  94)				int i = (_g1 - 1);
  HXLINE(  95)				sortedFaceIndices->push(minCoordFaceMap->__get(i).StaticCast<  ::verb::core::Pair >()->item1);
              			}
              		}
  HXLINE(  98)		return sortedFaceIndices;
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC3(Mesh_obj,sortTrianglesOnLongestAxis,return )
  
  Float Mesh_obj::getMinCoordOnAxis(::Array< ::Dynamic> points,::Array< int > tri,int axis){
              	HX_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_113_getMinCoordOnAxis)
  HXLINE( 115)		Float min = ::Math_obj::POSITIVE_INFINITY;
  HXLINE( 117)		{
  HXLINE( 117)			{
  HXLINE( 118)				Float coord = points->__get(tri->__get(0)).StaticCast< ::Array< Float > >()->__get(axis);
  HXLINE( 119)				if ((coord < min)) {
  HXLINE( 119)					min = coord;
              				}
              			}
  HXLINE( 117)			{
  HXLINE( 118)				Float coord1 = points->__get(tri->__get(1)).StaticCast< ::Array< Float > >()->__get(axis);
  HXLINE( 119)				if ((coord1 < min)) {
  HXLINE( 119)					min = coord1;
              				}
              			}
  HXLINE( 117)			{
  HXLINE( 118)				Float coord2 = points->__get(tri->__get(2)).StaticCast< ::Array< Float > >()->__get(axis);
  HXLINE( 119)				if ((coord2 < min)) {
  HXLINE( 119)					min = coord2;
              				}
              			}
              		}
  HXLINE( 122)		return min;
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC3(Mesh_obj,getMinCoordOnAxis,return )
  
  ::Array< Float > Mesh_obj::getTriangleCentroid(::Array< ::Dynamic> points,::Array< int > tri){
              	HX_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_137_getTriangleCentroid)
  HXLINE( 139)		::Array< Float > centroid = ::Array_obj< Float >::fromData( _hx_array_data_6111eaed_9,3);
  HXLINE( 141)		{
  HXLINE( 142)			{
  HXLINE( 143)				::Array< Float > centroid1 = centroid;
  HXDLIN( 143)				int _hx_tmp = 0;
  HXDLIN( 143)				centroid1[_hx_tmp] = (centroid1->__get(_hx_tmp) + points->__get(tri->__get(0)).StaticCast< ::Array< Float > >()->__get(0));
  HXDLIN( 143)				::Array< Float > centroid2 = centroid;
  HXDLIN( 143)				int _hx_tmp1 = 1;
  HXDLIN( 143)				centroid2[_hx_tmp1] = (centroid2->__get(_hx_tmp1) + points->__get(tri->__get(0)).StaticCast< ::Array< Float > >()->__get(1));
  HXDLIN( 143)				::Array< Float > centroid3 = centroid;
  HXDLIN( 143)				int _hx_tmp2 = 2;
  HXDLIN( 143)				centroid3[_hx_tmp2] = (centroid3->__get(_hx_tmp2) + points->__get(tri->__get(0)).StaticCast< ::Array< Float > >()->__get(2));
              			}
  HXLINE( 142)			{
  HXLINE( 143)				::Array< Float > centroid4 = centroid;
  HXDLIN( 143)				int _hx_tmp3 = 0;
  HXDLIN( 143)				centroid4[_hx_tmp3] = (centroid4->__get(_hx_tmp3) + points->__get(tri->__get(1)).StaticCast< ::Array< Float > >()->__get(0));
  HXDLIN( 143)				::Array< Float > centroid5 = centroid;
  HXDLIN( 143)				int _hx_tmp4 = 1;
  HXDLIN( 143)				centroid5[_hx_tmp4] = (centroid5->__get(_hx_tmp4) + points->__get(tri->__get(1)).StaticCast< ::Array< Float > >()->__get(1));
  HXDLIN( 143)				::Array< Float > centroid6 = centroid;
  HXDLIN( 143)				int _hx_tmp5 = 2;
  HXDLIN( 143)				centroid6[_hx_tmp5] = (centroid6->__get(_hx_tmp5) + points->__get(tri->__get(1)).StaticCast< ::Array< Float > >()->__get(2));
              			}
  HXLINE( 142)			{
  HXLINE( 143)				::Array< Float > centroid7 = centroid;
  HXDLIN( 143)				int _hx_tmp6 = 0;
  HXDLIN( 143)				centroid7[_hx_tmp6] = (centroid7->__get(_hx_tmp6) + points->__get(tri->__get(2)).StaticCast< ::Array< Float > >()->__get(0));
  HXDLIN( 143)				::Array< Float > centroid8 = centroid;
  HXDLIN( 143)				int _hx_tmp7 = 1;
  HXDLIN( 143)				centroid8[_hx_tmp7] = (centroid8->__get(_hx_tmp7) + points->__get(tri->__get(2)).StaticCast< ::Array< Float > >()->__get(1));
  HXDLIN( 143)				::Array< Float > centroid9 = centroid;
  HXDLIN( 143)				int _hx_tmp8 = 2;
  HXDLIN( 143)				centroid9[_hx_tmp8] = (centroid9->__get(_hx_tmp8) + points->__get(tri->__get(2)).StaticCast< ::Array< Float > >()->__get(2));
              			}
              		}
  HXLINE( 147)		{
  HXLINE( 148)			::Array< Float > centroid10 = centroid;
  HXDLIN( 148)			int _hx_tmp9 = 0;
  HXDLIN( 148)			centroid10[_hx_tmp9] = (centroid10->__get(_hx_tmp9) / ( (Float)(3) ));
  HXDLIN( 148)			::Array< Float > centroid11 = centroid;
  HXDLIN( 148)			int _hx_tmp10 = 1;
  HXDLIN( 148)			centroid11[_hx_tmp10] = (centroid11->__get(_hx_tmp10) / ( (Float)(3) ));
  HXDLIN( 148)			::Array< Float > centroid12 = centroid;
  HXDLIN( 148)			int _hx_tmp11 = 2;
  HXDLIN( 148)			centroid12[_hx_tmp11] = (centroid12->__get(_hx_tmp11) / ( (Float)(3) ));
              		}
  HXLINE( 151)		return centroid;
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC2(Mesh_obj,getTriangleCentroid,return )
  
  ::Array< Float > Mesh_obj::triangleUVFromPoint( ::verb::core::MeshData mesh,int faceIndex,::Array< Float > f){
              	HX_STACKFRAME(&_hx_pos_ec5f9bbfd835186b_166_triangleUVFromPoint)
  HXLINE( 168)		::Array< int > tri = mesh->faces->__get(faceIndex).StaticCast< ::Array< int > >();
  HXLINE( 170)		::Array< Float > p1 = mesh->points->__get(tri->__get(0)).StaticCast< ::Array< Float > >();
  HXLINE( 171)		::Array< Float > p2 = mesh->points->__get(tri->__get(1)).StaticCast< ::Array< Float > >();
  HXLINE( 172)		::Array< Float > p3 = mesh->points->__get(tri->__get(2)).StaticCast< ::Array< Float > >();
  HXLINE( 174)		::Array< Float > uv1 = mesh->uvs->__get(tri->__get(0)).StaticCast< ::Array< Float > >();
  HXLINE( 175)		::Array< Float > uv2 = mesh->uvs->__get(tri->__get(1)).StaticCast< ::Array< Float > >();
  HXLINE( 176)		::Array< Float > uv3 = mesh->uvs->__get(tri->__get(2)).StaticCast< ::Array< Float > >();
  HXLINE( 178)		::Array< Float > f1 = ::verb::core::Vec_obj::sub(p1,f);
  HXLINE( 179)		::Array< Float > f2 = ::verb::core::Vec_obj::sub(p2,f);
  HXLINE( 180)		::Array< Float > f3 = ::verb::core::Vec_obj::sub(p3,f);
  HXLINE( 183)		::Array< Float > a = ::verb::core::Vec_obj::sub(p1,p2);
  HXDLIN( 183)		Float a1 = ::verb::core::Vec_obj::norm(::verb::core::Vec_obj::cross(a,::verb::core::Vec_obj::sub(p1,p3)));
  HXLINE( 184)		Float a11 = (::verb::core::Vec_obj::norm(::verb::core::Vec_obj::cross(f2,f3)) / a1);
  HXLINE( 185)		Float a2 = (::verb::core::Vec_obj::norm(::verb::core::Vec_obj::cross(f3,f1)) / a1);
  HXLINE( 186)		Float a3 = (::verb::core::Vec_obj::norm(::verb::core::Vec_obj::cross(f1,f2)) / a1);
  HXLINE( 189)		::Array< Float > _hx_tmp = ::verb::core::Vec_obj::mul(a11,uv1);
  HXDLIN( 189)		::Array< Float > _hx_tmp1 = ::verb::core::Vec_obj::mul(a2,uv2);
  HXDLIN( 189)		return ::verb::core::Vec_obj::add(_hx_tmp,::verb::core::Vec_obj::add(_hx_tmp1,::verb::core::Vec_obj::mul(a3,uv3)));
              	}
  
  
  STATIC_HX_DEFINE_DYNAMIC_FUNC3(Mesh_obj,triangleUVFromPoint,return )
  
  
  Mesh_obj::Mesh_obj()
  {
  }
  
  bool Mesh_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
  {
  	switch(inName.length) {
  	case 12:
  		if (HX_FIELD_EQ(inName,"makeMeshAabb") ) { outValue = makeMeshAabb_dyn(); return true; }
  		break;
  	case 15:
  		if (HX_FIELD_EQ(inName,"getTriangleNorm") ) { outValue = getTriangleNorm_dyn(); return true; }
  		break;
  	case 17:
  		if (HX_FIELD_EQ(inName,"getMinCoordOnAxis") ) { outValue = getMinCoordOnAxis_dyn(); return true; }
  		break;
  	case 19:
  		if (HX_FIELD_EQ(inName,"getTriangleCentroid") ) { outValue = getTriangleCentroid_dyn(); return true; }
  		if (HX_FIELD_EQ(inName,"triangleUVFromPoint") ) { outValue = triangleUVFromPoint_dyn(); return true; }
  		break;
  	case 26:
  		if (HX_FIELD_EQ(inName,"sortTrianglesOnLongestAxis") ) { outValue = sortTrianglesOnLongestAxis_dyn(); return true; }
  	}
  	return false;
  }
  
  #ifdef HXCPP_SCRIPTABLE
  static ::hx::StorageInfo *Mesh_obj_sMemberStorageInfo = 0;
  static ::hx::StaticInfo *Mesh_obj_sStaticStorageInfo = 0;
  #endif
  
  ::hx::Class Mesh_obj::__mClass;
  
  static ::String Mesh_obj_sStaticFields[] = {
  	HX_("getTriangleNorm",da,5a,6e,f5),
  	HX_("makeMeshAabb",3b,a7,42,0f),
  	HX_("sortTrianglesOnLongestAxis",7f,ed,21,d2),
  	HX_("getMinCoordOnAxis",b9,24,12,92),
  	HX_("getTriangleCentroid",de,cb,0b,7f),
  	HX_("triangleUVFromPoint",1d,06,0e,df),
  	::String(null())
  };
  
  void Mesh_obj::__register()
  {
  	Mesh_obj _hx_dummy;
  	Mesh_obj::_hx_vtable = *(void **)&_hx_dummy;
  	::hx::Static(__mClass) = new ::hx::Class_obj();
  	__mClass->mName = HX_("verb.core.Mesh",ed,ea,11,61);
  	__mClass->mSuper = &super::__SGetClass();
  	__mClass->mConstructEmpty = &__CreateEmpty;
  	__mClass->mConstructArgs = &__Create;
  	__mClass->mGetStaticField = &Mesh_obj::__GetStatic;
  	__mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
  	__mClass->mStatics = ::hx::Class_obj::dupFunctions(Mesh_obj_sStaticFields);
  	__mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
  	__mClass->mCanCast = ::hx::TCanCast< Mesh_obj >;
  #ifdef HXCPP_SCRIPTABLE
  	__mClass->mMemberStorageInfo = Mesh_obj_sMemberStorageInfo;
  #endif
  #ifdef HXCPP_SCRIPTABLE
  	__mClass->mStaticStorageInfo = Mesh_obj_sStaticStorageInfo;
  #endif
  	::hx::_hx_RegisterClass(__mClass->mName, __mClass);
  }
  
  } // end namespace verb
  } // end namespace core
  