예제 #1
0
void debug_draw_shape(std::vector<debug_line>& lines, const rgba col, const b2PolygonShape& sh, vec2 pos) {
	const auto n = sh.GetVertexCount();

	for (int i = 0; i < n; ++i) {
		lines.emplace_back(col, pos + sh.GetVertex(i), pos + sh.GetVertex((i + 1) % n));
	}
}
예제 #2
0
Polygon::Polygon(const b2PolygonShape& polygon) {
    reserve(polygon.GetVertexCount());
    for(int i = 0; i < polygon.GetVertexCount(); ++i) {
        append((Point) polygon.GetVertex(i));
    }
}