//! Constructor.
IAtmosphereStarSceneNode::IAtmosphereStarSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
    video::ITexture* sun, video::ITexture* moon, const core::dimension2df& size)
	: scene::ISceneNode(parent, mgr, id)
{
    #ifdef _DEBUG
	setDebugName("IAtmospherStarSceneNode");
	#endif

    setSize(size);

	setAutomaticCulling(scene::EAC_OFF);

	BufferSun = new scene::SMeshBuffer();
	BufferSun->Material.Lighting = false;
	BufferSun->Material.ZBuffer = video::ECFN_NEVER;
	BufferSun->Material.ZWriteEnable = false;
	BufferSun->Material.AntiAliasing = video::EAAM_OFF;
	BufferSun->Material.setTexture(0, sun);
    BufferSun->Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;

    BufferMoon = new scene::SMeshBuffer();
    BufferMoon->Material.Lighting = false;
    BufferMoon->Material.ZBuffer = video::ECFN_NEVER;
	BufferMoon->Material.ZWriteEnable = false;
	BufferMoon->Material.AntiAliasing = video::EAAM_OFF;
    BufferMoon->Material.setTexture(0, moon);
    BufferMoon->Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;

    generateMesh();
}
CSkyDomeSceneNode::CSkyDomeSceneNode(video::ITexture* sky, u32 horiRes, u32 vertRes,
                                     f32 texturePercentage, f32 spherePercentage, f32 radius,
                                     ISceneNode* parent, ISceneManager* mgr, s32 id)
    : ISceneNode(parent, mgr, id), Buffer(0),
      HorizontalResolution(horiRes), VerticalResolution(vertRes),
      TexturePercentage(texturePercentage),
      SpherePercentage(spherePercentage), Radius(radius)
{
#ifdef _DEBUG
    setDebugName("CSkyDomeSceneNode");
#endif

    setAutomaticCulling(scene::EAC_OFF);

    Buffer = new CMeshBuffer<video::S3DVertex>(mgr->getVideoDriver()->getVertexDescriptor(0));
    Buffer->getMaterial().Lighting = false;
    Buffer->getMaterial().ZBuffer = video::ECFN_DISABLED;
    Buffer->getMaterial().ZWriteEnable = false;
    Buffer->getMaterial().AntiAliasing = video::EAAM_OFF;
    Buffer->getMaterial().setTexture(0, sky);
    Buffer->getBoundingBox().MaxEdge.set(0, 0, 0);
    Buffer->getBoundingBox().MinEdge.set(0,0,0);

    // regenerate the mesh
    generateMesh();
}
CSkyDomeSceneNode::CSkyDomeSceneNode(video::ITexture* sky, u32 horiRes, u32 vertRes,
		f32 texturePercentage, f32 spherePercentage, f32 radius,
		ISceneNode* parent, ISceneManager* mgr, s32 id)
	: ISceneNode(parent, mgr, id), Buffer(0),
	  HorizontalResolution(horiRes), VerticalResolution(vertRes),
	  TexturePercentage(texturePercentage),
	  SpherePercentage(spherePercentage), Radius(radius)
{
	#ifdef _DEBUG
	setDebugName("CSkyDomeSceneNode");
	#endif

	setAutomaticCulling(scene::EAC_OFF);

	Buffer = new SMeshBuffer();
	Buffer->Material.Lighting = false;
	Buffer->Material.ZBuffer = video::ECFN_NEVER;
	Buffer->Material.ZWriteEnable = false;
	Buffer->Material.AntiAliasing = video::EAAM_OFF;
	Buffer->Material.setTexture(0, sky);
	Buffer->BoundingBox.MaxEdge.set(0,0,0);
	Buffer->BoundingBox.MinEdge.set(0,0,0);

	Buffer->Vertices.clear();
	Buffer->Indices.clear();

	// regenerate the mesh
	generateMesh();
}
CSkyDomeSceneNode::CSkyDomeSceneNode(video::IVirtualTexture* sky, uint32_t horiRes, uint32_t vertRes,
		float texturePercentage, float spherePercentage, float radius,
		IDummyTransformationSceneNode* parent, ISceneManager* mgr, int32_t id)
	: ISceneNode(parent, mgr, id), Buffer(0),
	  HorizontalResolution(horiRes), VerticalResolution(vertRes),
	  TexturePercentage(texturePercentage),
	  SpherePercentage(spherePercentage), Radius(radius)
{
	#ifdef _DEBUG
	setDebugName("CSkyDomeSceneNode");
	#endif

	setAutomaticCulling(scene::EAC_OFF);

	Buffer = new video::IGPUMeshBuffer();
	Buffer->getMaterial().ZBuffer = video::ECFN_NEVER;
	Buffer->getMaterial().BackfaceCulling = false;
	Buffer->getMaterial().ZWriteEnable = false;
	Buffer->getMaterial().setTexture(0, sky);
	BoundingBox.MaxEdge.set(0,0,0);
	BoundingBox.MinEdge.set(0,0,0);

	// regenerate the mesh
	generateMesh();
}
Beispiel #5
0
void GameInterior::onAddToScene() {
	Parent::onAddToScene();

	// create the interior
	// TODO: create a resource cache for difs
	DIF::DIF dif;

	std::string path = mInteriorFile.c_str();
	std::string directory = IO::getPath(path);
	std::ifstream file(path, std::ios::binary);

	if (!dif.read(file)) {
		IO::printf("DIF file could not be read!\n");
		return;
	}
		
	// load interior
	mInterior = dif.interior[0];
	generateMaterials(directory);

	// make mesh
	generateMesh();

	// cleanup
	file.close();

	// init graphics
	gfxInit();
}
Beispiel #6
0
   bool NavMesh::buildProcess()
   {
      mBuilding = true;

      // Create mesh
      bool success = generateMesh();

      mNavMeshLock.lock();
      // Copy new navmesh into old.
      dtNavMesh *old = nm;
      nm = tnm; // I am trusting that this is atomic.
      dtFreeNavMesh(old);
      tnm = NULL;
      mNavMeshLock.unlock();

      // Free structs used during build
      freeIntermediates(false);

      // Alert event manager that we have been built.
      if(mEventManager)
         mEventManager->postEvent("NavMeshBuild", "");

      mBuilding = false;

      return success;
   }
