pI = return_intersection_under_Ceva_Theorem(pA, pC, pB, pE, pH)
pO = return_intersection_under_Ceva_Theorem(pC, pA, pN, pK, pJ)

lineCK, = ax2.plot(*zip(pC, pK), linewidth=1, color='b', linestyle=':')
lineAJ, = ax2.plot(*zip(pA, pJ), linewidth=1, color='b', linestyle=':')
lineBL, = ax2.plot(*zip(pB, pL), linewidth=1, color='b', linestyle=':')
lineDI, = ax2.plot(*zip(pD, pI), linewidth=1, color='b', linestyle=':')

lineMN, = ax2.plot(*zip(pM, pN), linewidth=1, color='b')
lineGE, = ax2.plot(*zip(pG, pE), linewidth=1, color='b')
lineHF, = ax2.plot(*zip(pH, pF), linewidth=1, color='b')

pO_on_BCD = project_a_point_to_a_plane(pO, pB - pD, pC - pD, pJ)
radius = np.linalg.norm(pO - pO_on_BCD)
plot_front(ax2, pO[0], pO[1], pO[2], radius)
plot_back(ax2, pO[0], pO[1], pO[2], radius)

lineO_BCD, = ax2.plot(*zip(pO, pO_on_BCD),
                      linewidth=1,
                      color='r',
                      linestyle=':')

ax2.text(*pA,
         s=r'$A$',
         fontsize=12,
         verticalalignment='bottom',
         horizontalalignment='right')
ax2.text(*pB,
         s=r'$B$',
         fontsize=12,
         verticalalignment='bottom',
示例#2
0
#ax2.view_init(elev=180, azim=-90)
ax2.view_init(elev=0, azim=-0)
#ax2.view_init(elev=90, azim=-90)
#ax2.view_init(elev=0, azim=-90)
ax2.set_color_cycle('b')


## Plot tainan local axes at a certain datetime
import datetime
MonDayMinSec = datetime.datetime(2020,4,16,12,1)
dt = (MonDayMinSec - datetime.datetime(2020,1,1,0,0)).total_seconds()
print '*****',30*24*60*60 +1 # small one sec to avoid matrix zero
sun_vec = np.dot(CK(omega_CM*dt*np.array([0,1,0])),np.array([1,0,0]))
plot_earth_center= sun_distance*sun_vec
plot_front(ax2,plot_earth_center[0],plot_earth_center[1],plot_earth_center[2],earth_radius)
plot_back(ax2, plot_earth_center[0],plot_earth_center[1],plot_earth_center[2],earth_radius)
#draw_xyz_coordinate_unit_vectors(ax2)


taiwan_current_x = np.dot(CK((omega_fast*dt)*earth_ax),taiwan_x)
taiwan_current_y = np.dot(CK((omega_fast*dt)*earth_ax),taiwan_y)
taiwan_current_z = np.dot(CK((omega_fast*dt)*earth_ax),taiwan_z)
taiwan_position = sun_distance*sun_vec + earth_radius*taiwan_current_z
earth_x_arrow = Arrow3D([taiwan_position[0],taiwan_position[0]+6e6*taiwan_current_x[0]],
                        [taiwan_position[1],taiwan_position[1]+6e6*taiwan_current_x[1]],
                        [taiwan_position[2],taiwan_position[2]+6e6*taiwan_current_x[2]], 
                    mutation_scale=8,
                  #lw=4,
                  arrowstyle="-|>", color="b")
ax2.add_artist(earth_x_arrow)
#ax2.text(*xyz_arrow_data[2,:],s="z",fontsize=12)
示例#3
0
#Plot the midsphere
#cx,cy,cz, radius = four_points_circle(pE,pF,pN,pH)

# graph step one
lineCB, = ax2.plot(*zip(pC, pB), linewidth=2, color='b')
lineCD, = ax2.plot(*zip(pC, pD), linewidth=2, color='b')
lineBD, = ax2.plot(*zip(pB, pD), linewidth=2, color='b')
lineIbcdO, = ax2.plot(*zip(pO, incenterBCD),
                      linewidth=1,
                      color='b',
                      linestyle=':')
incircleBCD = circle_full(normvecBCD,
                          (-incenterBCD + pB), inradiusBCD, 40) + incenterBCD
ax2.plot(*np.transpose(incircleBCD), linewidth=1, linestyle=':')
plot_front(ax2, pO[0], pO[1], pO[2], sphereR)
plot_back(ax2, pO[0], pO[1], pO[2], sphereR)
ax2.text(*pB,
         s=r'$B$',
         fontsize=12,
         verticalalignment='bottom',
         horizontalalignment='right')
ax2.text(*pC,
         s=r'$C$',
         fontsize=12,
         verticalalignment='top',
         horizontalalignment='left')
ax2.text(*pD,
         s=r"$D$",
         fontsize=12,
         verticalalignment='top',
         horizontalalignment='left')
    def plotting(self, ax2):
        ## Plot tainan local axes at a certain datetime
        taiwan_current_x = self.taiwan_current_x
        taiwan_current_y = self.taiwan_current_y
        taiwan_current_z = self.taiwan_current_z
        taiwan_position = 5 * self.earth_radius * self.sun_vec + self.earth_radius * self.taiwan_current_z  #scale down the earth-sun distance to better illustrate
        z_shadow_vec = self.z_shadow_vec
        sun2ground_vec = self.sun2ground_vec

        plot_earth_center = 5 * self.earth_radius * self.sun_vec  #scale down the earth-sun distance to better illustrate
        plot_front(ax2, plot_earth_center[0], plot_earth_center[1],
                   plot_earth_center[2], self.earth_radius)
        plot_back(ax2, plot_earth_center[0], plot_earth_center[1],
                  plot_earth_center[2], self.earth_radius)
        #draw_xyz_coordinate_unit_vectors(ax2)

        earth_x_arrow = Arrow3D(
            [
                taiwan_position[0],
                taiwan_position[0] + 6e6 * taiwan_current_x[0]
            ],
            [
                taiwan_position[1],
                taiwan_position[1] + 6e6 * taiwan_current_x[1]
            ],
            [
                taiwan_position[2],
                taiwan_position[2] + 6e6 * taiwan_current_x[2]
            ],
            mutation_scale=8,
            #lw=4,
            arrowstyle="-|>",
            color="b")
        ax2.add_artist(earth_x_arrow)
        #ax2.text(*xyz_arrow_data[2,:],s="z",fontsize=12)

        earth_z_arrow = Arrow3D(
            [
                taiwan_position[0],
                taiwan_position[0] + 6e6 * taiwan_current_z[0]
            ],
            [
                taiwan_position[1],
                taiwan_position[1] + 6e6 * taiwan_current_z[1]
            ],
            [
                taiwan_position[2],
                taiwan_position[2] + 6e6 * taiwan_current_z[2]
            ],
            mutation_scale=8,
            #lw=4,
            arrowstyle="-|>",
            color="b")
        ax2.add_artist(earth_z_arrow)
        #ax2.text(*xyz_arrow_data[2,:],s="z",fontsize=12)

        earth_ax_arrow = Arrow3D(
            [
                plot_earth_center[0],
                plot_earth_center[0] + 8e6 * self.earth_ax[0]
            ],
            [
                plot_earth_center[1],
                plot_earth_center[1] + 8e6 * self.earth_ax[1]
            ],
            [
                plot_earth_center[2],
                plot_earth_center[2] + 8e6 * self.earth_ax[2]
            ],
            mutation_scale=8,
            #lw=4,
            arrowstyle="-|>",
            color="k")
        ax2.add_artist(earth_ax_arrow)
        #ax2.text(*xyz_arrow_data[2,:],s="z",fontsize=12)

        sun2ground_vec_arrow = Arrow3D(
            [
                taiwan_position[0] + 6e6 * taiwan_current_z[0],
                taiwan_position[0] + 6e6 * taiwan_current_z[0] +
                6e6 * sun2ground_vec[0]
            ],
            [
                taiwan_position[1] + 6e6 * taiwan_current_z[1],
                taiwan_position[1] + 6e6 * taiwan_current_z[1] +
                6e6 * sun2ground_vec[1]
            ],
            [
                taiwan_position[2] + 6e6 * taiwan_current_z[2],
                taiwan_position[2] + 6e6 * taiwan_current_z[2] +
                6e6 * sun2ground_vec[2]
            ],
            mutation_scale=8,
            #lw=4,
            arrowstyle="-|>",
            color="r")
        ax2.add_artist(sun2ground_vec_arrow)
        #ax2.text(*xyz_arrow_data[2,:],s="z",fontsize=12)

        ground_vec = taiwan_current_z + sun2ground_vec

        ground_vec_arrow = Arrow3D(
            [taiwan_position[0], taiwan_position[0] + 6e6 * ground_vec[0]],
            [taiwan_position[1], taiwan_position[1] + 6e6 * ground_vec[1]],
            [taiwan_position[2], taiwan_position[2] + 6e6 * ground_vec[2]],
            mutation_scale=8,
            #lw=4,
            arrowstyle="-|>",
            color="k")
        ax2.add_artist(ground_vec_arrow)
示例#5
0
ax2.text(*py,
         s=r'$y$',
         fontsize=14,
         verticalalignment='bottom',
         horizontalalignment='right')
ax2.text(*(1.1 * pz),
         s=r'$z$',
         fontsize=14,
         verticalalignment='top',
         horizontalalignment='left')
#ax2.text(*pA, s = r"$A$ at (0.3,0.3,1)", fontsize=14,verticalalignment='bottom', horizontalalignment='left')

midspherex, midspherey, midspherez, midsphereR = 0.5, 0.5, 0.5, 0.5

tool.plot_front(ax2, midspherex, midspherey, midspherez, midsphereR)
tool.plot_back(ax2, midspherex, midspherey, midspherez, midsphereR)

ff = 0.75
Xt, Yt, Zt = zip(po, px, py, pz, pA)  #,ff*plb,ff*ptr,ff*plt,ff*pbr)
X = np.array(Xt)
Y = np.array(Yt)
Z = np.array(Zt)

max_range = np.array([X.max() - X.min(),
                      Y.max() - Y.min(),
                      Z.max() - Z.min()]).max() / 2.0

mid_x = (X.max() + X.min()) * 0.5
mid_y = (Y.max() + Y.min()) * 0.5
mid_z = (Z.max() + Z.min()) * 0.5
ax2.set_xlim3d(mid_x - max_range, mid_x + max_range)
示例#6
0
incenterBCA,inradiusBCA,normvecBCA, _,_,_,= incircle3D(pB,pC,pA)
incircleBCA = circle_full(normvecBCA,
                          (-incenterBCA+pB),
                            inradiusBCA,40) + incenterBCA
ax2.plot(*np.transpose(incircleBCA),linewidth=1,linestyle=':')
incenterDCA,inradiusDCA,normvecDCA, _,_,_,= incircle3D(pD,pC,pA)
incircleDCA = circle_full(normvecDCA,
                          (-incenterDCA+pD),
                            inradiusDCA,40) + incenterDCA
ax2.plot(*np.transpose(incircleDCA),linewidth=1,linestyle=':')

#Plot the midsphere
cx,cy,cz, radius = four_points_circle(pE,pF,pN,pH)
plot_front(ax2,cx,cy,cz,radius)
plot_back(ax2,cx,cy,cz,radius)


ax2.text(*pA, s = r'$A$', fontsize=12,verticalalignment='bottom', horizontalalignment='right')
ax2.text(*pB, s = r'$B$', fontsize=12,verticalalignment='bottom', horizontalalignment='right')
ax2.text(*pC, s = r'$C$', fontsize=12,verticalalignment='top', horizontalalignment='left')
ax2.text(*pD, s = r"$D$", fontsize=12,verticalalignment='top', horizontalalignment='left')
ax2.text(*(pE + (pE-pJ)/10), s = r"$E$", fontsize=12,verticalalignment='bottom', horizontalalignment='center')
ax2.text(*(pF + (pF-pN)/5), s = r"$F$", fontsize=12,verticalalignment='center', horizontalalignment='left')
ax2.text(*pH, s = r"$H$", fontsize=12,verticalalignment='bottom', horizontalalignment='right')
ax2.text(*(pG+(pG-pE)/9), s = r"$G$", fontsize=12,verticalalignment='top', horizontalalignment='center')
ax2.text(*pN, s = r"$N$", fontsize=12,verticalalignment='top', horizontalalignment='left')
ax2.text(*pJ, s = r"$J$", fontsize=12,verticalalignment='top', horizontalalignment='left')
ax2.text(*pK, s = r"$K$", fontsize=12,verticalalignment='top', horizontalalignment='right')
ax2.text(*pI, s = r"$I$", fontsize=12,verticalalignment='bottom', horizontalalignment='right')
ax2.text(*pO, s = r"$O$", fontsize=12,verticalalignment='bottom', horizontalalignment='right')