Ejemplo n.º 1
0
def node_tree():
    b_pos = (1.0, 0.0, 0.0)
    b_axis = (0.0, 1.0, 0.0)
    b_rads = 3.14159265 / 2
    c_pos = (1.0, 0.0, 0.0)
    a = Node(name="a", parent=None)
    b = Node(name="b", parent=a)
    b.location = b_pos
    b.rotate(b_rads, b_axis)
    c = b.add_child_node(name="c")
    c.location = c_pos
    return a, b, c
Ejemplo n.º 2
0
def node_tree():
    b_pos = (1.0, 0.0, 0.0)
    b_axis = (0.0, 1.0, 0.0)
    b_rads = 3.14159265 / 2
    c_pos = (1.0, 0.0, 0.0)
    a = Node(name="a", parent=None)
    b = Node(name="b", parent=a)
    b.location = b_pos
    b.rotate(b_rads, b_axis)
    c = b.add_child_node(name="c")
    c.location = c_pos
    return a, b, c
Ejemplo n.º 3
0
    def _make_scene(self):
        """ Creates the scene based on configuration values.
        """
        # Make world node
        (l, w, d) = self.size
        world = Node(
            name="World",
            geometry=Box((l * 100, w * 100, d * 100),
                         material=Material(refractive_index=self.n0)),
        )

        # Create components (Absorbers, Luminophores and Scatteres)
        if len(self._user_components) == 0:
            self._user_components = self._make_default_components()
        components = []
        for component_data in self._user_components:
            cls = component_data.pop("cls")
            coefficient = component_data.pop("coefficient")
            component = cls(coefficient, **component_data)
            components.append(component)

        # Create LSC node
        lsc = Node(
            name="LSC",
            geometry=Box(
                (l, w, d),
                material=Material(
                    refractive_index=self.n1,
                    components=components,
                    surface=Surface(delegate=OptionalMirrorAndSolarCell(self)),
                ),
            ),
            parent=world,
        )

        if self._air_gap_mirror_info["want_air_gap_mirror"]:
            sheet_thickness = 0.25 * d  # make it appear thinner than the LSC
            air_gap_mirror = Node(
                name="Air Gap Mirror",
                geometry=Box(
                    (l, w, sheet_thickness),  # same surface air but very thin
                    material=Material(
                        refractive_index=self.n0,
                        components=[],
                        surface=Surface(delegate=AirGapMirror(self)),
                    ),
                ),
                parent=world,
            )
            # Move adjacent to bottom surface with a small air gap
            air_gap_mirror.translate((0.0, 0.0, -(0.5 * d + sheet_thickness)))

        # Use user light if any have been given, otherwise use default values.
        if len(self._user_lights) == 0:
            self._user_lights = self._make_default_lights()

        # Create light nodes
        for light_data in self._user_lights:
            name = light_data["name"]
            light = Light(
                name=name,
                direction=light_data["direction"],
                wavelength=light_data["wavelength"],
                position=light_data["position"],
            )
            light_node = Node(name=name, light=light, parent=world)
            light_node.location = light_data["location"]
            if light_data["rotation"]:
                light_node.rotate(*light_data["rotation"])

        self._scene = Scene(world)