Beispiel #7
0
Mesh::Mesh(string filename)
{
	checksum = false;
	status_msg = "";

	if (filename == "random" || filename == "random extrude" || filename == "random surfrev") {	
		checksum = true;
		status_msg = "Success!";
		randomMesh(filename);
		generateMesh();
	}
	else if (fileParser(filename)) {		
		checksum = true;
		status_msg = "Success!";
		generateMesh();
	}
}
Beispiel #8
0
void Surface3d::generate(int width, int depth, float amplitude, int frequency, unsigned int seed) 
{
	surface = Matrix(depth, vector<propierties> (width));
	
	Surface S(depth+1, width+1);
	S.perlinNoise(amplitude, frequency, seed);

	setGeometricPropierties(S);
	generateMesh(S);
}
void LayerRenderer::finish() {
    OpenGLRenderer::finish();

    generateMesh();

    LAYER_RENDERER_LOGD("Finished rendering into layer, fbo = %d", mLayer->getFbo());

    // No need to unbind our FBO, this will be taken care of by the caller
    // who will invoke OpenGLRenderer::resume()
}
//! Reads attributes of the scene node.
void CSkyDomeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
    HorizontalResolution = in->getAttributeAsInt  ("HorizontalResolution");
    VerticalResolution   = in->getAttributeAsInt  ("VerticalResolution");
    TexturePercentage    = in->getAttributeAsFloat("TexturePercentage");
    SpherePercentage     = in->getAttributeAsFloat("SpherePercentage");
    Radius               = in->getAttributeAsFloat("Radius");

    ISceneNode::deserializeAttributes(in, options);

    // regenerate the mesh
    generateMesh();
}
void OctreeSDF::generateTriangleCache()
{
	auto mesh = generateMesh();
	auto transformedMesh = std::make_shared<TransformedMesh>(mesh);
	std::cout << "Computing cache" << std::endl;
	mesh->computeTriangleNormals();
	transformedMesh->computeCache();
	m_TriangleCache.clearMeshes();
	m_TriangleCache.addMesh(transformedMesh);
	std::cout << "Generating BVH" << std::endl;
	m_TriangleCache.generateBVH<AABB>();
	std::cout << "Finished generating BVH" << std::endl;
}
GLBaseGridNode::GLBaseGridNode(glm::vec3 min, glm::vec3 max, std::vector<int>* indexes, GLMeshHandler* handler, EDLogger* logger)
{
	this->min = glm::vec3(min);
	this->max = glm::vec3(max);

	visible = INVISIBLE;

	int inside = 0;
	int totalV = 0;

	nodeColor = glm::vec3(rand() % 255 / 255.f, rand() % 255 / 255.f, rand() % 255 / 255.f);
	char logLine[128];
	sprintf(logLine, "Node color: %f %f %f", VEC3_PRINT(nodeColor));
	logger->logLineTimestamp(logLine);

	numMeshes = handler->numMeshes;

	//Verifica o que pertence e o que não
	localIndexes = new std::vector<int>[numMeshes];

	for (int i = 0; i < numMeshes; i++)
	{
		localIndexes[i].clear();
		GLMesh3D* mesh = &handler->meshes.at(i);

		for (int j = 0; j < indexes->size();)
		{
			glm::vec3* p1 = &mesh->vertexes[indexes->at(j)];
			glm::vec3* p2 = &mesh->vertexes[indexes->at(j + 1)];
			glm::vec3* p3 = &mesh->vertexes[indexes->at(j + 2)];

			if (TriangleCube::testIntersection(p1, p2, p3, &this->min, &this->max))
			{
				localIndexes[i].push_back(indexes->at(j));
				localIndexes[i].push_back(indexes->at(j + 1));
				localIndexes[i].push_back(indexes->at(j + 2));

				inside += 3;
			}
			j += 3;
		}
	}

	sprintf(logLine, "Inside: %d/%d", inside, totalV);

	numIndicesTotal = inside;
	logger->logLineTimestamp(logLine);

	generateMesh(handler, logger);
}
Beispiel #13
0
void testApp::setup() {
    ofSetFrameRate(60);
    ofSetVerticalSync(true);
    ofEnableNormalizedTexCoords(); ofDisableArbTex();
    graph.allocate(1200, 400, OF_IMAGE_COLOR);
    buffer.allocate(1200,400,GL_RGBA,1);
    testImg2.loadImage("graph.png");
    ofEnableSmoothing();
    center = ofVec3f();
    setupUI();
    setupVar();
    setupTCP();
    generateMesh(&points);
}
//-----------------------------------------------------------------------
void CEnvironmentMap::initMesh(LPD3DXPATCHMESH pMesh, FLOAT fTessLevel)
{
	f32 start = 8, span = 8;
	f32 x = -start, z = start;
	for (int i = 0; i < s_ObjCount; i++)
	{
		generateMesh(pMesh, &mEnvironmentObj[i].mesh, fTessLevel);

		OwnVector3 pos(x, 0, z);
		mEnvironmentObj[i].modelMtx.makeTrans(pos);

		x += span;
		if (x > start)
		{
			x = -start;
			z -= span;
		}

	}
}
QString
MeshGenerator::start(VolumeFileManager *vfm,
		     int nX, int nY, int nZ,
		     Vec dataMin, Vec dataMax,
		     QString prevDir,
		     Vec voxelScaling, int samplingLevel,
		     QList<Vec> clipPos,
		     QList<Vec> clipNormal,
		     QList<CropObject> crops,
		     QList<PathObject> paths,
		     uchar *lut,
		     int pruneLod, int pruneX, int pruneY, int pruneZ,
		     QVector<uchar> pruneData,
		     QVector<uchar> tagColors)
{
  m_vfm = vfm;
  m_voxelType = m_vfm->voxelType();
  m_depth = nX;
  m_width = nY;
  m_height = nZ;
  m_dataMin = dataMin;
  m_dataMax = dataMax;
  m_dataSize = m_dataMax - m_dataMin + Vec(1,1,1);
  m_nX = qMin(int(m_dataSize.z), m_depth);
  m_nY = qMin(int(m_dataSize.y), m_width);
  m_nZ = qMin(int(m_dataSize.x), m_height);
  m_crops = crops;
  m_paths = paths;
  m_pruneLod = pruneLod;
  m_pruneX = pruneX;
  m_pruneY = pruneY;
  m_pruneZ = pruneZ;
  m_pruneData = pruneData;
  m_tagColors = tagColors;
  m_samplingLevel = samplingLevel;

  // pruneLod that we get is wrt the original sized volume.
  // set pruneLod to reflect the selected sampling level.
  m_pruneLod = qMax((float)m_nX/(float)m_pruneZ,
		    qMax((float)m_nY/(float)m_pruneY,
			 (float)m_nZ/(float)m_pruneX));

//  QMessageBox::information(0, "", QString("%1 %2 %3\n%4 %5 %6\n%7").\
//			   arg(m_nX).arg(m_nY).arg(m_nZ).\
//			   arg(m_pruneZ).arg(m_pruneY).arg(m_pruneX).\
//			   arg(m_pruneLod));

  bool doBorder = false;
  if (qRound(m_dataSize.x) < m_height ||
      qRound(m_dataSize.y) < m_width ||
      qRound(m_dataSize.z) < m_depth)
    doBorder = true;
  if (clipPos.count() > 0 || m_crops.count() > 0 || m_paths.count() > 0)
    doBorder = true;

  int depth, fillValue;
  bool checkForMore;
  bool lookInside;
  QGradientStops stops;
  int chan;
  bool avgColor;
  if (! getValues(depth, fillValue,
		  checkForMore,
		  lookInside,
		  stops,
		  doBorder,
		  chan,
		  avgColor))
    return "";


  m_meshLog = new QTextEdit;
  m_meshProgress = new QProgressBar;

  QVBoxLayout *meshLayout = new QVBoxLayout;
  meshLayout->addWidget(m_meshLog);
  meshLayout->addWidget(m_meshProgress);

  QWidget *meshWindow = new QWidget;
  meshWindow->setWindowTitle("Drishti - Mesh Repainting Using Voxel Values");
  meshWindow->setLayout(meshLayout);
  meshWindow->show();
  meshWindow->resize(700, 300);


  float memGb = 0.5;
  memGb = QInputDialog::getDouble(0,
				  "Use memory",
				  "Max memory we can use (GB)", memGb, 0.1, 1000, 2);

  qint64 gb = 1024*1024*1024;
  qint64 memsize = memGb*gb; // max memory we can use (in GB)

  qint64 canhandle = memsize/15;
  qint64 gsize = qPow((double)canhandle, 0.333);

  m_meshLog->insertPlainText(QString("Can handle data with total grid size of %1 : typically %2^3\nOtherwise slabs method will be used.  Mesh is generated for each slab and then joined together.\n\n"). \
			   arg(canhandle).arg(gsize));


  m_meshLog->insertPlainText("\n\n");
  m_meshLog->insertPlainText(QString("Volume Size : %1 %2 %3\n").\
			   arg(m_depth).
			   arg(m_width).
			   arg(m_height));
  m_meshLog->insertPlainText(QString("DataMin : %1 %2 %3\n").\
			   arg(m_dataMin.z).
			   arg(m_dataMin.y).
			   arg(m_dataMin.x));
  m_meshLog->insertPlainText(QString("DataMax : %1 %2 %3\n").\
			   arg(m_dataMax.z).
			   arg(m_dataMax.y).
			   arg(m_dataMax.x));
  m_meshLog->insertPlainText(QString("DataSize : %1 %2 %3\n").\
			   arg(m_dataSize.z).
			   arg(m_dataSize.y).
			   arg(m_dataSize.x));
  m_meshLog->insertPlainText("\n\n");


  m_meshLog->insertPlainText(QString("Grid size : %1 %2 %3\n").\
			   arg(m_nX).arg(m_nY).arg(m_nZ));
  

  //---- import the mesh ---
  QString inflnm = QFileDialog::getOpenFileName(0,
						"Load mesh to repaint",
						prevDir,
						"*.ply");
  if (inflnm.size() == 0)
    {
      meshWindow->close();
      return "";
    }

  if (!loadPLY(inflnm))
    {
      meshWindow->close();
      return "";
    }
  //----------------------------

  //---- export the mesh ---
  QString outflnm = QFileDialog::getSaveFileName(0,
						 "Export mesh",
						 prevDir,
						 "*.ply");
  if (outflnm.size() == 0)
    {
      meshWindow->close();
      return "";
    }
  //----------------------------

  int nSlabs = 1;
  qint64 reqmem = m_nX;
  reqmem *= m_nY*m_nZ*20;
  nSlabs = qMax(qint64(1), reqmem/memsize + 1);
//  QMessageBox::information(0, "", QString("Number of Slabs : %1 : %2 %3").\
//			   arg(nSlabs).arg(reqmem).arg(memsize));

  QStringList volumeFiles;
#ifndef Q_OS_MACX
  volumeFiles = QFileDialog::getOpenFileNames(0,
					      "Load volume files for timeseries data, otherwise give CANCEL",
					      prevDir,
					      "NetCDF Files (*.pvl.nc)",
					      0,
					      QFileDialog::DontUseNativeDialog);
#else
  volumeFiles = QFileDialog::getOpenFileNames(0,
					      "Load volume files for timeseries data, otherwise give CANCEL",
					      prevDir,
					      "NetCDF Files (*.pvl.nc)",
					      0);
#endif

  int nvols = volumeFiles.count();      

  if (nvols == 0)
    volumeFiles << m_vfm->fileName();
  

  generateMesh(nSlabs,
	       volumeFiles,
	       outflnm,
	       depth,
	       stops,
	       fillValue,
	       checkForMore,
	       lookInside,
	       voxelScaling,
	       clipPos, clipNormal,
	       crops, paths,
	       lut,
	       chan,
	       avgColor);


  meshWindow->close();

  return outflnm;
}
ccRasterizeTool::ccRasterizeTool(ccGenericPointCloud* cloud, QWidget* parent/*=0*/)
	: QDialog(parent, Qt::WindowMaximizeButtonHint)
	, cc2Point5DimEditor()
	, Ui::RasterizeToolDialog()
	, m_cloud(cloud)
{
	setupUi(this);

#ifndef CC_GDAL_SUPPORT
	generateRasterPushButton->setDisabled(true);
	generateRasterPushButton->setChecked(false);
#endif

	connect(buttonBox,					SIGNAL(accepted()),					this,	SLOT(testAndAccept()));
	connect(buttonBox,					SIGNAL(rejected()),					this,	SLOT(testAndReject()));
	connect(gridStepDoubleSpinBox,		SIGNAL(valueChanged(double)),		this,	SLOT(updateGridInfo()));
	connect(gridStepDoubleSpinBox,		SIGNAL(valueChanged(double)),		this,	SLOT(gridOptionChanged()));
	connect(emptyValueDoubleSpinBox,	SIGNAL(valueChanged(double)),		this,	SLOT(gridOptionChanged()));
	connect(resampleCloudCheckBox,		SIGNAL(toggled(bool)),				this,	SLOT(gridOptionChanged()));
	connect(dimensionComboBox,			SIGNAL(currentIndexChanged(int)),	this,	SLOT(projectionDirChanged(int)));
	connect(heightProjectionComboBox,	SIGNAL(currentIndexChanged(int)),	this,	SLOT(projectionTypeChanged(int)));
	connect(scalarFieldProjection,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(sfProjectionTypeChanged(int)));
	connect(fillEmptyCellsComboBox,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(fillEmptyCellStrategyChanged(int)));
	connect(updateGridPushButton,		SIGNAL(clicked()),					this,	SLOT(updateGridAndDisplay()));
	connect(generateCloudPushButton,	SIGNAL(clicked()),					this,	SLOT(generateCloud()));
	connect(generateImagePushButton,	SIGNAL(clicked()),					this,	SLOT(generateImage()));
	connect(generateRasterPushButton,	SIGNAL(clicked()),					this,	SLOT(generateRaster()));
	connect(generateASCIIPushButton,	SIGNAL(clicked()),					this,	SLOT(generateASCIIMatrix()));
	connect(generateMeshPushButton,		SIGNAL(clicked()),					this,	SLOT(generateMesh()));
	connect(generateContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(generateContours()));
	connect(exportContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(exportContourLines()));
	connect(clearContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(removeContourLines()));
	connect(activeLayerComboBox,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(activeLayerChanged(int)));

	//custom bbox editor
	ccBBox gridBBox = m_cloud ? m_cloud->getOwnBB() : ccBBox(); 
	if (gridBBox.isValid())
	{
		createBoundingBoxEditor(gridBBox, this);
		connect(editGridToolButton, SIGNAL(clicked()), this, SLOT(showGridBoxEditor()));
	}
	else
	{
		editGridToolButton->setEnabled(false);
	}

	if (m_cloud)
	{
		cloudNameLabel->setText(m_cloud->getName());
		pointCountLabel->setText(QString::number(m_cloud->size()));
		interpolateSFFrame->setEnabled(cloud->hasScalarFields());

		//populate layer box
		activeLayerComboBox->addItem(GetDefaultFieldName(PER_CELL_HEIGHT));
		if (cloud->isA(CC_TYPES::POINT_CLOUD) && cloud->hasScalarFields())
		{
			ccPointCloud* pc = static_cast<ccPointCloud*>(cloud);
			for (unsigned i=0; i<pc->getNumberOfScalarFields(); ++i)
				activeLayerComboBox->addItem(pc->getScalarField(i)->getName());
		}
		else
		{
			activeLayerComboBox->setEnabled(false);
		}

		//add window
		create2DView(mapFrame);
	}

	loadSettings();

	updateGridInfo();

	gridIsUpToDate(false);
}
Beispiel #17
0
void ChunkBase::generateEntityMesh()
{
	generateMesh();

	mMeshGenerated = true;
}
}



LVRReconstructViaMarchingCubesDialog::~LVRReconstructViaMarchingCubesDialog()
{
    m_master = 0;
    lvr::ProgressBar::setProgressCallback(0);
    lvr::ProgressBar::setProgressTitleCallback(0);
}

void LVRReconstructViaMarchingCubesDialog::connectSignalsAndSlots()
{
    QObject::connect(m_dialog->comboBox_pcm, SIGNAL(currentIndexChanged(const QString)), this, SLOT(toggleRANSACcheckBox(const QString)));
    QObject::connect(m_dialog->comboBox_gs, SIGNAL(currentIndexChanged(int)), this, SLOT(switchGridSizeDetermination(int)));
    QObject::connect(m_dialog->buttonBox, SIGNAL(accepted()), this, SLOT(generateMesh()));
}

void LVRReconstructViaMarchingCubesDialog::toggleRANSACcheckBox(const QString &text)
{
    QCheckBox* ransac_box = m_dialog->checkBox_RANSAC;
    if(text == "PCL")
    {
        ransac_box->setChecked(false);
        ransac_box->setCheckable(false);
    }
    else
    {
        ransac_box->setCheckable(true);
    }
}
Beispiel #19
0
//==============================================================================
// MAIN
int main( int argc, char* argv[] )
{
    // spatial dimension
    const unsigned    dim = SPACEDIM; 

    typedef base::solver::Eigen3           Solver;
    
    // Check input arguments
    if ( argc != 2 ) {
        std::cerr << "Usage: " << argv[0] << " input.dat\n"
                  << "(Compiled for dim=" << dim << ")\n\n";
        return -1;
    }
    
    // read name of input file
    const std::string   inputFile = boost::lexical_cast<std::string>( argv[1] );
    const InputNucleus<dim> ui( inputFile );

    // Simulation attributes
    const bool simplex = false;
    const bool stokesStabil = false;
    typedef mat::hypel::NeoHookeanCompressible Material;
    typedef TypesAndAttributes<dim,simplex>    TA;

    // basic attributes of the computation
    base::auxi::BoundingBox<dim> bbox( ui.bbmin, ui.bbmax );
    
    TA::Mesh mesh;
    generateMesh( mesh, ui );

    // Creates a list of <Element,faceNo> pairs
    base::mesh::MeshBoundary meshBoundary;
    meshBoundary.create( mesh.elementsBegin(), mesh.elementsEnd() );

    TA::BoundaryMesh boundaryMesh;
    base::mesh::generateBoundaryMesh( meshBoundary.begin(),
                                      meshBoundary.end(),
                                      mesh, boundaryMesh );


    // mesh size (all equal, more or less)
    const double h = base::mesh::Size<TA::Mesh::Element>::apply( mesh.elementPtr(0) );

    //--------------------------------------------------------------------------
    typedef base::cut::LevelSet<dim> LevelSet;
    std::vector<LevelSet> levelSetNucleus, levelSetMembrane;
    base::cut::analyticLevelSet( mesh,
                                 base::cut::Sphere<dim>( ui.RN, ui.centerN ),
                                 true, levelSetNucleus );
    base::cut::analyticLevelSet( mesh,
                                 base::cut::Sphere<dim>( ui.RM, ui.centerM ),
                                 true, levelSetMembrane );

    //--------------------------------------------------------------------------
    // make cut cell structures
    std::vector<TA::Cell> cellsNucleus, cellsMembrane, cellsCS;
    base::cut::generateCutCells( mesh, levelSetNucleus,  cellsNucleus );
    base::cut::generateCutCells( mesh, levelSetMembrane, cellsMembrane );
    
    {
        cellsCS = cellsNucleus;
        std::for_each( cellsCS.begin(), cellsCS.end(),
                       boost::bind( &TA::Cell::reverse, _1 ) );

        base::cut::generateCutCells( mesh, levelSetMembrane, cellsCS,
                                     base::cut::INTERSECT );
    }

    // intersection with the box boundary
    std::vector<TA::SurfCell> surfaceCells;
    base::cut::generateCutCells( boundaryMesh, levelSetMembrane, surfaceCells );

    // Elastic material
    Material material( mat::Lame::lambda( ui.E, ui.nu),
                       mat::Lame::mu(     ui.E, ui.nu ) );

    // Solid and fluid handlers
    typedef Solid<TA::Mesh, Material>                        Solid;
    typedef Fluid<TA::Mesh, stokesStabil>                    Fluid;
    typedef SolidFluidInterface<TA::SurfaceMesh,Solid,Fluid> SFI;
    typedef FluidFluidInterface<TA::SurfaceMesh,Fluid>       FFI;
    
    Solid nucleus(      mesh, material );
    Fluid gel(          mesh, ui.viscosityGel, ui.alpha );
    Fluid cytoSkeleton( mesh, ui.viscosityCS,  ui.alpha );

    // find geometry association for the dofs
    std::vector<std::pair<std::size_t,TA::VecDim> > doFLocationD, doFLocationU;
    base::dof::associateLocation( nucleus.getDisplacement(), doFLocationD );
    base::dof::associateLocation( gel.getVelocity(),       doFLocationU );

    // Quadrature along a surface
    TA::CutQuadrature     cutQuadratureNucleus( cellsNucleus,  true  ); 
    TA::CutQuadrature     cutQuadratureGel(     cellsMembrane, false );
    TA::CutQuadrature     cutQuadratureCS(      cellsCS,       true  );
    TA::SurfaceQuadrature surfaceQuadrature;
    TA::SurfCutQuadrature surfaceCutQuadrature( surfaceCells, true );

    //--------------------------------------------------------------------------
    // Run a zero-th step in order to write the data before computation
    // (store the previously enclosed volume)
    double prevVolumeN, initialVolumeCS;
    {
        std::cout << 0 << "  " << 0. << "  0  " << std::flush;

        writeVTKFile( "nucleus", 0, mesh,
                      nucleus.getDisplacement(),
                      cytoSkeleton.getVelocity(), cytoSkeleton.getPressure(),
                      gel.getVelocity(),          gel.getPressure(),
                      levelSetNucleus, levelSetMembrane,  ui.dt );

        // for surface field
        TA::SurfaceMesh membrane, envelope;
        base::cut::generateSurfaceMesh<TA::Mesh,TA::Cell>( mesh, cellsMembrane, membrane );
        base::cut::generateSurfaceMesh<TA::Mesh,TA::Cell>( mesh, cellsNucleus,  envelope );

        writeSurfaceVTKFile( "membrane", 0, membrane );
        writeSurfaceVTKFile( "envelope", 0, envelope );
            
        surfaceFeatures( boundaryMesh, membrane, envelope,
                         surfaceQuadrature, surfaceCutQuadrature, std::cout );
        std::cout << std::endl;

        // store the contained volume
        prevVolumeN     = surf::enclosedVolume( envelope, surfaceQuadrature );
        initialVolumeCS =
            surf::enclosedVolume( membrane, surfaceQuadrature ) +
            surf::enclosedVolume( boundaryMesh, surfaceCutQuadrature );
    }

    //--------------------------------------------------------------------------
    // * Loop over time steps *
    //--------------------------------------------------------------------------
    const double supportThreshold = std::numeric_limits<double>::min();
    for ( unsigned step = 0; step < ui.numLoadSteps; step++ ) {
        
        // for surface field
        TA::SurfaceMesh membrane, envelope;
        base::cut::generateSurfaceMesh<TA::Mesh,TA::Cell>( mesh, cellsMembrane, membrane );
        base::cut::generateSurfaceMesh<TA::Mesh,TA::Cell>( mesh, cellsNucleus,  envelope );

        // Interface handler
        SFI envelopeHandler( envelope,
                             nucleus.getDisplacement(),
                             cytoSkeleton.getVelocity(), cytoSkeleton.getPressure(),
                             ui.viscosityCS );
        
        FFI membraneHandler( membrane,
                             cytoSkeleton.getVelocity(), cytoSkeleton.getPressure(),
                             gel.getVelocity(), gel.getPressure(),
                             cellsMembrane, 
                             ui.viscosityCS, ui.viscosityGel, ui.sigma );

        std::cout << step+1 << "  " << (step+1) * ui.dt << "  " << std::flush;

        //----------------------------------------------------------------------
        // 0) Solve Lagrangian problem
        
        // compute supports
        std::vector<double> supportsD, supportsUCS, supportsPCS, supportsUGel, supportsPGel;
        base::cut::supportComputation( mesh, nucleus.getDisplacement(),
                                       cutQuadratureNucleus, supportsD );
        base::cut::supportComputation( mesh, cytoSkeleton.getVelocity(),
                                       cutQuadratureCS, supportsUCS );
        base::cut::supportComputation( mesh, cytoSkeleton.getPressure(),
                                       cutQuadratureCS, supportsPCS );
        base::cut::supportComputation( mesh, gel.getVelocity(),
                                       cutQuadratureGel, supportsUGel );
        base::cut::supportComputation( mesh, gel.getPressure(),
                                       cutQuadratureGel, supportsPGel );

        // Hard-wired Dirichlet constraints (fluid BC)
        {
            // apply to outer material = gel
            base::dof::constrainBoundary<Fluid::FEBasisU>(
                meshBoundary.begin(),
                meshBoundary.end(),
                mesh, gel.getVelocity(),
                boost::bind( &dirichletBC<dim,Fluid::DoFU>,
                             _1, _2, ui.ubar, bbox, ui.bc ) );

            // in case of boundary intersections, apply to cytoskeleton
            base::dof::constrainBoundary<Fluid::FEBasisU>(
                meshBoundary.begin(),
                meshBoundary.end(),
                mesh, cytoSkeleton.getVelocity(),
                boost::bind( &dirichletBC<dim,Fluid::DoFU>,
                             _1, _2, ui.ubar, bbox, ui.bc ) );

            // Fix first pressure dof in case of closed cavity flow
            if ( ui.bc == CAVITY ) {
                Fluid::Pressure::DoFPtrIter pIter = gel.getPressure().doFsBegin();
                (*pIter) -> constrainValue( 0, 0.0 );
            }
        }
    
        // Basis stabilisation
        base::cut::stabiliseBasis( mesh, nucleus.getDisplacement(),  supportsD,    doFLocationD );
        base::cut::stabiliseBasis( mesh, cytoSkeleton.getVelocity(), supportsUCS,  doFLocationU );
        base::cut::stabiliseBasis( mesh, cytoSkeleton.getPressure(), supportsPCS,  doFLocationD );
        base::cut::stabiliseBasis( mesh, gel.getVelocity(),          supportsUGel, doFLocationU );
        base::cut::stabiliseBasis( mesh, gel.getPressure(),          supportsPGel, doFLocationD );
        
        // number DoFs 
        const std::size_t activeDoFsD = 
            base::dof::numberDoFsConsecutively( nucleus.getDisplacement().doFsBegin(),
                                                nucleus.getDisplacement().doFsEnd() );
        const std::size_t activeDoFsUCS = 
            base::dof::numberDoFsConsecutively( cytoSkeleton.getVelocity().doFsBegin(),
                                                cytoSkeleton.getVelocity().doFsEnd(),
                                                activeDoFsD );
        const std::size_t activeDoFsPCS = 
            base::dof::numberDoFsConsecutively( cytoSkeleton.getPressure().doFsBegin(),
                                                cytoSkeleton.getPressure().doFsEnd(),
                                                activeDoFsD + activeDoFsUCS );
        const std::size_t activeDoFsUGel = 
            base::dof::numberDoFsConsecutively( gel.getVelocity().doFsBegin(),
                                                gel.getVelocity().doFsEnd(),
                                                activeDoFsD + activeDoFsUCS + activeDoFsPCS );
        const std::size_t activeDoFsPGel = 
            base::dof::numberDoFsConsecutively( gel.getPressure().doFsBegin(),
                                                gel.getPressure().doFsEnd(),
                                                activeDoFsD + activeDoFsUCS + activeDoFsPCS +
                                                activeDoFsUGel );


        // start from 0 for the increments, set rest to zero too
        base::dof::clearDoFs( nucleus.getDisplacement() );
        base::dof::clearDoFs( cytoSkeleton.getPressure() );
        base::dof::clearDoFs( cytoSkeleton.getVelocity() );
        base::dof::clearDoFs( gel.getPressure() );
        base::dof::clearDoFs( gel.getVelocity() );

        //----------------------------------------------------------------------
        // Nonlinear iterations
        unsigned iter = 0;
        for ( ; iter < ui.maxIter; iter++ ) {

            // Create a solver object
            Solver solver( activeDoFsD + activeDoFsUCS + activeDoFsPCS +
                           activeDoFsUGel + activeDoFsPGel );

            // register to solver
            nucleus.registerInSolver(      solver );
            cytoSkeleton.registerInSolver( solver );
            gel.registerInSolver(          solver );
            membraneHandler.registerInSolver(     solver );
            envelopeHandler.registerInSolver(     solver );

            // Compute as(d,dd) and Da(d,dd)[Delta d]
            nucleus.assembleBulk( cutQuadratureNucleus, solver, iter );

            // Body force
            nucleus.bodyForce( cutQuadratureNucleus, solver,
                               boost::bind( unitForce<0,dim>, _1, ui.forceValue ) );

            // Computate af(u,p; du,dp)
            cytoSkeleton.assembleBulk( cutQuadratureCS,  solver );
            gel.assembleBulk(          cutQuadratureGel, solver );

            // Penalty terms for int_Gamma (dot(d) - u) (E delta d - mu delta u) ds
            envelopeHandler.assemblePenaltyTerms( surfaceQuadrature, solver, ui.penaltyFac, ui.dt );
            membraneHandler.assemblePenaltyTerms( surfaceQuadrature, solver, ui.penaltyFac );

            // Boundary energy terms (beta = 0)  [ -int_Gamma (...) ds ]
            envelopeHandler.assembleEnergyTerms( surfaceQuadrature, solver, ui.dt );
            membraneHandler.assembleEnergyTerms( surfaceQuadrature, solver );

            // surface tension
            membraneHandler.surfaceTension( surfaceQuadrature, solver );
            

            // Finalise assembly
            solver.finishAssembly();

            // norm of residual
            const double conv1 = solver.norm(0, activeDoFsD) / ui.E;

            if ( isnan( conv1 ) ) return 1;
            
            if ( ( iter > 0 )  and ( conv1 < ui.tolerance ) ) {
                std::cout << "schon" << std::endl;
                break;
            }

            // Solve
#ifdef LOAD_PARDISO
            solver.pardisoLUSolve();
#else

#ifdef LOAD_UMFPACK
            solver.umfPackLUSolve();
#else
            solver.superLUSolve();
            //solver.biCGStabSolve();
#endif
            
#endif
            // distribute results back to dofs
            base::dof::addToDoFsFromSolver( solver, nucleus.getDisplacement() ); //<>
            base::dof::setDoFsFromSolver(   solver, cytoSkeleton.getVelocity() );
            base::dof::setDoFsFromSolver(   solver, cytoSkeleton.getPressure() );
            base::dof::setDoFsFromSolver(   solver, gel.getVelocity() );
            base::dof::setDoFsFromSolver(   solver, gel.getPressure() );

            const double conv2 = solver.norm(0, activeDoFsD);

            if ( conv2 < ui.tolerance ) break;
            
        } // finish non-linear iteration
        std::cout << iter << "  " << std::flush;

        // write a vtk file
        writeVTKFile( "nucleus", step+1, mesh,
                      nucleus.getDisplacement(),
                      cytoSkeleton.getVelocity(), cytoSkeleton.getPressure(),
                      gel.getVelocity(),          gel.getPressure(),
                      levelSetNucleus, levelSetMembrane, ui.dt );
        writeSurfaceVTKFile( "membrane", step+1, membrane );
        writeSurfaceVTKFile( "envelope", step+1, envelope );

        //----------------------------------------------------------------------
        // 1) Pass Data to complementary domain of solid
        {
            const double extL = h; // extrapolation length

            // pass extrapolated solution to inactive DoFs
            extrapolateToFictitious( mesh, nucleus.getDisplacement(),
                                     extL, doFLocationD, levelSetNucleus, bbox );
        }

        //----------------------------------------------------------------------
        // 2) Geometry update
        // a) Nucleus
        {
            // get shape features
            const double volumeN = surf::enclosedVolume( envelope, surfaceQuadrature );
            const TA::VecDim momentN =
                surf::enclosedVolumeMoment( envelope, surfaceQuadrature );
            const TA::VecDim centroidN = momentN / volumeN;

            const double factorN = std::pow( prevVolumeN / volumeN,
                                            1./static_cast<double>( dim ) );
     
            // Move with velocity solution
            moveSurface( mesh, cytoSkeleton.getVelocity(),
                         envelope, ui.dt, factorN, centroidN );

            // compute new level set for envelope of nucleus
            base::cut::bruteForce( mesh, envelope, true, levelSetNucleus );

            // update the cut cell structure
            base::cut::generateCutCells( mesh, levelSetNucleus, cellsNucleus );


            // store the contained volume
            prevVolumeN = surf::enclosedVolume( envelope, surfaceQuadrature );
        }

        // b) CS
        {
            // get shape features
            const double volumeCS =
                surf::enclosedVolume( membrane,  surfaceQuadrature ) +
                surf::enclosedVolume( boundaryMesh, surfaceCutQuadrature );
            const TA::VecDim momentCS =
                surf::enclosedVolumeMoment( membrane, surfaceQuadrature ) +
                surf::enclosedVolumeMoment( boundaryMesh, surfaceCutQuadrature );
            const TA::VecDim centroidCS = momentCS / volumeCS;

            // Move with velocity solution
            moveSurface( mesh, gel.getVelocity(), membrane, ui.dt, 1.0, centroidCS );
            // rescale in order to preserve initial volume
            rescaleSurface( membrane, initialVolumeCS, volumeCS, centroidCS );

            // compute new level set for membrane
            base::cut::bruteForce( mesh, membrane, true, levelSetMembrane );

            // update the cut cell structure
            base::cut::generateCutCells( mesh, levelSetMembrane, cellsMembrane );
            base::cut::generateCutCells( boundaryMesh, levelSetMembrane, surfaceCells );
        }

        // new structure for cytoskeleton
        {
            cellsCS = cellsNucleus;
            std::for_each( cellsCS.begin(), cellsCS.end(),
                           boost::bind( &TA::Cell::reverse, _1 ) );
            
            base::cut::generateCutCells( mesh, levelSetMembrane, cellsCS,
                                         base::cut::INTERSECT );
        }


        //----------------------------------------------------------------------
        // 3) advect data
        {
            base::cut::supportComputation( mesh, nucleus.getDisplacement(),
                                           cutQuadratureNucleus, supportsD ); 
        
            // Find the location of the DoFs in the previous configuration
            std::vector<std::pair<std::size_t,TA::VecDim> > previousDoFLocation;
            findPreviousDoFLocations( mesh, nucleus.getDisplacement(), supportsD, 
                                      doFLocationD, previousDoFLocation, bbox, 
                                      supportThreshold, ui.findTolerance, 10 );
            
            // add previous solution to current solution: u_{n+1} = \Delta u + u_n
            {
                Solid::Displacement::DoFPtrIter dIter = nucleus.getDisplacement().doFsBegin();
                Solid::Displacement::DoFPtrIter dEnd  = nucleus.getDisplacement().doFsEnd();
                for ( ; dIter != dEnd; ++dIter ) {
                    for ( unsigned d = 0; d < dim; d++ ) {
                        const double prevU  = (*dIter) -> getHistoryValue<1>( d );
                        const double deltaU = (*dIter) -> getHistoryValue<0>( d );
                        const double currU = prevU + deltaU;
                        (*dIter) -> setValue( d, currU );
                    }
                }
            }
        
            // advect displacement field from previous to new location
            advectField( mesh, nucleus.getDisplacement(), previousDoFLocation, supportsD, 
                         supportThreshold );
        }

        //----------------------------------------------------------------------
        // push history
        base::dof::pushHistory( nucleus.getDisplacement() );

        // remove the linear constraints used in the stabilisation process
        base::dof::clearConstraints( nucleus.getDisplacement() );
        base::dof::clearConstraints( cytoSkeleton.getVelocity()     );
        base::dof::clearConstraints( cytoSkeleton.getPressure()     );
        base::dof::clearConstraints( gel.getVelocity()     );
        base::dof::clearConstraints( gel.getPressure()     );

        surfaceFeatures( boundaryMesh, membrane, envelope,
                         surfaceQuadrature, surfaceCutQuadrature, std::cout );
        std::cout << std::endl;

    } // end load-steps

    return 0;
}
Beispiel #20
0
std::vector<Point3f> skelpath::reconstruct() {
	// return point cloud
	std::vector<Point3f> points ;


	if( solvers.size() == 0 ){
		if( tempalteIdss.size() == 0)
			return points ;
		solvers = generateJointSetting() ;
	}

	jointSettingNum = solvers.size() ;
	cutplanes_bp.clear() ;
	cutplanes_bp.resize( solvers.size() ) ;
	branches_bp.clear() ;
	branches_bp.resize( solvers.size() ) ;
	subpoints.clear() ;
	resultProf3d.clear() ;
	resultProf2d.clear() ;
	for( int iter =0; iter<solvers.size(); ++iter ){
		std::cout<<"iter="<<iter<<std::endl;

		completionSolver &comSolver = solvers[iter];

		char tmp[10] ;
		std::string xfilename = std::string("x") + std::string( itoa(iter, tmp,10) )+".txt" ;

		std::ifstream xifs(xfilename) ;
		std::vector<double> inx,outx ;
		//double tt ;
		//while( xifs >> tt )
		//	inx.push_back(tt);

		outx = comSolver.solve( inx ) ;

		std::ofstream xofs(xfilename) ;
		for( int i=0;i<outx.size(); ++i )
			xofs << outx[i] << std::endl;
		xofs.close() ;
		xifs.close() ;


		std::cout<<"mark--------1" <<std::endl;
		std::vector<cutPlane> cutpls = comSolver.cutplanes ;
		std::vector<Point3f> brch = comSolver.centers ;



		std::vector<std::vector<Point3f>> profiles3d ;
		std::vector<std::vector<Point2f>> profiles2d ;
		for( int i=0; i<comSolver.finalProfiles.size(); ++i ){

			Profile3D p3d =  ReconstructorUtility::convert2dProfileTo3d( comSolver.finalProfiles[i], cutpls[i], brch[i] ) ;
			profiles3d.push_back( p3d ) ;
			profiles2d.push_back( comSolver.finalProfiles[i] ) ;

			// store cutplane and plnormal of branch pairs for debuging
			cutplanes_bp[iter].push_back(cutpls[i] );
			branches_bp[iter].push_back(brch[i] );

		}

		resultProf3d.push_back( profiles3d ) ;
		resultProf2d.push_back( profiles2d ) ;


		std::cout<<"mark--------2" <<std::endl;

		std::vector<Point3f> subpoint = ReconstructorUtility::upsampleResult( profiles3d, int2(0, brch.size()-1 ), comSolver.firstIsTip, comSolver.lastIsTip ) ;
		points.insert(points.begin(), subpoint.begin(), subpoint.end() ) ;

		subpoints.push_back( subpoint ) ; 	// for blend

		std::cout<<"mark--------3" <<std::endl;

		// store control points
		extern std::vector<Point3f > globalPointsToDraw1  ; 
		for( int i=0; i<comSolver.finalCtrPoints.size(); ++i )
			for( int j=0; j<comSolver.finalCtrPoints[i].size(); ++j )
				globalPointsToDraw1.push_back( comSolver.finalCtrPoints[i][j] ) ;


		// store sharp features
		extern std::vector<Point3f > globalPointsToDraw2  ;

		for( int i=0; i<comSolver.finalCtrPoints.size(); ++i )
			for( int k=0; k<comSolver.sharpIds[0].size(); ++k)
				globalPointsToDraw2.push_back( comSolver.finalCtrPoints[i][comSolver.sharpIds[0][k]] ) ;

	}


	generateMesh() ;

	return points ;
}
    void generate()
    {
        // create 12 vertices of a icosahedron
        double t = (1 + std::sqrt(5)) / 2;

        vertexList_.push_back(utymap::meshing::Vector3(-1, t, 0).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(1, t, 0).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(-1, -t, 0).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(1, -t, 0).normalized());

        vertexList_.push_back(utymap::meshing::Vector3(0, -1, t).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(0, 1, t).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(0., -1, -t).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(0, 1, -t).normalized());

        vertexList_.push_back(utymap::meshing::Vector3(t, 0, -1).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(t, 0, 1).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(-t, 0, -1).normalized());
        vertexList_.push_back(utymap::meshing::Vector3(-t, 0, 1).normalized());

        // create 20 triangles of the icosahedron
        std::vector<TriangleIndices> faces;
        // 5 faces around point 0
        faces.push_back(TriangleIndices(0, 11, 5));
        faces.push_back(TriangleIndices(0, 5, 1));
        faces.push_back(TriangleIndices(0, 1, 7));
        faces.push_back(TriangleIndices(0, 7, 10));
        faces.push_back(TriangleIndices(0, 10, 11));

        // 5 adjacent faces
        faces.push_back(TriangleIndices(1, 5, 9));
        faces.push_back(TriangleIndices(5, 11, 4));
        if (!isSemiSphere_)
            faces.push_back(TriangleIndices(11, 10, 2));

        faces.push_back(TriangleIndices(10, 7, 6));
        faces.push_back(TriangleIndices(7, 1, 8));

        // 5 faces around point 3
        if (!isSemiSphere_)
        {
            faces.push_back(TriangleIndices(3, 9, 4));
            faces.push_back(TriangleIndices(3, 4, 2));
            faces.push_back(TriangleIndices(3, 2, 6));
            faces.push_back(TriangleIndices(3, 6, 8));
            faces.push_back(TriangleIndices(3, 8, 9));
        }

        // 5 adjacent faces
        faces.push_back(TriangleIndices(4, 9, 5));
        if (!isSemiSphere_)
        {
            faces.push_back(TriangleIndices(2, 4, 11));
            faces.push_back(TriangleIndices(6, 2, 10));
        }
        faces.push_back(TriangleIndices(8, 6, 7));
        faces.push_back(TriangleIndices(9, 8, 1));

        // refine triangles
        for (int i = 0; i < recursionLevel_; i++)
        {
            std::vector<TriangleIndices> faces2;
            for (const auto& tri : faces)
            {
                // replace triangle by 4 triangles
                auto a = getMiddlePoint(tri.V1, tri.V2);
                auto b = getMiddlePoint(tri.V2, tri.V3);
                auto c = getMiddlePoint(tri.V3, tri.V1);

                faces2.push_back(TriangleIndices(tri.V1, a, c));
                faces2.push_back(TriangleIndices(tri.V2, b, a));
                faces2.push_back(TriangleIndices(tri.V3, c, b));
                faces2.push_back(TriangleIndices(a, b, c));
            }
            faces = faces2;
        }
        generateMesh(faces);

        // clear state to allow reusage
        middlePointIndexCache_.clear();
        vertexList_.clear();
    }
Beispiel #22
0
void MarchingCube::update()
{
    updateDensityField();
    generateMesh();
}
Beispiel #23
0
void testApp::update(){
    updateConditions();
    generateTexture();
    generateMesh(&points); 
    updateTexture();
}