<commit_before>/* Lantern - A path tracer
*
* Lantern is the legal property of <NAME>
* Copyright <NAME> 2015 - 2016
*/

#pragma once

#include "math/vector_types.h"


namespace Lantern {

inline bool all(float3 &a) {
	return a.x == 0.0f && a.y == 0.0f && a.z == 0.0f;
}
inline bool all(float3a &a) {
	return a.x == 0.0f && a.y == 0.0f && a.z == 0.0f;
}

inline bool any(float3 &a) {
	return a.x == 0.0f || a.y == 0.0f || a.z == 0.0f;
}
inline bool any(float3a &a) {
	return a.x == 0.0f || a.y == 0.0f || a.z == 0.0f;
}

float3a RotateToWorld(float x, float y, float z, float3a &normal);

inline float SinSquaredThetaT(float VdotN, float eta) {
	return eta * eta * (1 - VdotN * VdotN);
}

inline float Fresnel(float IORi, float IORo, float VdotN, float sinSquaredThetaT) {
	// Check for total internal reflection
	if (sinSquaredThetaT > 1.0f) {
		return 1.0f;
	}

	float cosThetaT = std::sqrtf(1.0f - sinSquaredThetaT);
	float R_perpendicular = (IORi * VdotN - IORo * cosThetaT) / (IORi * VdotN + IORo * cosThetaT);
	float R_parallel = (IORo * VdotN - IORi * cosThetaT) / (IORo * VdotN + IORi * cosThetaT);

	return 0.5f * (R_perpendicular * R_perpendicular + R_parallel * R_parallel);
}

} // End of namespace Lantern<commit_msg>Create a set of functions for checking NaN values<commit_after>/* Lantern - A path tracer
*
* Lantern is the legal property of <NAME>
* Copyright <NAME> 2015 - 2016
*/

#pragma once

#include "math/vector_types.h"


namespace Lantern {

inline bool all(float3 &a) {
	return a.x == 0.0f && a.y == 0.0f && a.z == 0.0f;
}
inline bool all(float3a &a) {
	return a.x == 0.0f && a.y == 0.0f && a.z == 0.0f;
}

inline bool any(float3 &a) {
	return a.x == 0.0f || a.y == 0.0f || a.z == 0.0f;
}
inline bool any(float3a &a) {
	return a.x == 0.0f || a.y == 0.0f || a.z == 0.0f;
}

float3a RotateToWorld(float x, float y, float z, float3a &normal);

inline float SinSquaredThetaT(float VdotN, float eta) {
	return eta * eta * (1 - VdotN * VdotN);
}

inline float Fresnel(float IORi, float IORo, float VdotN, float sinSquaredThetaT) {
	// Check for total internal reflection
	if (sinSquaredThetaT > 1.0f) {
		return 1.0f;
	}

	float cosThetaT = std::sqrtf(1.0f - sinSquaredThetaT);
	float R_perpendicular = (IORi * VdotN - IORo * cosThetaT) / (IORi * VdotN + IORo * cosThetaT);
	float R_parallel = (IORo * VdotN - IORi * cosThetaT) / (IORo * VdotN + IORi * cosThetaT);

	return 0.5f * (R_perpendicular * R_perpendicular + R_parallel * R_parallel);
}

inline bool AnyNan(float3 &a) {
	return isnan(a.x) || isnan(a.y) || isnan(a.z);
}

inline bool AnyNan(float3a &a) {
	return isnan(a.x) || isnan(a.y) || isnan(a.z);
}

} // End of namespace Lantern
{'fraction_non_alphanumeric': 0.15846789335336087, 'fraction_numerical': 0.036049568156214795, 'mean_word_length': 3.4033057851239668, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4480109', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1125, 'n_words': 305}