This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Vertex { | |
x: f64, | |
y: f64, | |
z: f64, | |
} | |
struct Face { | |
a: &Vertex, | |
b: &Vertex, | |
c: &Vertex, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::rc::Rc; | |
struct Vertex { | |
x: f64, | |
y: f64, | |
z: f64, | |
} | |
struct Face { | |
a: Rc<Vertex>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::File; | |
use std::io::BufferedReader; | |
use std::rc::Rc; | |
use std::cell::RefCell; | |
use std::cell::Cell; | |
struct Vertex { | |
x: f64, | |
y: f64, | |
z: f64, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = vertexs.slice(face.a,face.a+1).iter().next(); | |
let mut aa: Rc<RefCell<Vertex>>; | |
match a { | |
Some(x) => aa = x.clone(), | |
None => (), | |
}; | |
error: use of possibly uninitialized variable: `aa` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
let a = match vertexs.get(face.a) { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let b = match vertexs.get(face.b) { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let c = match vertexs.get(face.c) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexes: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
Some(RefCell::new(Face { | |
a: match vertexes.get(face.a) { | |
Some(x) => x.clone(), | |
None => return None | |
}, | |
b: match vertexes.get(face.b) { | |
Some(x) => x.clone(), | |
None => return None | |
}, |
OlderNewer