• 大小: 241KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: 其他
  • 标签: 网格划分  LOD  

资源简介

给定任意边界的动态网格划分程序,实验室10年的,比较新。

资源截图

代码片段和文件信息

// ---------------------------------------------------------
//
//  accelerationgrid.cpp
//  
//  A grid-based collision test culling structure.
//
// ---------------------------------------------------------

// ---------------------------------------------------------
// Includes
// ---------------------------------------------------------

#include “accelerationgrid.h“

#include 

#include 
#include 
#include 
#include 
#include 

// ---------------------------------------------------------
// Global externs
// ---------------------------------------------------------

// ---------------------------------------------------------
// Local constants typedefs macros
// ---------------------------------------------------------

// ---------------------------------------------------------
// Static function definitions
// ---------------------------------------------------------

// ---------------------------------------------------------
// Member function definitions
// ---------------------------------------------------------

namespace eltopo2d
{

// --------------------------------------------------------
///
/// Default constructor
///
// --------------------------------------------------------

AccelerationGrid::AccelerationGrid() :
   cells(00)
   elementidxs(0)
   elementxmins(0)
   elementxmaxs(0)
   elementquery(0)
   lastquery(0)
   gridxmin(00)
   gridxmax(00)
   cellsize(00)
   invcellsize(00)
{
   Vec2ui dims(11);
   Vec2d xmin(00) xmax(11);
   set(dims xmin xmax);
}


// --------------------------------------------------------
///
/// Destructor: clear all grids
///
// --------------------------------------------------------

AccelerationGrid::~AccelerationGrid()
{
   clear();
}

// --------------------------------------------------------
///
/// Define the grid given the extents of the domain and the number of desired voxels along each dimension
///
// --------------------------------------------------------

void AccelerationGrid::set( const Vec2ui& dims const Vec2d& xmin const Vec2d& xmax )
{
   gridxmin = xmin;
   gridxmax = xmax;
   
   for(unsigned int i = 0; i < 2; i++)
   {
      cellsize[i] = (gridxmax[i]-gridxmin[i])/dims[i];
      invcellsize[i] = 1.0 / cellsize[i];
   }
   
   clear();
   
   cells.resize(dims[0] dims[1]);    
   for(unsigned int i = 0; i < cells.a.size(); i++)
   {
      cells.a[i] = 0;
   }   
}

// --------------------------------------------------------
///
/// Generate a set of voxel indices from a pair of AABB extents
///
// --------------------------------------------------------

void AccelerationGrid::boundstoindices(const Vec2d& xmin const Vec2d& xmax Vec2i& xmini Vec2i& xmaxi)
{
   
   xmini[0] = (int) floor((xmin[0] - gridxmin[0]) * invcellsize[0]);
   xmini[1] = (int) floor((xmin[1] - gridxmin[1]) * invcellsize[1]);
   
   xmaxi[0] = (int) floor((xmax[0] - gridxmin[0]) * invcellsize[0]);
   xmaxi[1] = (in

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       8937  2010-11-18 08:48  voronoi2d\accelerationgrid.cpp

     文件       3363  2010-11-18 08:48  voronoi2d\accelerationgrid.h

     文件       5052  2010-11-18 08:48  voronoi2d\broadphasegrid.cpp

     文件       5648  2010-11-18 08:48  voronoi2d\broadphasegrid.h

     文件      19674  2010-11-18 08:48  voronoi2d\common\array1.h

     文件       6945  2010-11-18 08:48  voronoi2d\common\array2.h

     文件      24227  2010-11-18 08:48  voronoi2d\common\blas_wrapper.h

     文件       9691  2010-11-18 08:48  voronoi2d\common\ccd_wrapper.h

     文件      35643  2010-11-18 08:48  voronoi2d\common\collisionqueries.cpp

     文件       4602  2010-11-18 08:48  voronoi2d\common\collisionqueries.h

     文件      13207  2010-11-18 08:48  voronoi2d\common\cubic_ccd_wrapper.cpp

     文件      34076  2010-11-18 08:48  voronoi2d\common\gluvi.cpp

     文件       6676  2010-11-18 08:48  voronoi2d\common\gluvi.h

     文件       7094  2010-11-18 08:48  voronoi2d\common\hashtable.h

     文件        362  2010-11-18 08:48  voronoi2d\common\makelevelset2.h

     文件       2429  2010-11-18 08:48  voronoi2d\common\marching_triangles.cpp

     文件        896  2010-11-18 08:48  voronoi2d\common\marching_triangles.h

     文件      13058  2010-11-18 08:48  voronoi2d\common\mat.h

     文件       7905  2010-11-18 08:48  voronoi2d\common\openglutils.cpp

     文件       1263  2010-11-18 08:48  voronoi2d\common\openglutils.h

     文件      46280  2010-11-18 08:48  voronoi2d\common\predicates.cpp

     文件       4213  2010-11-18 08:48  voronoi2d\common\predicates.h

     文件      11164  2010-11-18 08:48  voronoi2d\common\util.h

     文件      12490  2010-11-18 08:48  voronoi2d\common\vec.h

     文件        829  2010-11-18 08:48  voronoi2d\common\vector_math.h

     文件        814  2010-11-18 08:48  voronoi2d\common\wallclocktime.cpp

     文件        117  2010-11-18 08:48  voronoi2d\common\wallclocktime.h

     文件       2932  2010-11-18 08:48  voronoi2d\dist_funcs.cpp

     文件        724  2010-11-18 08:48  voronoi2d\dist_funcs.h

     文件      29013  2010-11-18 08:48  voronoi2d\dualfluidsim.cpp

............此处省略54个文件信息

评论

共有 条评论