Esempio n. 1
0
fA = Face(p4, p3, p2, p1)
fB = Face(p2, p3, p7, p6)
fC = Face(p3, p4, p8, p7)
fD = Face(p4, p1, p5, p8)
fE = Face(p1, p2, p6, p5)
fF = Face(p5, p6, p7, p8)

# Initialize Cubesat model as a Geometry object.
geometry1 = Geometry()
geometry1.add_faces([fA, fB, fC, fD, fE, fF])

# Translate geometry outward, so it is not positioned on the global axes.
geometry1.translate(0.1, 0.1, 0.1)

# Apply rotations as specified earlier.
geometry1.rotate_cuboid_centroid(a, b, c)

# Create a projection object that can be plotted later.
geometry1xy = geometry1.project_illuminated_faces('xy')


# %% Plotting code

# Check value for illuminated area. Because Cubesat is a cuboid, illuminated
# area and the unilluminated area should be the same UNLESS only one side is 
# facing the light. Used for debugging.
A_shadow_check = round(geometry1xy.area(), 4)

# Properly compute the illuminated area using Geometry method:
A_shadow = round(geometry1.illuminated_area(plane='xy'), 4)
Esempio n. 2
0
fA = Face(p4, p3, p2, p1)
fB = Face(p2, p3, p7, p6)
fC = Face(p3, p4, p8, p7)
fD = Face(p4, p1, p5, p8)
fE = Face(p1, p2, p6, p5)
fF = Face(p5, p6, p7, p8)

# Initialize Cubesat model as a Geometry object.
cubesat = Geometry()
cubesat.add_faces([fA, fB, fC, fD, fE, fF])

# Translate geometry outward, so it is not positioned on the global axes.
cubesat.translate(0.1, 0.25, 0.1)

# Apply rotations as specified earlier.
cubesat.rotate_cuboid_centroid(a, b, c)

# %% Plotting code

# Properly compute the illuminated area using Geometry method:
A_shadow = round(cubesat.illuminated_area(plane='xz'), 4)

print('Projected A_xz =', A_shadow, "m^2")

# Toggle plotting functionality:
if True:

    # Setting up the plot:
    fig = plt.figure(figsize=(10, 7))
    ax = mp3d.Axes3D(fig)
    """ TO CHANGE THE DEFAULT CAMERA VIEW, CHANGE THESE: """