bugfix: incorrect type

This commit is contained in:
Shuo Feng 2024-02-19 17:30:29 -05:00
parent ffaf3aa450
commit 0d4d15209f
Signed by: sfeng
GPG key ID: 1E83AE6CD1C037B1

View file

@ -6,9 +6,9 @@ void Geometry::setTransform(const Matrix4f &transform) {
bool Sphere::intersect(const Ray &r) const { bool Sphere::intersect(const Ray &r) const {
Vector3f originCenter = r.getOrigin() - center; Vector3f originCenter = r.getOrigin() - center;
int a = r.getDirection().dot(r.getDirection()); float a = r.getDirection().dot(r.getDirection());
int b = 2 * originCenter.dot(r.getDirection()); float b = 2.0f * originCenter.dot(r.getDirection());
int c = originCenter.dot(originCenter) - radius * radius; float c = originCenter.dot(originCenter) - radius * radius;
return b * b - 4 * a * c >= 0; return b * b - 4 * a * c >= 0;
} }