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
use crate::{
    insert::Insert,
    objects::{Face, Objects},
    partial::HasPartial,
    storage::Handle,
    validate::ValidationError,
};

use super::Reverse;

impl Reverse for Handle<Face> {
    fn reverse(self, objects: &Objects) -> Result<Self, ValidationError> {
        let exterior = self.exterior().clone().reverse(objects)?;
        let interiors = self
            .interiors()
            .map(|cycle| cycle.clone().reverse(objects))
            .collect::<Result<Vec<_>, _>>()?;

        Ok(Face::partial()
            .with_exterior(exterior)
            .with_interiors(interiors)
            .with_color(self.color())
            .build(objects)?
            .insert(objects)?)
    }
}