Beispiel #1
0
void TestCase::assertEqualsImpl(const Point2 &actual, const Point2 &expected, Float epsilon, const char *file, int line) {
	bool match = true;
	for (int i=0; i<2; ++i)
		if (std::abs(actual[i]-expected[i]) > epsilon)
			match = false;
	if (!match)
		Thread::getThread()->getLogger()->log(EError, NULL, file, line, "Assertion failure: "
			"expected point %s, got %s.", expected.toString().c_str(), actual.toString().c_str());
}
	void generateRay(const Point2 &dirSample, const Point2 &lensSample, 
		Float timeSample, Ray &ray) const {
		++cameraRays;

		Float u = dirSample.x * m_invResolution.x,
			  v = dirSample.y * m_invResolution.y;

		Vector direction = squareToSphereY(u, v);
		Point2 uvPrime = sphereToSquareY(direction);

		if ((std::abs(uvPrime.x-u) > Epsilon || std::abs(uvPrime.y-v)>Epsilon) && u < 1 && v < 1 && u > 0 && v > 0)
			cout << uvPrime.toString() << " vs " << u << ", " << v << endl;

		/* Construct ray in camera space */
		Ray localRay(Point(0.0f), direction,
			m_shutterOpen + m_shutterOpenTime * timeSample);

		/* Transform into world space */
		m_cameraToWorld(localRay, ray);
	}