author Dmitriy Morozov <dmitriy@mrzv.org>
Thu, 18 Dec 2008 16:43:42 -0800
changeset 97 0a9bd3f34419
parent 40 122e4a1fa117
child 131 d9e050258358
permissions -rw-r--r--
Intermediate commit while converting to the new architecture * Converted Filtration into StaticPersistence and DynamicPersistenceTrails (both right now work with the underlying std::vector rather than std::list order) * Filtration is now just an auxilliary glue (a map between Complex and Persistence) * Whether chains are vectors or lists can be interchanged * Added PersistenceDiagram with a simple bottleneck_distance() function * Converted triangle, alphashapes3d, and cech-complex examples * Lots of organizational changes (factoring utilities out into containers.h, indirect.h, property-maps.h) * Trying to document along the way with NaturalDocs-type comments

#include <utilities/log.h>

#include "alphashapes2d.h"
#include <topology/filtration.h>
#include <iostream>
#include <fstream>

typedef Filtration<AlphaSimplex2D>				AlphaFiltration;

int main(int argc, char** argv) 
#ifdef LOGGING
	rlog::RLogInit(argc, argv);

	stdoutLog.subscribeTo( RLOG_CHANNEL("error") );
	stdoutLog.subscribeTo( RLOG_CHANNEL("info") );
	//stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
	//stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );

	SetFrequency(GetCounter("filtration/pair"), 10000);
	SetTrigger(GetCounter("filtration/pair"), GetCounter(""));

	// Read in the point set and compute its Delaunay triangulation
	std::istream& in = std::cin;
	double x,y;
	Delaunay Dt;
		in >> x >> y;
		Point p(x,y);
	rInfo("Delaunay triangulation computed");
	AlphaSimplex2DVector alpha_ordering;
	fill_alpha_order(Dt, alpha_ordering);
	rInfo("Simplices: %i", alpha_ordering.size());

	// Create the alpha-shape filtration
	AlphaFiltration af;
	for (AlphaSimplex2DVector::const_iterator cur = alpha_ordering.begin(); 
											  cur != alpha_ordering.end(); ++cur)
	rInfo("Filled simplex-index map");
	af.pair_simplices(af.begin(), af.end(), false);
	rInfo("Simplices paired");

	for (AlphaFiltration::Index i = af.begin(); i != af.end(); ++i)
		if (i->is_paired())
			if (i->sign())
				std::cout << i->dimension() << " " << i->value() << " " << i->pair()->value() << std::endl;
		} //else std::cout << i->value() << std::endl;