diff --git a/pyraydeon/examples/py_rhombohedron.py b/pyraydeon/examples/py_rhombohedron.py index c2e8d0f..e93b100 100644 --- a/pyraydeon/examples/py_rhombohedron.py +++ b/pyraydeon/examples/py_rhombohedron.py @@ -20,6 +20,15 @@ def __init__(self, origin, basis, dims): self.basis = basis self.dims = dims + self.faces = [ + [0, 1, 3, 2], + [4, 5, 7, 6], + [0, 1, 5, 4], + [2, 3, 7, 6], + [0, 2, 6, 4], + [1, 3, 7, 5], + ] + combinations = np.array(np.meshgrid([0, 1], [0, 1], [0, 1])).T.reshape(-1, 3) scaled_combinations = combinations * dims @@ -37,14 +46,6 @@ def __init__(self, origin, basis, dims): move_vectors = unit_move_dirs * 0.0015 self.path_vertices = self.vertices + move_vectors - self.faces = [ - [0, 1, 3, 2], # Bottom face - [4, 5, 7, 6], # Top face - [0, 1, 5, 4], # Front face - [2, 3, 7, 6], # Back face - [0, 2, 6, 4], # Left face - [1, 3, 7, 5], # Right face - ] self.quads = self.compute_quads() def __repr__(self): @@ -87,18 +88,18 @@ def paths(self, cam): scene = Scene( [ Rhombohedron( - origin=np.array([0.0, 0.0, 0.0]), + origin=np.array([0.0, 0.0, 0.2]), basis=np.array( [ - [0.9, 0.5, 0.0], + [0.45, 0.2, -0.3], [-0.3, 1.0, 0.0], - [-0.5, 0.25, -0.7], + [-0.5, 0.0, -0.2], ] ), - dims=np.array([1.0, 1.0, 1.0]), + dims=np.array([2.0, 0.5, 1.0]), ), Rhombohedron( - origin=np.array([2.0, 0.0, -2.0]), + origin=np.array([1.0, 0.0, -2.0]), basis=np.array( [ [-0.9, 0.5, 0.0], @@ -106,12 +107,12 @@ def paths(self, cam): [1.5, 0.25, -0.7], ] ), - dims=np.array([1.0, 1.0, 1.0]), + dims=np.array([1.0, 1.0, 0.8]), ), ] ) -eye = np.array([0, 0.4, 5]) +eye = np.array([0, -0.5, 5]) focus = np.array([0, 0.4, 0]) up = np.array([0, 1, 0]) diff --git a/pyraydeon/examples/py_rhombohedron_expected.svg b/pyraydeon/examples/py_rhombohedron_expected.svg index 23143b2..814b442 100644 --- a/pyraydeon/examples/py_rhombohedron_expected.svg +++ b/pyraydeon/examples/py_rhombohedron_expected.svg @@ -1 +1 @@ - + diff --git a/raydeon/src/shapes/quad.rs b/raydeon/src/shapes/quad.rs index 8b0bf70..654a4b0 100644 --- a/raydeon/src/shapes/quad.rs +++ b/raydeon/src/shapes/quad.rs @@ -20,14 +20,14 @@ impl Quad { } pub fn tagged(origin: WPoint3, mut basis: [WVec3; 2], dims: [f64; 2], tag: usize) -> Quad { + basis[0] = basis[0].normalize(); + basis[1] = basis[1].normalize(); let verts = [ origin, origin + basis[0] * dims[0], origin + basis[0] * dims[0] + basis[1] * dims[1], origin + basis[1] * dims[1], ]; - basis[0] = basis[0].normalize(); - basis[1] = basis[1].normalize(); Quad { origin, basis, @@ -42,7 +42,7 @@ impl Shape for Quad { fn collision_geometry(&self) -> Option>>> { Some(vec![ Arc::new(Triangle::new(self.verts[0], self.verts[1], self.verts[3])), - Arc::new(Triangle::new(self.verts[2], self.verts[3], self.verts[1])), + Arc::new(Triangle::new(self.verts[1], self.verts[2], self.verts[3])), ]) }