def _create_shaft(self, length, width, depth, root_node_path): """ Creates the shaft sides individually and rotates and shifts them so that they form the shaft. """ # front front_node, vdata = create_side((-width / 2.0, length), (width / 2.0, 0), static=False) front_path = root_node_path.attachNewNode(front_node) front_path.setY(-depth / 2.0) self.shaft_vdata.append(vdata) # back back_node, vdata = create_side((-width / 2.0, length), (width / 2.0, 0), static=False) back_path = root_node_path.attachNewNode(back_node) back_path.setH(180) back_path.setY(depth / 2.0) self.shaft_vdata.append(vdata) # # top # top_node, vdata = create_side((-width/2.0, depth/2.0), (width/2.0, -depth/2.0), static=False) # top_path = root_node_path.attachNewNode(top_node) # top_path.setP(-90) # top_path.setZ(length) # self.shaft_vdata.append(vdata) # bottom bottom_node, vdata = create_side((-width / 2.0, depth / 2.0), (width / 2.0, -depth / 2.0), static=False) bottom_path = root_node_path.attachNewNode(bottom_node) bottom_path.setP(90) # right right_node, vdata = create_side((-depth / 2.0, length), (depth / 2.0, 0), static=False) right_path = root_node_path.attachNewNode(right_node) right_path.setH(90) right_path.setX(width / 2.0) self.shaft_vdata.append(vdata) # left left_node, vdata = create_side((-depth / 2.0, length), (depth / 2.0, 0), static=False) left_path = root_node_path.attachNewNode(left_node) left_path.setH(-90) left_path.setX(-width / 2.0) self.shaft_vdata.append(vdata)
def _create_tip(self, length, width, depth, root_node_path): # front front_node = create_triangle((-width/2.0,0), (0,length), (width/2.0,0)) front_path = root_node_path.attachNewNode(front_node) front_path.setY(-depth/2.0) # back back_node = create_triangle((-width/2.0,0), (0,length), (width/2.0,0)) back_path = root_node_path.attachNewNode(back_node) back_path.setH(180) back_path.setY(depth/2.0) # bottom bottom_node, _vdata = create_side((-width/2.0,depth/2.0), (width/2.0,-depth/2.0)) bottom_path = root_node_path.attachNewNode(bottom_node) bottom_path.setP(90)
def _create_shaft(self, length, width, depth, root_node_path): """ Creates the shaft sides individually and rotates and shifts them so that they form the shaft. """ # front front_node, vdata = create_side((-width/2.0, length), (width/2.0, 0), static=False) front_path = root_node_path.attachNewNode(front_node) front_path.setY(-depth/2.0) self.shaft_vdata.append(vdata) # back back_node, vdata = create_side((-width/2.0, length), (width/2.0, 0), static=False) back_path = root_node_path.attachNewNode(back_node) back_path.setH(180) back_path.setY(depth/2.0) self.shaft_vdata.append(vdata) # # top # top_node, vdata = create_side((-width/2.0, depth/2.0), (width/2.0, -depth/2.0), static=False) # top_path = root_node_path.attachNewNode(top_node) # top_path.setP(-90) # top_path.setZ(length) # self.shaft_vdata.append(vdata) # bottom bottom_node, vdata = create_side((-width/2.0, depth/2.0), (width/2.0, -depth/2.0), static=False) bottom_path = root_node_path.attachNewNode(bottom_node) bottom_path.setP(90) # right right_node, vdata = create_side((-depth/2.0, length), (depth/2.0, 0), static=False) right_path = root_node_path.attachNewNode(right_node) right_path.setH(90) right_path.setX(width/2.0) self.shaft_vdata.append(vdata) # left left_node, vdata = create_side((-depth/2.0, length), (depth/2.0, 0), static=False) left_path = root_node_path.attachNewNode(left_node) left_path.setH(-90) left_path.setX(-width/2.0) self.shaft_vdata.append(vdata)
def _create_tip(self, length, width, depth, root_node_path): # front front_node = create_triangle((-width / 2.0, 0), (0, length), (width / 2.0, 0)) front_path = root_node_path.attachNewNode(front_node) front_path.setY(-depth / 2.0) # back back_node = create_triangle((-width / 2.0, 0), (0, length), (width / 2.0, 0)) back_path = root_node_path.attachNewNode(back_node) back_path.setH(180) back_path.setY(depth / 2.0) # bottom bottom_node, _vdata = create_side((-width / 2.0, depth / 2.0), (width / 2.0, -depth / 2.0)) bottom_path = root_node_path.attachNewNode(bottom_node) bottom_path.setP(90)
def _create_hexagon(self, root_path, radius, width): hex_path = root_path.attachNewNode(PandaNode('hexagon')) # create the individual components of the hexagon and put them together front_side = create_hexagon(radius)[0] node_path = hex_path.attachNewNode(front_side) node_path.setY(-width/2.0) node_path.setR(30) back_side = create_hexagon(radius)[0] node_path = hex_path.attachNewNode(back_side) node_path.setH(180) node_path.setY(width/2.0) node_path.setR(30) side_dist = cos(degrees_to_radians(30))*radius for phi in range(0,360,60): rot_path = hex_path.attachNewNode(PandaNode('')) side = create_side((-radius/2.0, width/2.0), (radius/2.0, -width/2.0))[0] side_path = rot_path.attachNewNode(side) side_path.setP(-90) side_path.setZ(side_dist) rot_path.setR(phi) return hex_path
def _create_hexagon(self, root_path, radius, width): hex_path = root_path.attachNewNode(PandaNode('hexagon')) # create the individual components of the hexagon and put them together front_side = create_hexagon(radius)[0] node_path = hex_path.attachNewNode(front_side) node_path.setY(-width / 2.0) node_path.setR(30) back_side = create_hexagon(radius)[0] node_path = hex_path.attachNewNode(back_side) node_path.setH(180) node_path.setY(width / 2.0) node_path.setR(30) side_dist = cos(degrees_to_radians(30)) * radius for phi in range(0, 360, 60): rot_path = hex_path.attachNewNode(PandaNode('')) side = create_side((-radius / 2.0, width / 2.0), (radius / 2.0, -width / 2.0))[0] side_path = rot_path.attachNewNode(side) side_path.setP(-90) side_path.setZ(side_dist) rot_path.setR(phi) return hex_path
def _create_background(self, root_node_path, width, height): node, _vdata = create_side((0, 0), (width, -height)) root_node_path.attachNewNode(node)
def _create_bar(self, height, width, root_node_path): node, self.bar_vdata = create_side((-width / 2.0, height), (width / 2.0, 0), False) root_node_path.attachNewNode(node)
def _create_bar(self, height, width, root_node_path): node, self.bar_vdata = create_side((-width/2.0, height), (width/2.0, 0), False) root_node_path.attachNewNode(node)
def _create_background(self, root_node_path, width, height): node, _vdata = create_side((0,0), (width, -height)) root_node_path.attachNewNode(node)