p3 = Vertex(0.05, -0.05, 0.1, frame1)
    p4 = Vertex(0.05, -0.05, -0.1, frame1)
    p5 = Vertex(-0.05, 0.05, -0.1, frame1)
    p6 = Vertex(-0.05, 0.05, 0.1, frame1)
    p7 = Vertex(0.05, 0.05, 0.1, frame1)
    p8 = Vertex(0.05, 0.05, -0.1, frame1)

    fA = Face(p4, p3, p2, p1, frame1)
    fB = Face(p2, p3, p7, p6, frame1)
    fC = Face(p3, p4, p8, p7, frame1)
    fD = Face(p4, p1, p5, p8, frame1)
    fE = Face(p1, p2, p6, p5, frame1)
    fF = Face(p5, p6, p7, p8, frame1)

    cubesat = Geometry(frame1)
    cubesat.add_faces([fA, fB, fC, fD, fE, fF])

    def update(i):

        # Transforming frame1
        cubesat.rotate(angle_step, 0, 0, cor=cubesat.make_cuboid_centroid())

        projection_frame = Frame()

        for face in cubesat.faces:
            face.project(new_frame=projection_frame, plane='xz')

        print("[DEBUG] Plotting frame {}".format(i))

        # Setting up the axes object
        ax.clear()
Exemplo n.º 2
0
# Manually calculate centroid of Cubesat geometry
# COR = Vertex(0.05, 0.05, 0.1)
# COR.translate(0.1, 0.1, 0.1)

# Define faces of Cubesat
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