clay_core/shape/
target.rs

1use crate::{
2    prelude::*,
3};
4
5
6/// Target is a shape that is able to uniformly draw a random vector
7/// pointing to itself from any given point in space.
8pub trait Target: Pack + Instance<TargetClass> {}
9
10/// Device interface for target.
11pub enum TargetClass {}
12impl Class for TargetClass {
13    fn name() -> String {
14        "target".to_string()
15    }
16    fn methods() -> Vec<String> {
17        vec![
18            "sample".to_string(),
19        ]
20    }
21}
22
23/// The shape that could be put inside the specified bound.
24pub trait Targeted<T: Target> {
25    /// Returns target shape and the brightness.
26    ///
27    /// Brightness is used to compute ray attraction probability
28    /// during the importance sampling process.
29    fn target(&self) -> Option<(T, f64)>;
30}