text: // For conditions of distribution and use, see copyright notice in LICENSE
  // This file has been autogenerated with BindingsGenerator
  
  #include "StableHeaders.h"
  #include "CoreTypes.h"
  #include "JavaScriptInstance.h"
  #include "LoggingFunctions.h"
  #include "Geometry/AABB.h"
  
  #ifdef _MSC_VER
  #pragma warning(disable: 4800)
  #endif
  
  #include "Math/float3.h"
  #include "Geometry/OBB.h"
  #include "Geometry/Sphere.h"
  #include "Geometry/LineSegment.h"
  #include "Geometry/Plane.h"
  #include "Algorithm/Random/LCG.h"
  #include "Math/float3x3.h"
  #include "Math/float3x4.h"
  #include "Math/float4x4.h"
  #include "Math/Quat.h"
  #include "Geometry/Triangle.h"
  #include "Geometry/Frustum.h"
  #include "Geometry/Capsule.h"
  #include "Geometry/Ray.h"
  #include "Geometry/Line.h"
  
  using namespace std;
  
  namespace JSBindings
  {
  
  static const char* float3_ID = "float3";
  static const char* OBB_ID = "OBB";
  static const char* Sphere_ID = "Sphere";
  static const char* LineSegment_ID = "LineSegment";
  static const char* Plane_ID = "Plane";
  static const char* LCG_ID = "LCG";
  static const char* float3x3_ID = "float3x3";
  static const char* float3x4_ID = "float3x4";
  static const char* float4x4_ID = "float4x4";
  static const char* Quat_ID = "Quat";
  static const char* Triangle_ID = "Triangle";
  static const char* Frustum_ID = "Frustum";
  static const char* Capsule_ID = "Capsule";
  static const char* Ray_ID = "Ray";
  static const char* Line_ID = "Line";
  
  static duk_ret_t float3_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<float3>(ctx, float3_ID);
      return 0;
  }
  
  static duk_ret_t OBB_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<OBB>(ctx, OBB_ID);
      return 0;
  }
  
  static duk_ret_t Sphere_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<Sphere>(ctx, Sphere_ID);
      return 0;
  }
  
  static duk_ret_t LineSegment_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<LineSegment>(ctx, LineSegment_ID);
      return 0;
  }
  
  static duk_ret_t Plane_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<Plane>(ctx, Plane_ID);
      return 0;
  }
  
  
  static const char* AABB_ID = "AABB";
  
  static duk_ret_t AABB_Finalizer(duk_context* ctx)
  {
      FinalizeValueObject<AABB>(ctx, AABB_ID);
      return 0;
  }
  
  static duk_ret_t AABB_Set_minPoint(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& minPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      thisObj->minPoint = minPoint;
      return 0;
  }
  
  static duk_ret_t AABB_Get_minPoint(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      PushValueObject<float3>(ctx, &thisObj->minPoint, float3_ID, nullptr, true);
      return 1;
  }
  
  static duk_ret_t AABB_Set_maxPoint(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& maxPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      thisObj->maxPoint = maxPoint;
      return 0;
  }
  
  static duk_ret_t AABB_Get_maxPoint(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      PushValueObject<float3>(ctx, &thisObj->maxPoint, float3_ID, nullptr, true);
      return 1;
  }
  
  static duk_ret_t AABB_Ctor(duk_context* ctx)
  {
      AABB* newObj = new AABB();
      PushConstructorResult<AABB>(ctx, newObj, AABB_ID, AABB_Finalizer);
      return 0;
  }
  
  static duk_ret_t AABB_Ctor_float3_float3(duk_context* ctx)
  {
      float3& minPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& maxPoint = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      AABB* newObj = new AABB(minPoint, maxPoint);
      PushConstructorResult<AABB>(ctx, newObj, AABB_ID, AABB_Finalizer);
      return 0;
  }
  
  static duk_ret_t AABB_Ctor_OBB(duk_context* ctx)
  {
      OBB& obb = *GetCheckedValueObject<OBB>(ctx, 0, OBB_ID);
      AABB* newObj = new AABB(obb);
      PushConstructorResult<AABB>(ctx, newObj, AABB_ID, AABB_Finalizer);
      return 0;
  }
  
  static duk_ret_t AABB_Ctor_Sphere(duk_context* ctx)
  {
      Sphere& s = *GetCheckedValueObject<Sphere>(ctx, 0, Sphere_ID);
      AABB* newObj = new AABB(s);
      PushConstructorResult<AABB>(ctx, newObj, AABB_ID, AABB_Finalizer);
      return 0;
  }
  
  static duk_ret_t AABB_MinX(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MinX();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_MinY(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MinY();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_MinZ(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MinZ();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_MaxX(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MaxX();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_MaxY(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MaxY();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_MaxZ(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->MaxZ();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_SetNegativeInfinity(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      thisObj->SetNegativeInfinity();
      return 0;
  }
  
  static duk_ret_t AABB_SetFromCenterAndSize_float3_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& center = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& size = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      thisObj->SetFromCenterAndSize(center, size);
      return 0;
  }
  
  static duk_ret_t AABB_SetFrom_OBB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      OBB& obb = *GetCheckedValueObject<OBB>(ctx, 0, OBB_ID);
      thisObj->SetFrom(obb);
      return 0;
  }
  
  static duk_ret_t AABB_SetFrom_Sphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere& s = *GetCheckedValueObject<Sphere>(ctx, 0, Sphere_ID);
      thisObj->SetFrom(s);
      return 0;
  }
  
  static duk_ret_t AABB_ToOBB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      OBB ret = thisObj->ToOBB();
      PushValueObjectCopy<OBB>(ctx, ret, OBB_ID, OBB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_MinimalEnclosingSphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere ret = thisObj->MinimalEnclosingSphere();
      PushValueObjectCopy<Sphere>(ctx, ret, Sphere_ID, Sphere_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_MaximalContainedSphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere ret = thisObj->MaximalContainedSphere();
      PushValueObjectCopy<Sphere>(ctx, ret, Sphere_ID, Sphere_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_IsFinite(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      bool ret = thisObj->IsFinite();
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_IsDegenerate(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      bool ret = thisObj->IsDegenerate();
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_CenterPoint(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->CenterPoint();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Centroid(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->Centroid();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_AnyPointFast(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->AnyPointFast();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_PointInside_float_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float x = (float)duk_require_number(ctx, 0);
      float y = (float)duk_require_number(ctx, 1);
      float z = (float)duk_require_number(ctx, 2);
      float3 ret = thisObj->PointInside(x, y, z);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Edge_int(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int edgeIndex = (int)duk_require_number(ctx, 0);
      LineSegment ret = thisObj->Edge(edgeIndex);
      PushValueObjectCopy<LineSegment>(ctx, ret, LineSegment_ID, LineSegment_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_CornerPoint_int(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int cornerIndex = (int)duk_require_number(ctx, 0);
      float3 ret = thisObj->CornerPoint(cornerIndex);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_ExtremePoint_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& direction = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3 ret = thisObj->ExtremePoint(direction);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_ExtremePoint_float3_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& direction = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float projectionDistance = (float)duk_require_number(ctx, 1);
      float3 ret = thisObj->ExtremePoint(direction, projectionDistance);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_PointOnEdge_int_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int edgeIndex = (int)duk_require_number(ctx, 0);
      float u = (float)duk_require_number(ctx, 1);
      float3 ret = thisObj->PointOnEdge(edgeIndex, u);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_FaceCenterPoint_int(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int faceIndex = (int)duk_require_number(ctx, 0);
      float3 ret = thisObj->FaceCenterPoint(faceIndex);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_FacePoint_int_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int faceIndex = (int)duk_require_number(ctx, 0);
      float u = (float)duk_require_number(ctx, 1);
      float v = (float)duk_require_number(ctx, 2);
      float3 ret = thisObj->FacePoint(faceIndex, u, v);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_FaceNormal_int(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int faceIndex = (int)duk_require_number(ctx, 0);
      float3 ret = thisObj->FaceNormal(faceIndex);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_FacePlane_int(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      int faceIndex = (int)duk_require_number(ctx, 0);
      Plane ret = thisObj->FacePlane(faceIndex);
      PushValueObjectCopy<Plane>(ctx, ret, Plane_ID, Plane_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Size(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->Size();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_HalfSize(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->HalfSize();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Diagonal(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->Diagonal();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_HalfDiagonal(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3 ret = thisObj->HalfDiagonal();
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Volume(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->Volume();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_SurfaceArea(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float ret = thisObj->SurfaceArea();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_RandomPointInside_LCG(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LCG& rng = *GetCheckedValueObject<LCG>(ctx, 0, LCG_ID);
      float3 ret = thisObj->RandomPointInside(rng);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_RandomPointOnSurface_LCG(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LCG& rng = *GetCheckedValueObject<LCG>(ctx, 0, LCG_ID);
      float3 ret = thisObj->RandomPointOnSurface(rng);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_RandomPointOnEdge_LCG(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LCG& rng = *GetCheckedValueObject<LCG>(ctx, 0, LCG_ID);
      float3 ret = thisObj->RandomPointOnEdge(rng);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_RandomCornerPoint_LCG(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LCG& rng = *GetCheckedValueObject<LCG>(ctx, 0, LCG_ID);
      float3 ret = thisObj->RandomCornerPoint(rng);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Translate_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& offset = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      thisObj->Translate(offset);
      return 0;
  }
  
  static duk_ret_t AABB_Scale_float3_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& centerPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float scaleFactor = (float)duk_require_number(ctx, 1);
      thisObj->Scale(centerPoint, scaleFactor);
      return 0;
  }
  
  static duk_ret_t AABB_Scale_float3_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& centerPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& scaleFactor = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      thisObj->Scale(centerPoint, scaleFactor);
      return 0;
  }
  
  static duk_ret_t AABB_TransformAsAABB_float3x3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3x3& transform = *GetCheckedValueObject<float3x3>(ctx, 0, float3x3_ID);
      thisObj->TransformAsAABB(transform);
      return 0;
  }
  
  static duk_ret_t AABB_TransformAsAABB_float3x4(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3x4& transform = *GetCheckedValueObject<float3x4>(ctx, 0, float3x4_ID);
      thisObj->TransformAsAABB(transform);
      return 0;
  }
  
  static duk_ret_t AABB_TransformAsAABB_float4x4(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float4x4& transform = *GetCheckedValueObject<float4x4>(ctx, 0, float4x4_ID);
      thisObj->TransformAsAABB(transform);
      return 0;
  }
  
  static duk_ret_t AABB_TransformAsAABB_Quat(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Quat& transform = *GetCheckedValueObject<Quat>(ctx, 0, Quat_ID);
      thisObj->TransformAsAABB(transform);
      return 0;
  }
  
  static duk_ret_t AABB_Transform_float3x3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3x3& transform = *GetCheckedValueObject<float3x3>(ctx, 0, float3x3_ID);
      OBB ret = thisObj->Transform(transform);
      PushValueObjectCopy<OBB>(ctx, ret, OBB_ID, OBB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Transform_float3x4(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3x4& transform = *GetCheckedValueObject<float3x4>(ctx, 0, float3x4_ID);
      OBB ret = thisObj->Transform(transform);
      PushValueObjectCopy<OBB>(ctx, ret, OBB_ID, OBB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Transform_float4x4(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float4x4& transform = *GetCheckedValueObject<float4x4>(ctx, 0, float4x4_ID);
      OBB ret = thisObj->Transform(transform);
      PushValueObjectCopy<OBB>(ctx, ret, OBB_ID, OBB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Transform_Quat(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Quat& transform = *GetCheckedValueObject<Quat>(ctx, 0, Quat_ID);
      OBB ret = thisObj->Transform(transform);
      PushValueObjectCopy<OBB>(ctx, ret, OBB_ID, OBB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_ClosestPoint_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& targetPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3 ret = thisObj->ClosestPoint(targetPoint);
      PushValueObjectCopy<float3>(ctx, ret, float3_ID, float3_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_Distance_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& point = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float ret = thisObj->Distance(point);
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Distance_Sphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere& sphere = *GetCheckedValueObject<Sphere>(ctx, 0, Sphere_ID);
      float ret = thisObj->Distance(sphere);
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& point = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      bool ret = thisObj->Contains(point);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_LineSegment(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LineSegment& lineSegment = *GetCheckedValueObject<LineSegment>(ctx, 0, LineSegment_ID);
      bool ret = thisObj->Contains(lineSegment);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_float3_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& aabbMinPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& aabbMaxPoint = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      bool ret = thisObj->Contains(aabbMinPoint, aabbMaxPoint);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_AABB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& aabb = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      bool ret = thisObj->Contains(aabb);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_OBB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      OBB& obb = *GetCheckedValueObject<OBB>(ctx, 0, OBB_ID);
      bool ret = thisObj->Contains(obb);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_Sphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere& sphere = *GetCheckedValueObject<Sphere>(ctx, 0, Sphere_ID);
      bool ret = thisObj->Contains(sphere);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_Triangle(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Triangle& triangle = *GetCheckedValueObject<Triangle>(ctx, 0, Triangle_ID);
      bool ret = thisObj->Contains(triangle);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_Frustum(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Frustum& frustum = *GetCheckedValueObject<Frustum>(ctx, 0, Frustum_ID);
      bool ret = thisObj->Contains(frustum);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Contains_Capsule(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Capsule& capsule = *GetCheckedValueObject<Capsule>(ctx, 0, Capsule_ID);
      bool ret = thisObj->Contains(capsule);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Ray_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Ray& ray = *GetCheckedValueObject<Ray>(ctx, 0, Ray_ID);
      float dNear = (float)duk_require_number(ctx, 1);
      float dFar = (float)duk_require_number(ctx, 2);
      bool ret = thisObj->Intersects(ray, dNear, dFar);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Ray(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Ray& ray = *GetCheckedValueObject<Ray>(ctx, 0, Ray_ID);
      bool ret = thisObj->Intersects(ray);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Line_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Line& line = *GetCheckedValueObject<Line>(ctx, 0, Line_ID);
      float dNear = (float)duk_require_number(ctx, 1);
      float dFar = (float)duk_require_number(ctx, 2);
      bool ret = thisObj->Intersects(line, dNear, dFar);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Line(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Line& line = *GetCheckedValueObject<Line>(ctx, 0, Line_ID);
      bool ret = thisObj->Intersects(line);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_LineSegment_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LineSegment& lineSegment = *GetCheckedValueObject<LineSegment>(ctx, 0, LineSegment_ID);
      float dNear = (float)duk_require_number(ctx, 1);
      float dFar = (float)duk_require_number(ctx, 2);
      bool ret = thisObj->Intersects(lineSegment, dNear, dFar);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_LineSegment(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LineSegment& lineSegment = *GetCheckedValueObject<LineSegment>(ctx, 0, LineSegment_ID);
      bool ret = thisObj->Intersects(lineSegment);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Plane(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Plane& plane = *GetCheckedValueObject<Plane>(ctx, 0, Plane_ID);
      bool ret = thisObj->Intersects(plane);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_AABB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& aabb = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      bool ret = thisObj->Intersects(aabb);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_OBB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      OBB& obb = *GetCheckedValueObject<OBB>(ctx, 0, OBB_ID);
      bool ret = thisObj->Intersects(obb);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Capsule(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Capsule& capsule = *GetCheckedValueObject<Capsule>(ctx, 0, Capsule_ID);
      bool ret = thisObj->Intersects(capsule);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Triangle(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Triangle& triangle = *GetCheckedValueObject<Triangle>(ctx, 0, Triangle_ID);
      bool ret = thisObj->Intersects(triangle);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Intersects_Frustum(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Frustum& frustum = *GetCheckedValueObject<Frustum>(ctx, 0, Frustum_ID);
      bool ret = thisObj->Intersects(frustum);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_ProjectToAxis_float3_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& axis = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float dMin = (float)duk_require_number(ctx, 1);
      float dMax = (float)duk_require_number(ctx, 2);
      thisObj->ProjectToAxis(axis, dMin, dMax);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& point = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      thisObj->Enclose(point);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_float3_float3(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& aabbMinPoint = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& aabbMaxPoint = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      thisObj->Enclose(aabbMinPoint, aabbMaxPoint);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_LineSegment(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      LineSegment& lineSegment = *GetCheckedValueObject<LineSegment>(ctx, 0, LineSegment_ID);
      thisObj->Enclose(lineSegment);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_AABB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& aabb = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      thisObj->Enclose(aabb);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_OBB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      OBB& obb = *GetCheckedValueObject<OBB>(ctx, 0, OBB_ID);
      thisObj->Enclose(obb);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_Sphere(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Sphere& sphere = *GetCheckedValueObject<Sphere>(ctx, 0, Sphere_ID);
      thisObj->Enclose(sphere);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_Triangle(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Triangle& triangle = *GetCheckedValueObject<Triangle>(ctx, 0, Triangle_ID);
      thisObj->Enclose(triangle);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_Capsule(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Capsule& capsule = *GetCheckedValueObject<Capsule>(ctx, 0, Capsule_ID);
      thisObj->Enclose(capsule);
      return 0;
  }
  
  static duk_ret_t AABB_Enclose_Frustum(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      Frustum& frustum = *GetCheckedValueObject<Frustum>(ctx, 0, Frustum_ID);
      thisObj->Enclose(frustum);
      return 0;
  }
  
  static duk_ret_t AABB_ToString(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      string ret = thisObj->ToString();
      duk_push_string(ctx, ret.c_str());
      return 1;
  }
  
  static duk_ret_t AABB_SerializeToString(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      string ret = thisObj->SerializeToString();
      duk_push_string(ctx, ret.c_str());
      return 1;
  }
  
  static duk_ret_t AABB_SerializeToCodeString(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      string ret = thisObj->SerializeToCodeString();
      duk_push_string(ctx, ret.c_str());
      return 1;
  }
  
  static duk_ret_t AABB_Intersection_AABB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& aabb = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      AABB ret = thisObj->Intersection(aabb);
      PushValueObjectCopy<AABB>(ctx, ret, AABB_ID, AABB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_IntersectLineAABB_float3_float3_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& linePos = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& lineDir = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      float tNear = (float)duk_require_number(ctx, 2);
      float tFar = (float)duk_require_number(ctx, 3);
      bool ret = thisObj->IntersectLineAABB(linePos, lineDir, tNear, tFar);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_IntersectLineAABB_CPP_float3_float3_float_float(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      float3& linePos = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& lineDir = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      float tNear = (float)duk_require_number(ctx, 2);
      float tFar = (float)duk_require_number(ctx, 3);
      bool ret = thisObj->IntersectLineAABB_CPP(linePos, lineDir, tNear, tFar);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Equals_AABB_float(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& rhs = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      float epsilon = numArgs > 1 ? (float)duk_require_number(ctx, 1) : 1e-3f;
      bool ret = thisObj->Equals(rhs, epsilon);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_BitEquals_AABB(duk_context* ctx)
  {
      AABB* thisObj = GetThisValueObject<AABB>(ctx, AABB_ID);
      AABB& other = *GetCheckedValueObject<AABB>(ctx, 0, AABB_ID);
      bool ret = thisObj->BitEquals(other);
      duk_push_boolean(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_Ctor_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && GetValueObject<float3>(ctx, 1, float3_ID))
          return AABB_Ctor_float3_float3(ctx);
      if (numArgs == 1 && GetValueObject<OBB>(ctx, 0, OBB_ID))
          return AABB_Ctor_OBB(ctx);
      if (numArgs == 1 && GetValueObject<Sphere>(ctx, 0, Sphere_ID))
          return AABB_Ctor_Sphere(ctx);
      if (numArgs == 0)
          return AABB_Ctor(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_SetFrom_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 1 && GetValueObject<Sphere>(ctx, 0, Sphere_ID))
          return AABB_SetFrom_Sphere(ctx);
      if (numArgs == 1 && GetValueObject<OBB>(ctx, 0, OBB_ID))
          return AABB_SetFrom_OBB(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_ExtremePoint_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && duk_is_number(ctx, 1))
          return AABB_ExtremePoint_float3_float(ctx);
      if (numArgs == 1 && GetValueObject<float3>(ctx, 0, float3_ID))
          return AABB_ExtremePoint_float3(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Scale_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && GetValueObject<float3>(ctx, 1, float3_ID))
          return AABB_Scale_float3_float3(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && duk_is_number(ctx, 1))
          return AABB_Scale_float3_float(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_TransformAsAABB_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 1 && GetValueObject<float4x4>(ctx, 0, float4x4_ID))
          return AABB_TransformAsAABB_float4x4(ctx);
      if (numArgs == 1 && GetValueObject<Quat>(ctx, 0, Quat_ID))
          return AABB_TransformAsAABB_Quat(ctx);
      if (numArgs == 1 && GetValueObject<float3x3>(ctx, 0, float3x3_ID))
          return AABB_TransformAsAABB_float3x3(ctx);
      if (numArgs == 1 && GetValueObject<float3x4>(ctx, 0, float3x4_ID))
          return AABB_TransformAsAABB_float3x4(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Transform_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 1 && GetValueObject<float4x4>(ctx, 0, float4x4_ID))
          return AABB_Transform_float4x4(ctx);
      if (numArgs == 1 && GetValueObject<Quat>(ctx, 0, Quat_ID))
          return AABB_Transform_Quat(ctx);
      if (numArgs == 1 && GetValueObject<float3x3>(ctx, 0, float3x3_ID))
          return AABB_Transform_float3x3(ctx);
      if (numArgs == 1 && GetValueObject<float3x4>(ctx, 0, float3x4_ID))
          return AABB_Transform_float3x4(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Distance_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 1 && GetValueObject<Sphere>(ctx, 0, Sphere_ID))
          return AABB_Distance_Sphere(ctx);
      if (numArgs == 1 && GetValueObject<float3>(ctx, 0, float3_ID))
          return AABB_Distance_float3(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Contains_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && GetValueObject<float3>(ctx, 1, float3_ID))
          return AABB_Contains_float3_float3(ctx);
      if (numArgs == 1 && GetValueObject<Triangle>(ctx, 0, Triangle_ID))
          return AABB_Contains_Triangle(ctx);
      if (numArgs == 1 && GetValueObject<Sphere>(ctx, 0, Sphere_ID))
          return AABB_Contains_Sphere(ctx);
      if (numArgs == 1 && GetValueObject<Frustum>(ctx, 0, Frustum_ID))
          return AABB_Contains_Frustum(ctx);
      if (numArgs == 1 && GetValueObject<Capsule>(ctx, 0, Capsule_ID))
          return AABB_Contains_Capsule(ctx);
      if (numArgs == 1 && GetValueObject<LineSegment>(ctx, 0, LineSegment_ID))
          return AABB_Contains_LineSegment(ctx);
      if (numArgs == 1 && GetValueObject<float3>(ctx, 0, float3_ID))
          return AABB_Contains_float3(ctx);
      if (numArgs == 1 && GetValueObject<OBB>(ctx, 0, OBB_ID))
          return AABB_Contains_OBB(ctx);
      if (numArgs == 1 && GetValueObject<AABB>(ctx, 0, AABB_ID))
          return AABB_Contains_AABB(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Intersects_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 3 && GetValueObject<Line>(ctx, 0, Line_ID) && duk_is_number(ctx, 1) && duk_is_number(ctx, 2))
          return AABB_Intersects_Line_float_float(ctx);
      if (numArgs == 3 && GetValueObject<LineSegment>(ctx, 0, LineSegment_ID) && duk_is_number(ctx, 1) && duk_is_number(ctx, 2))
          return AABB_Intersects_LineSegment_float_float(ctx);
      if (numArgs == 3 && GetValueObject<Ray>(ctx, 0, Ray_ID) && duk_is_number(ctx, 1) && duk_is_number(ctx, 2))
          return AABB_Intersects_Ray_float_float(ctx);
      if (numArgs == 1 && GetValueObject<OBB>(ctx, 0, OBB_ID))
          return AABB_Intersects_OBB(ctx);
      if (numArgs == 1 && GetValueObject<Capsule>(ctx, 0, Capsule_ID))
          return AABB_Intersects_Capsule(ctx);
      if (numArgs == 1 && GetValueObject<Frustum>(ctx, 0, Frustum_ID))
          return AABB_Intersects_Frustum(ctx);
      if (numArgs == 1 && GetValueObject<Triangle>(ctx, 0, Triangle_ID))
          return AABB_Intersects_Triangle(ctx);
      if (numArgs == 1 && GetValueObject<AABB>(ctx, 0, AABB_ID))
          return AABB_Intersects_AABB(ctx);
      if (numArgs == 1 && GetValueObject<Line>(ctx, 0, Line_ID))
          return AABB_Intersects_Line(ctx);
      if (numArgs == 1 && GetValueObject<Ray>(ctx, 0, Ray_ID))
          return AABB_Intersects_Ray(ctx);
      if (numArgs == 1 && GetValueObject<Plane>(ctx, 0, Plane_ID))
          return AABB_Intersects_Plane(ctx);
      if (numArgs == 1 && GetValueObject<LineSegment>(ctx, 0, LineSegment_ID))
          return AABB_Intersects_LineSegment(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_Enclose_Selector(duk_context* ctx)
  {
      int numArgs = duk_get_top(ctx);
      if (numArgs == 2 && GetValueObject<float3>(ctx, 0, float3_ID) && GetValueObject<float3>(ctx, 1, float3_ID))
          return AABB_Enclose_float3_float3(ctx);
      if (numArgs == 1 && GetValueObject<Triangle>(ctx, 0, Triangle_ID))
          return AABB_Enclose_Triangle(ctx);
      if (numArgs == 1 && GetValueObject<Sphere>(ctx, 0, Sphere_ID))
          return AABB_Enclose_Sphere(ctx);
      if (numArgs == 1 && GetValueObject<Frustum>(ctx, 0, Frustum_ID))
          return AABB_Enclose_Frustum(ctx);
      if (numArgs == 1 && GetValueObject<Capsule>(ctx, 0, Capsule_ID))
          return AABB_Enclose_Capsule(ctx);
      if (numArgs == 1 && GetValueObject<LineSegment>(ctx, 0, LineSegment_ID))
          return AABB_Enclose_LineSegment(ctx);
      if (numArgs == 1 && GetValueObject<float3>(ctx, 0, float3_ID))
          return AABB_Enclose_float3(ctx);
      if (numArgs == 1 && GetValueObject<OBB>(ctx, 0, OBB_ID))
          return AABB_Enclose_OBB(ctx);
      if (numArgs == 1 && GetValueObject<AABB>(ctx, 0, AABB_ID))
          return AABB_Enclose_AABB(ctx);
      duk_error(ctx, DUK_ERR_ERROR, "Could not select function overload");
  }
  
  static duk_ret_t AABB_FromCenterAndSize_Static_float3_float3(duk_context* ctx)
  {
      float3& aabbCenterPos = *GetCheckedValueObject<float3>(ctx, 0, float3_ID);
      float3& aabbSize = *GetCheckedValueObject<float3>(ctx, 1, float3_ID);
      AABB ret = AABB::FromCenterAndSize(aabbCenterPos, aabbSize);
      PushValueObjectCopy<AABB>(ctx, ret, AABB_ID, AABB_Finalizer);
      return 1;
  }
  
  static duk_ret_t AABB_NumVerticesInTriangulation_Static_int_int_int(duk_context* ctx)
  {
      int numFacesX = (int)duk_require_number(ctx, 0);
      int numFacesY = (int)duk_require_number(ctx, 1);
      int numFacesZ = (int)duk_require_number(ctx, 2);
      int ret = AABB::NumVerticesInTriangulation(numFacesX, numFacesY, numFacesZ);
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_NumVerticesInEdgeList_Static(duk_context* ctx)
  {
      int ret = AABB::NumVerticesInEdgeList();
      duk_push_number(ctx, ret);
      return 1;
  }
  
  static duk_ret_t AABB_FromString_Static_string(duk_context* ctx)
  {
      string str = duk_require_string(ctx, 0);
      AABB ret = AABB::FromString(str);
      PushValueObjectCopy<AABB>(ctx, ret, AABB_ID, AABB_Finalizer);
      return 1;
  }
  
  static const duk_function_list_entry AABB_Functions[] = {
      {"MinX", AABB_MinX, 0}
      ,{"MinY", AABB_MinY, 0}
      ,{"MinZ", AABB_MinZ, 0}
      ,{"MaxX", AABB_MaxX, 0}
      ,{"MaxY", AABB_MaxY, 0}
      ,{"MaxZ", AABB_MaxZ, 0}
      ,{"SetNegativeInfinity", AABB_SetNegativeInfinity, 0}
      ,{"SetFromCenterAndSize", AABB_SetFromCenterAndSize_float3_float3, 2}
      ,{"SetFrom", AABB_SetFrom_Selector, DUK_VARARGS}
      ,{"ToOBB", AABB_ToOBB, 0}
      ,{"MinimalEnclosingSphere", AABB_MinimalEnclosingSphere, 0}
      ,{"MaximalContainedSphere", AABB_MaximalContainedSphere, 0}
      ,{"IsFinite", AABB_IsFinite, 0}
      ,{"IsDegenerate", AABB_IsDegenerate, 0}
      ,{"CenterPoint", AABB_CenterPoint, 0}
      ,{"Centroid", AABB_Centroid, 0}
      ,{"AnyPointFast", AABB_AnyPointFast, 0}
      ,{"PointInside", AABB_PointInside_float_float_float, 3}
      ,{"Edge", AABB_Edge_int, 1}
      ,{"CornerPoint", AABB_CornerPoint_int, 1}
      ,{"ExtremePoint", AABB_ExtremePoint_Selector, DUK_VARARGS}
      ,{"PointOnEdge", AABB_PointOnEdge_int_float, 2}
      ,{"FaceCenterPoint", AABB_FaceCenterPoint_int, 1}
      ,{"FacePoint", AABB_FacePoint_int_float_float, 3}
      ,{"FaceNormal", AABB_FaceNormal_int, 1}
      ,{"FacePlane", AABB_FacePlane_int, 1}
      ,{"Size", AABB_Size, 0}
      ,{"HalfSize", AABB_HalfSize, 0}
      ,{"Diagonal", AABB_Diagonal, 0}
      ,{"HalfDiagonal", AABB_HalfDiagonal, 0}
      ,{"Volume", AABB_Volume, 0}
      ,{"SurfaceArea", AABB_SurfaceArea, 0}
      ,{"RandomPointInside", AABB_RandomPointInside_LCG, 1}
      ,{"RandomPointOnSurface", AABB_RandomPointOnSurface_LCG, 1}
      ,{"RandomPointOnEdge", AABB_RandomPointOnEdge_LCG, 1}
      ,{"RandomCornerPoint", AABB_RandomCornerPoint_LCG, 1}
      ,{"Translate", AABB_Translate_float3, 1}
      ,{"Scale", AABB_Scale_Selector, DUK_VARARGS}
      ,{"TransformAsAABB", AABB_TransformAsAABB_Selector, DUK_VARARGS}
      ,{"Transform", AABB_Transform_Selector, DUK_VARARGS}
      ,{"ClosestPoint", AABB_ClosestPoint_float3, 1}
      ,{"Distance", AABB_Distance_Selector, DUK_VARARGS}
      ,{"Contains", AABB_Contains_Selector, DUK_VARARGS}
      ,{"Intersects", AABB_Intersects_Selector, DUK_VARARGS}
      ,{"ProjectToAxis", AABB_ProjectToAxis_float3_float_float, 3}
      ,{"Enclose", AABB_Enclose_Selector, DUK_VARARGS}
      ,{"ToString", AABB_ToString, 0}
      ,{"SerializeToString", AABB_SerializeToString, 0}
      ,{"SerializeToCodeString", AABB_SerializeToCodeString, 0}
      ,{"Intersection", AABB_Intersection_AABB, 1}
      ,{"IntersectLineAABB", AABB_IntersectLineAABB_float3_float3_float_float, 4}
      ,{"IntersectLineAABB_CPP", AABB_IntersectLineAABB_CPP_float3_float3_float_float, 4}
      ,{"Equals", AABB_Equals_AABB_float, DUK_VARARGS}
      ,{"BitEquals", AABB_BitEquals_AABB, 1}
      ,{nullptr, nullptr, 0}
  };
  
  static const duk_function_list_entry AABB_StaticFunctions[] = {
      {"FromCenterAndSize", AABB_FromCenterAndSize_Static_float3_float3, 2}
      ,{"NumVerticesInTriangulation", AABB_NumVerticesInTriangulation_Static_int_int_int, 3}
      ,{"NumVerticesInEdgeList", AABB_NumVerticesInEdgeList_Static, 0}
      ,{"FromString", AABB_FromString_Static_string, 1}
      ,{nullptr, nullptr, 0}
  };
  
  void Expose_AABB(duk_context* ctx)
  {
      duk_push_c_function(ctx, AABB_Ctor_Selector, DUK_VARARGS);
      duk_put_function_list(ctx, -1, AABB_StaticFunctions);
      duk_push_object(ctx);
      duk_put_function_list(ctx, -1, AABB_Functions);
      DefineProperty(ctx, "minPoint", AABB_Get_minPoint, AABB_Set_minPoint);
      DefineProperty(ctx, "maxPoint", AABB_Get_maxPoint, AABB_Set_maxPoint);
      duk_put_prop_string(ctx, -2, "prototype");
      duk_put_global_string(ctx, AABB_ID);
  }
  
  }
  