mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
bugfix: incorrect type
This commit is contained in:
parent
ffaf3aa450
commit
0d4d15209f
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue