Skip to content

Instantly share code, notes, and snippets.

@tbillington
Created August 5, 2014 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tbillington/21396d316c2310ca314e to your computer and use it in GitHub Desktop.
Save tbillington/21396d316c2310ca314e to your computer and use it in GitHub Desktop.
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> {
Some(
RefCell::new(
Face {
a:match vertexs.slice(face.a,face.a+1).iter().next() {
Some(x) => x.clone(),
None => return None,
},
b:match vertexs.slice(face.b,face.b+1).iter().next() {
Some(x) => x.clone(),
None => return None,
},
c:match vertexs.slice(face.c,face.c+1).iter().next() {
Some(x) => x.clone(),
None => return None,
},
d:match vertexs.slice(face.d,face.d+1).iter().next() {
Some(x) => x.clone(),
None => return None,
}}))
}
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> {
let a = match vertexs.slice(face.a,face.a+1).iter().next() {
Some(x) => x.clone(),
None => return None,
};
let b = match vertexs.slice(face.b,face.b+1).iter().next() {
Some(x) => x.clone(),
None => return None,
};
let c = match vertexs.slice(face.c,face.c+1).iter().next() {
Some(x) => x.clone(),
None => return None,
};
let d = match vertexs.slice(face.d,face.d+1).iter().next() {
Some(x) => x.clone(),
None => return None,
};
Some(
RefCell::new(
Face {
a:a,
b:b,
c:c,
d:d,
}}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment