Change the Intersection to a class, and stop using memory allocation for it (and pointer)
A bit more clean (on the code side)
This commit is contained in:
@@ -27,8 +27,8 @@ Intersect Sphere::intersect(Ray r)
|
||||
|
||||
if (discriminant >= 0)
|
||||
{
|
||||
ret.add(newIntersection((-b - sqrt(discriminant)) / (2 * a), this));
|
||||
ret.add(newIntersection((-b + sqrt(discriminant)) / (2 * a), this));
|
||||
ret.add(Intersection((-b - sqrt(discriminant)) / (2 * a), this));
|
||||
ret.add(Intersection((-b + sqrt(discriminant)) / (2 * a), this));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user