Example #1
0
static bool transformPlane(const vector3df & point, const vector3df & normal,
						   const matrix4 & matrix, const plane3df & expected)
{
	plane3df plane(point, vector3df(normal).normalize());

	logTestString("\n     Pre: (%.3ff,%.3ff,%.3ff), %.3ff\n",
		plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D);

	matrix.transformPlane(plane);

	logTestString("    Post: (%.3ff,%.3ff,%.3ff), %.3ff\n",
		plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D);

	logTestString("Expected: (%.3ff,%.3ff,%.3ff), %.3ff\n",
		expected.Normal.X, expected.Normal.Y, expected.Normal.Z, expected.D);

	if(!sloppyComparePlanes(plane, expected))
	{
		logTestString("Unexpected result\n");
		assert_log(false);
		return false;
	}

	return true;
}
	void Polyhedron<Real>::transform(const matrix4<Real>& matrix)
	{
		for (uint i = 0; i < planes.size(); ++i)
			planes[i] = matrix.transformPlane(planes[i]);

		for (uint i = 0; i < vertices.size(); ++i)
			vertices[i] = matrix.transformVertex(vertices[i]);

	}