Implement HasBoundingBox for Tirangle
This commit is contained in:
parent
e67204b96e
commit
1044fc3986
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::materials::Material;
|
use crate::materials::Material;
|
||||||
|
|
||||||
use super::{Intersect, IntersectionInfo, Ray};
|
use super::{BoundingBox, HasBoundingBox, Intersect, IntersectionInfo, Ray};
|
||||||
use nalgebra::{Point3, RealField, Vector2, Vector3};
|
use nalgebra::{Point3, RealField, Vector2, Vector3};
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
@ -77,6 +77,12 @@ impl<T: RealField> Intersect<T> for Triangle<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: RealField> HasBoundingBox<T> for Triangle<T> {
|
||||||
|
fn bounding_box(&self) -> BoundingBox<T> {
|
||||||
|
BoundingBox::from_points(&self.vertices)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn indices_with_index_of_largest_element_last<T: RealField>(v: &Vector3<T>) -> [usize; 3] {
|
fn indices_with_index_of_largest_element_last<T: RealField>(v: &Vector3<T>) -> [usize; 3] {
|
||||||
if v.x > v.y {
|
if v.x > v.y {
|
||||||
if v.z > v.x {
|
if v.z > v.x {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue