Skip to content

Commit

Permalink
Some refactoring in get_medium_vec()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmeli100 committed Mar 18, 2021
1 parent fd3bea2 commit 79fffca
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ pub trait Interaction {

fn get_medium_vec(&self, w: &Vector3f) -> Option<Arc<Mediums>> {
if w.dot_norm(&self.n()) > 0.0 {
self.medium_interface()
.map_or_else(|| None, |m| m.outside)
if let Some(ref med_interface) = self.medium_interface() {
med_interface.outside.clone()
} else {
None
}
} else if let Some(ref med_interface) = self.medium_interface() {
med_interface.inside.clone()
} else {
self.medium_interface()
.map_or_else(|| None, |m| m.inside)
None
}
}

Expand Down

0 comments on commit 79fffca

Please sign in to comment.