Code for plotting ellipsoids


In [1]:
%matplotlib inline

In [2]:
import matplotlib.pyplot as plt
import numpy as np
import mesher

In [3]:
import plot_functions as pfun

3D models


In [4]:
# orientation angles (in degrees)
strike = 34
dip = 60
rake = 10

In [5]:
triaxial = mesher.TriaxialEllipsoid(0, -20, 0, 15, 10, 4, strike, dip, rake)
prolate = mesher.ProlateEllipsoid(0, 0, 0, 15, 4, strike, dip, rake)
oblate = mesher.OblateEllipsoid(0, 20, 0, 4, 15, strike, dip, rake)

Test


In [6]:
plt.close('all')
fig = plt.figure(figsize=(10,8))
ax = fig.gca(projection='3d')

pfun.limits(ax, -40, 40, -40, 40, -40, 40)

pfun.draw_axes(ax, triaxial, axes_color='r')
pfun.draw_ellipsoid(ax, triaxial, 'r', 0.3)

pfun.draw_axes(ax, prolate, axes_color='g')
pfun.draw_ellipsoid(ax, prolate, 'g', 0.3)

pfun.draw_axes(ax, oblate, axes_color='b')
pfun.draw_ellipsoid(ax, oblate, 'b', 0.3)

ax.set_xlabel('x (m)')
ax.set_ylabel('y (m)')
ax.set_zlabel('z (m)')

ax.view_init(215, 20)

plt.tight_layout()

plt.show()