def AJISAI(self): ajisai_file = open('AJISAI_coords', 'rb') coords = pickle.load(ajisai_file) ajisai_file.close() Radius = 1.075 facets = [] for lat in coords.keys(): for lon in coords[lat]: rlat = lat / 180 * pi rlon = lon / 180 * pi facet2body = CF.Cz(rlon).T @ CF.Cy(pi / 2 - rlat) position = CF.Cz(rlon) @ CF.Cy(rlat) @ array([1, 0, 0]) facet = Facet(15 / 100, 15 / 100, position, facet2body=facet2body, specular_coef=0.002) facets.append(facet) AJISAI = Spacecraft_Geometry(facets, sample_dim=1) for facet in AJISAI.facets: AJISAI.obscuring_facets[facet] = [] return AJISAI
def __init__(self): pZ = Facet(1, 1, array([0, 0, .5]), facet2body=identity(3), name='+Z') nZ = Facet(1, 1, array([0, 0, -.5]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(1, 1, array([.5, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(1, 1, array([-.5, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(1, 1, array([0, .5, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(1, 1, array([0, -.5, 0]), facet2body=CF.Cx(pi / 2), name='-Y') wingnX = Facet(1, .5, array([-1, 0, 0]), facet2body=CF.Cx(pi / 2), name='-X wing', double_sided=True) wingpX = Facet(1, .5, array([1, 0, 0]), facet2body=CF.Cx(pi / 2), name='+X wing', double_sided=True) self.BOX_WING = Spacecraft_Geometry( [pX, nX, pY, nY, pZ, nZ, wingnX, wingpX], sample_dim=.1) self.BOX = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.1) plate = Facet(1, 1, array([0, 0, 0]), facet2body=identity(3), name='plate', double_sided=True) self.PLATE = Spacecraft_Geometry([plate]) segments = 20 angle = 2 * pi / segments radius = 1.5 side_length = 1.8 * sin(angle / 2) * radius lenght = 9 cylinder_facets = [] for theta in linspace(0, 2 * pi, segments)[:-1]: pos = CF.Cz(theta) @ array([1, 0, 0]) facet2body = CF.Cz(theta) @ CF.Cy(pi / 2) cylinder_facets.append( Facet(lenght, side_length, pos, facet2body=facet2body, name='cylinder')) pZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, lenght / 2]), name='+Z', facet2body=identity(3)) nZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, -lenght / 2]), name='-Z', facet2body=CF.Cx(pi)) cylinder_facets.append(pZ) cylinder_facets.append(nZ) self.CYLINDER = Spacecraft_Geometry(cylinder_facets, sample_dim=.5) pZ = Facet(3.0, 1.0, array([0, 0, 1.0]), facet2body=identity(3), name='+Z') nZ = Facet(3.0, 1.0, array([0, 0, -1.0]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(2.0, 1.0, array([1.5, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(2.0, 1.0, array([-1.5, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(3.0, 2.0, array([0, .5, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(3.0, 2.0, array([0, -.5, 0]), facet2body=CF.Cx(pi / 2), name='-Y') self.RECTANGLE = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.1)
outfile = open('AJISAI_coords', 'wb') pickle.dump(Ms, outfile) outfile.close() print('File saved') # fig = plt.figure() # ax = Axes3D(fig) Radius = 1.075 facets = [] for lat in Ms.keys(): for lon in Ms[lat]: rlat = lat / 180 * pi rlon = lon / 180 * pi facet2body = CF.Cz(rlon).T @ CF.Cy(pi / 2 - rlat) position = CF.Cz(rlon) @ CF.Cy(rlat) @ array([1, 0, 0]) facet = RF.Facet(15 / 100, 15 / 100, position, facet2body=facet2body) facets.append(facet) AJISAI = RF.Spacecraft_Geometry(facets, sample_dim=1) for facet in AJISAI.facets: AJISAI.obscuring_facets[facet] = [] image = RF.generate_image(AJISAI, array([1, 0, 0]), array([1, 1, 1]), .01, win_dim=(3, 3), dpm=100, load_bar=True)
def __init__(self): pZ = Facet(1, 1, array([0, 0, .5]), facet2body=identity(3), name='+Z') nZ = Facet(1, 1, array([0, 0, -.5]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(1, 1, array([.5, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(1, 1, array([-.5, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(1, 1, array([0, .5, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(1, 1, array([0, -.5, 0]), facet2body=CF.Cx(pi / 2), name='-Y') wingnX = Facet(1, .5, array([-1, 0, 0]), facet2body=CF.Cx(pi / 2), name='-X wing', double_sided=True) wingpX = Facet(1, .5, array([1, 0, 0]), facet2body=CF.Cx(pi / 2), name='+X wing', double_sided=True) self.BOX_WING = Spacecraft_Geometry( [pX, nX, pY, nY, pZ, nZ, wingnX, wingpX], sample_dim=.1) self.BOX = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.1) plate = Facet(1, 1, array([0, 0, 0]), facet2body=identity(3), name='plate', double_sided=True) self.PLATE = Spacecraft_Geometry([plate]) segments = 20 angle = 2 * pi / segments radius = 1.5 side_length = radius * sin(angle / 2) * radius lenght = 9 cylinder_facets = [] for theta in linspace(0, 2 * pi, segments)[:-1]: pos = CF.Cz(theta) @ array([1, 0, 0]) facet2body = CF.Cz(theta) @ CF.Cy(pi / 2) cylinder_facets.append( Facet(lenght, side_length, pos, facet2body=facet2body, name='cylinder')) pZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, lenght / 2]), name='+Z', facet2body=identity(3)) pZ.area = pi * radius**2 nZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, -lenght / 2]), name='-Z', facet2body=CF.Cx(pi)) nZ.area = pi * radius**2 cylinder_facets.append(pZ) cylinder_facets.append(nZ) self.CYLINDER = Spacecraft_Geometry(cylinder_facets, sample_dim=.5) spec_coef = 0 diffuse_coef = .002 segments = 20 angle = 2 * pi / segments radius = 1.3 side_length = radius * sin(angle / 2) * 2 lenght = 11.6 cylinder_facets = [] for theta in linspace(0, 2 * pi, segments)[:-1]: pos = CF.Cz(theta) @ array([radius, 0, 0]) facet2body = CF.Cz(theta) @ CF.Cy(pi / 2) cylinder_facets.append( Facet(lenght, side_length, pos, facet2body=facet2body, name='cylinder', specular_coef=spec_coef, diffuse_coef=diffuse_coef)) pZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, lenght / 2]), name='+Z', facet2body=identity(3), specular_coef=spec_coef, diffuse_coef=diffuse_coef) pZ.area = pi * radius**2 nZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, -lenght / 2]), name='-Z', facet2body=CF.Cx(pi), specular_coef=spec_coef, diffuse_coef=diffuse_coef) nZ.area = pi * radius**2 cylinder_facets.append(pZ) cylinder_facets.append(nZ) #https://www.spacelaunchreport.com/ariane4.html #data from second stage self.ARIANE40 = Spacecraft_Geometry(cylinder_facets, sample_dim=.5) diffuse_coef = .0002 segments = 20 angle = 2 * pi / segments radius = 1.2 side_length = radius * sin(angle / 2) * 2 lenght = 6.5 cylinder_facets = [] for theta in linspace(0, 2 * pi, segments)[:-1]: pos = CF.Cz(theta) @ array([radius, 0, 0]) facet2body = CF.Cz(theta) @ CF.Cy(pi / 2) cylinder_facets.append( Facet(lenght, side_length, pos, facet2body=facet2body, specular_coef=0, diffuse_coef=diffuse_coef, name='cylinder')) pZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, lenght / 2]), name='+Z', facet2body=identity(3), specular_coef=0, diffuse_coef=diffuse_coef) pZ.area = pi * radius**2 nZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, -lenght / 2]), name='-Z', facet2body=CF.Cx(pi), specular_coef=0, diffuse_coef=diffuse_coef) nZ.area = pi * radius**2 cylinder_facets.append(pZ) cylinder_facets.append(nZ) self.SL8 = Spacecraft_Geometry(cylinder_facets, sample_dim=.5) pZ = Facet(3.0, 1.0, array([0, 0, 1.0]), facet2body=identity(3), name='+Z') nZ = Facet(3.0, 1.0, array([0, 0, -1.0]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(2.0, 1.0, array([1.5, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(2.0, 1.0, array([-1.5, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(3.0, 2.0, array([0, .5, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(3.0, 2.0, array([0, -.5, 0]), facet2body=CF.Cx(pi / 2), name='-Y') self.RECTANGLE = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.1) pZ = Facet(5.0, 1.0, array([0, 0, 1.0]), facet2body=identity(3), name='+Z') nZ = Facet(5.0, 1.0, array([0, 0, -1.0]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(2.0, 1.0, array([2.5, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(2.0, 1.0, array([-2.5, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(5.0, 2.0, array([0, .5, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(5.0, 2.0, array([0, -.5, 0]), facet2body=CF.Cx(pi / 2), name='-Y') self.LONG_RECTANGLE = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.1) xdim = .1 ydim = .1 zdim = .3 pZ = Facet(xdim, ydim, array([0, 0, zdim / 2]), facet2body=identity(3), name='+Z') nZ = Facet(xdim, ydim, array([0, 0, -zdim / 2]), facet2body=CF.Cy(pi), name='-Z') pX = Facet(zdim, ydim, array([xdim / 2, 0, 0]), facet2body=CF.Cy(pi / 2), name='+X') nX = Facet(zdim, ydim, array([-xdim / 2, 0, 0]), facet2body=CF.Cy(-pi / 2), name='-X') pY = Facet(xdim, zdim, array([0, ydim / 2, 0]), facet2body=CF.Cx(-pi / 2), name='+Y') nY = Facet(xdim, zdim, array([0, -ydim / 2, 0]), facet2body=CF.Cx(pi / 2), name='-Y') self.EXOCUBE = Spacecraft_Geometry([pX, nX, pY, nY, pZ, nZ], sample_dim=.01) spec_coef = .002 segments = 20 angle = 2 * pi / segments radius = 1.5 / 2 side_length = 2 * sin(angle / 2) * radius lenght = 7.9 cylinder_facets = [] for theta in linspace(0, 2 * pi, segments)[:-1]: pos = CF.Cz(theta) @ array([radius, 0, 0]) facet2body = CF.Cz(theta) @ CF.Cy(pi / 2) outer_facet = Facet(lenght, side_length, pos, facet2body=facet2body, name='cylinder', specular_coef=spec_coef) cylinder_facets.append(outer_facet) pZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, lenght / 2]), name='+Z', facet2body=identity(3), specular_coef=spec_coef) pZ.area = pi * radius**2 nZ = Facet(1.4 / sqrt(2), 1.4 / sqrt(2), array([0, 0, -lenght / 2]), name='-Z', facet2body=CF.Cx(pi), specular_coef=spec_coef) nZ.area = pi * radius**2 cylinder_facets.append(pZ) cylinder_facets.append(nZ) pX_panel = Facet(6, 1.5, array([6 / 2 + radius, 0, lenght / 2 - 1.5 / 2]), name='+X Panel', facet2body=CF.Cx(pi / 2), double_sided=True, specular_coef=spec_coef) nX_panel = Facet(6, 1.5, array([-6 / 2 - radius, 0, lenght / 2 - 1.5 / 2]), name='-X Panel', facet2body=CF.Cx(pi / 2), double_sided=True, specular_coef=spec_coef) cylinder_facets.append(pX_panel) cylinder_facets.append(nX_panel) dumypanel = Facet(lenght, radius / 2, array([0, 0, 0]), facet2body=CF.Cy(pi / 2), name='Fake Shadow', specular_coef=0) self.SERT2 = Spacecraft_Geometry(cylinder_facets, sample_dim=.1) self.SERT2.obscuring_facets[pX_panel] = [dumypanel] self.SERT2.obscuring_facets[nX_panel] = [dumypanel]