Graph(std::map<int,Read*> reads,std::vector<Overlap*> overlaps){
     createVertices(reads);
     createEdges(overlaps);
     std::cout <<toString()<<"\n";
     removeEmptyVertices();
     for(Vertex *v:vertices){
         v->sortEdges();
     }
 }
Beispiel #2
0
void graph::loadFile(string filename)
{
	string data1, data2;
	fstream file;
	file.open(filename);

	while (getline(file, data1)){
		data2 = data1.substr(data1.find(';') + 1);
		data1 = data1.erase(data1.find(';'), data1.length());

		adjacencyList.emplace(coordSet(stoi(data1.substr(0, data1.find(',') + 1)), stoi(data1.substr(data1.find(',') + 1)), stoi(data2.substr(0, data2.find(',') + 1)), stoi(data2.substr(data2.find(',') + 1))), neighbors);
	}

	createEdges();
}
Beispiel #3
0
Facet::Facet(Vertex *a, Vertex *b, Vertex *c)
{
	m_vertices[0] = a;
	m_vertices[1] = b;
	m_vertices[2] = c;
	
	Vector3F e0 = *b->m_v - *a->m_v; e0.normalize();
	Vector3F e1 = *c->m_v - *a->m_v; e1.normalize();
	m_normal = e0.cross(e1);
	m_normal.normalize();
		
	createEdges();
	
	m_area = Facet::cumputeArea(a->m_v, b->m_v, c->m_v);
}
Beispiel #4
0
CGImageRef Image::createAbstraction(float stylization, uint quantization)
{
	pixel4b *rgbPixels = (pixel4b *) CFDataGetMutableBytePtr(_data);
	
	// Convert from RGB to Lab colorspace to perform operations on lightness channel.
	RGBtoLab(rgbPixels, _pixels);
	
	// Initial bilateral filter.
	bilateral();
	
	// Extract edges.
	pixel3f *edges = createEdges(stylization);
	
	// Additional bilateral filtering.
	bilateral();
	bilateral();
	
	// Quantize lightness channel.
	quantize(quantization);
	 
	// Overlay edges.
	overlayEdges(edges);
	 
	// Convert back to RGB colorspace.
	LabtoRGB(_pixels, rgbPixels);
	
	// Create an image from the modified data.
	CGContextRef context = CGBitmapContextCreate(
		rgbPixels,
		_width,
		_height,
		_bitsPerComponent,
		_bytesPerRow,
		_colorSpaceRef,
		_bitmapInfo
	);
	
	CGImageRef image = CGBitmapContextCreateImage(context);
	
	delete[] edges;
	
	return image;
}
Beispiel #5
0
Facet::Facet(Vertex *a, Vertex *b, Vertex *c, Vector3F *d)
{
	m_vertices[0] = a;
	m_vertices[1] = b;
	m_vertices[2] = c;
	
	Vector3F e0 = *b->m_v - *a->m_v; e0.normalize();
	Vector3F e1 = *c->m_v - *a->m_v; e1.normalize();
	m_normal = e0.cross(e1);
	m_normal.normalize();
	
	Vector3F e2 = *d - *a->m_v;
	if(e2.dot(m_normal) > 0.f)
		m_normal.reverse();
		
	createEdges();
	
	m_area = Facet::cumputeArea(a->m_v, b->m_v, c->m_v);
}