⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 triangulate_float.cpp

📁 一个开源的Flash 播放器,可以在Windows/Linux 上运行
💻 CPP
字号:
// triangulate_float.cpp	-- Thatcher Ulrich 2004

// This source code has been donated to the Public Domain.  Do
// whatever you want with it.

// Code to triangulate arbitrary 2D polygonal regions.
//
// Instantiate our templated algo from triangulate_inst.h

#include "base/triangulate_impl.h"


namespace triangulate
{
	// Version using float coords
	void	compute(
		array<float>* result,	// trilist
		int path_count,
		const array<float> paths[],
		int debug_halt_step /* = -1 */,
		array<float>* debug_remaining_loop /* = NULL */)
	{
		compute_triangulation<float>(result, path_count, paths, debug_halt_step, debug_remaining_loop);
	}
}



#ifdef TEST_TRIANGULATE_FLOAT

// Compile test with something like:
//
// gcc -o triangulate_test -I../ triangulate_float.cpp tu_random.cpp -DTEST_TRIANGULATE_FLOAT -lstdc++
//
// or
//
// cl -Od -Zi -o triangulate_test.exe -I../ triangulate_float.cpp tu_random.cpp -DTEST_TRIANGULATE_FLOAT


void	test_square()
// A very minimal, easy test.
{
	array<float>	result;
	array<array<float> >	paths;

	// Make a square.
	paths.resize(1);
	paths[0].push_back(0);
	paths[0].push_back(0);
	paths[0].push_back(1);
	paths[0].push_back(0);
	paths[0].push_back(1);
	paths[0].push_back(1);
	paths[0].push_back(0);
	paths[0].push_back(1);

	// Triangulate.
	triangulate::compute(&result, paths.size(), &paths[0]);

	// Dump.
	for (int i = 0; i < result.size(); i++)
	{
		printf("%f\n", result[i]);
	}
}


int	main()
{
	test_square();

	return 0;
}


#endif // TEST_TRIANGULATE_FLOAT


// Local Variables:
// mode: C++
// c-basic-offset: 8 
// tab-width: 8
// indent-tabs-mode: t
// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -