def setUp(self): dir = N.c_[[0, 0, 1], [0, 0, -1], [0, -1, -1]] position = N.c_[[0, 0, 1], [0, 1, 2], [0, 0, 1]] self._bund = RayBundle() self._bund.set_vertices(position) self._bund.set_directions(dir)
def setUp(self): self._surf = FlatSurface() dir = N.array([[1, 1, -1], [-1, 1, -1], [-1, -1, -1], [1, -1, -1] ]).T / math.sqrt(3) position = c_[[0, 0, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]] self._bund = RayBundle() self._bund.set_vertices(position) self._bund.set_directions(dir)
def setUp(self): dir = N.array([[1, 1, -1], [-1, 1, -1], [-1, -1, -1], [1, -1, -1] ]).T / math.sqrt(3) position = N.c_[[0, 0, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]] self._bund = RayBundle() self._bund.set_vertices(position) self._bund.set_directions(dir) energy = N.array([1, 1, 1, 1]) self._bund.set_energy(energy) objects = [FlatSurface()] self.engine = TracerEngine(objects)
def setUp(self): self.x = 1 / (math.sqrt(2)) dir = N.c_[[0, -self.x, self.x], [0, 0, -1]] position = N.c_[[0, 2, 1], [0, 2, 1]] self._bund = RayBundle() self._bund.set_vertices(position) self._bund.set_directions(dir) rot1 = general_axis_rotation([1, 0, 0], N.pi / 4) energy = N.array([1, 1]) self._bund.set_energy(energy) objects = [ FlatSurface(rotation=rot1, width=10, height=10), FlatSurface(width=10, height=10) ] self.engine = TracerEngine(objects)
def get_outgoing(self, selector): """Generates a new ray bundle, which is the reflections/refractions of the user-selected rays out of the incoming ray-bundle that was previously registered. Arguments: selector - a boolean array specifying which rays of the incoming bundle are still relevant. Returns: a RayBundle object with the new bundle, with vertices on the panel and directions according to optics laws. """ vertices = N.dot(self.get_rotation()[:, :2], self._current_params[:, selector]) + \ self.get_location()[:, None] dirs = optics.reflections(self._current_bundle.get_directions()[:, selector], self.get_rotation()[:, 2][:,None]) outg = RayBundle() outg.set_vertices(vertices) outg.set_directions(dirs) return outg