예제 #1
0
파일: shape2d.cpp 프로젝트: finalJ2/ClanLib
void Shape2D::add_rect(const Rectf &rect, const Angle &angle, bool reverse)
{
	Path2D path;

	Pointf point_1(rect.left, rect.top);
	Pointf point_2(rect.right, rect.top);
	Pointf point_3(rect.right, rect.bottom);
	Pointf point_4(rect.left, rect.bottom);

	if (angle.to_radians() != 0.0f)
	{
		Pointf center = rect.get_center();
		point_1.rotate(center, angle);
		point_2.rotate(center, angle);
		point_3.rotate(center, angle);
		point_4.rotate(center, angle);
	}

	path.add_line_to(point_1);
	path.add_line_to(point_2);
	path.add_line_to(point_3);
	path.add_line_to(point_4);

	if (reverse)
		path.reverse();

	add_path(path);
}
예제 #2
0
파일: quad_tree.hpp 프로젝트: AMDmi3/pingus
 QuadTreeNode(int depth, const Rectf& bounding_rect) :
   m_bounding_rect(bounding_rect),
   m_center(bounding_rect.get_center()),
   m_items(),
   m_depth(depth),
   m_nw(), 
   m_ne(),
   m_sw(), 
   m_se()
 {
 }