1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use crate::core::filter::Filter;
use crate::core::geometry::{Point2f, Vector2f};
use crate::core::paramset::ParamSet;
use crate::core::pbrt::Float;
#[derive(Debug, Default, Copy, Clone)]
pub struct BoxFilter {
pub radius: Vector2f,
pub inv_radius: Vector2f,
}
impl BoxFilter {
pub fn create(ps: &ParamSet) -> Box<Filter> {
let xw: Float = ps.find_one_float("xwidth", 0.5);
let yw: Float = ps.find_one_float("ywidth", 0.5);
let box_filter: Box<Filter> = Box::new(Filter::Bx(BoxFilter {
radius: Vector2f { x: xw, y: yw },
inv_radius: Vector2f {
x: 1.0 / xw,
y: 1.0 / yw,
},
}));
box_filter
}
pub fn evaluate(&self, _p: Point2f) -> Float {
1.0
}
pub fn get_radius(&self) -> Vector2f {
Vector2f {
x: self.radius.x,
y: self.radius.y,
}
}
}