Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 39b13612ebd645a65eda854771b517371f2f858a authored by ennetws on 13 March 2015, 18:17:18 UTC, committed by ennetws on 13 March 2015, 18:17:18 UTC
Create README.md
1 parent c702819
  • Files
  • Changes
  • adfc2e5
  • /
  • Reconstruction
  • /
  • poissonrecon.cpp
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:39b13612ebd645a65eda854771b517371f2f858a
directory badge Iframe embedding
swh:1:dir:7edf6bef82919ad81008be6756fa167968416c2f
content badge Iframe embedding
swh:1:cnt:6235002b3b3a5e51cad184d2a55b48d6c7c246e7
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
poissonrecon.cpp
#include "poissonrecon.h"

#include <QFileInfo>
#include <QDir>
#include <QTextStream>

#include "Src/PoissonRecon.cpp"

char **PoissonRecon::convertArguments(QStringList args)
{
    char ** argsv = new char*[args.size()];

    for(int i = 0; i < (int)args.size(); i++)
    {
        argsv[i] = new char[args[i].size() + 1];

        for(int j = 0; j < args[i].size(); j++)
            argsv[i][j] = args[i].at(j).toAscii();

		argsv[i][args[i].size()] = '\0';
    }

    return argsv;
}

void PoissonRecon::makeFromCloud( std::vector< std::vector<float> > p, std::vector< std::vector<float> > n, SimpleMesh & mesh, int depth /*= 7*/ )
{
	QStringList args;

	args << "program_name";
	args << "--in" << "dummy" << "--out" << "output";
	args << "--depth" << QString::number(depth);

	std::vector< std::vector<float> > mesh_verts;
	std::vector< std::vector<int> > mesh_faces;

    ExecuteMemory< 2 >(args.size(), convertArguments(args), p, n, mesh.vertices, mesh.faces);

	// DEBUG: output point cloud
	if( mesh.faces.size() == 0 )
	{
		QFile file( "cloud.xyz" );
		QFileInfo fileInfo(file.fileName());
		QDir d(""); d.mkpath(fileInfo.absolutePath());
		if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return;
		QTextStream out(&file);

		for(int i = 0; i < (int)p.size(); i++){
			for(int v = 0; v < 3; v++)	out << p[i][v] << " ";
			for(int v = 0; v < 3; v++)	out << n[i][v] << " ";
			out << "\n";
		}

		file.close();
	}
}

void PoissonRecon::makeFileFromCloud( std::vector< std::vector<float> > p, std::vector< std::vector<float> > n, QString out_filename, int depth /*= 7*/ )
{
	QStringList args;

	args << "program_name";
	args << "--in" << "dummy" << "--out" << "output";
	args << "--depth" << QString::number(depth);

	std::vector< std::vector<float> > mesh_verts;
	std::vector< std::vector<int> > mesh_faces;

    ExecuteMemory< 2 >(args.size(), convertArguments(args), p, n, mesh_verts, mesh_faces);

	// Write OBJ
	writeOBJ(out_filename, mesh_verts, mesh_faces);
}

void PoissonRecon::writeOBJ(QString out_filename, std::vector< std::vector<float> > & mesh_verts, std::vector< std::vector<int> > & mesh_faces)
{
	QFile file(out_filename);

	// Create folder
	QFileInfo fileInfo(file.fileName());
	QDir d(""); d.mkpath(fileInfo.absolutePath());

	// Open for writing
	if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return;

	QTextStream out(&file);
	out << "# NV = " << mesh_verts.size() << " NF = " << mesh_faces.size() << "\n";

	// Vertices
	foreach( std::vector<float> v, mesh_verts )
	{
		out << "v " << v[0] << " " << v[1] << " " << v[2] << "\n";
	}

	// Faces
	foreach( std::vector<int> f, mesh_faces )
	{
		out << "f " << (f[0]+1) << " " << (f[1]+1) << " " << (f[2]+1) << "\n";
	}
	file.close();
}
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top