Beispiel #1
0
void test_poisson() {
    sf::RenderWindow window(sf::VideoMode(200, 200), "Wave Test");
    Random r;
	Poisson p;

	p.generate(r, 200, 200, 30, 10, 100);

	window.clear(sf::Color::Black);
	sf::CircleShape cs(2, 4);
	for (vector<double>::const_iterator xit = p.get_x().begin(), yit = p.get_y().begin();
		 xit != p.get_x().end() && yit != p.get_y().end(); xit++, yit++) {
		cs.setPosition(*xit, *yit);
		window.draw(cs);
	}
	window.display();

	window_loop(window);
}
Beispiel #2
0
void test_poisson2(int w, int h, int radius) {
    sf::RenderWindow window(sf::VideoMode(w, h), "Wave Test");
    Random r;
	Poisson p;
    
    p.generate(r, w, h, radius, 40);
    
	window.clear(sf::Color::Black);
	sf::CircleShape cs(radius, 8);
	for (vector<double>::const_iterator xit = p.get_x().begin(), yit = p.get_y().begin();
		 xit != p.get_x().end() && yit != p.get_y().end(); xit++, yit++) {
		cs.setPosition(*xit, *yit);
		window.draw(cs);
	}
	window.display();

    cerr << p.get_x().size() << endl;

	window_loop(window);
}