Skip to main content

Package to rotate 2D and 3D curves

Project description

rotplot

Package to rotate 3D surfaces and 3D curves

Rot3DSurf

Fonction that rotate a three-dimensional surface by an user-defined angle, and around an axis.

Rot3DSurf(surf3D,angle,nR)

surf3D : Equation of the surface 
nR = 0 Rotation around the x axis
nR = 1 Rotation around the y axis
nR = 2 Rotation around the z axis   

Rot3D

Fonction that rotate a two-dimensional surface (like an ellipse in space) by an user-defined angle, and around a given axis.

Rot3D(surf,angle,nR)

surf : Equation of the 3D curve 
nR = 0 Rotation around the x axis
nR = 1 Rotation around the y axis
nR = 2 Rotation around the z axis   

Examples

import sys
sys.path.append(".")

from rotplot.rotplot import rot_3D, rot_3D_surf

from mpl_toolkits.mplot3d import Axes3D 

import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['legend.fontsize'] = 10


fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_axis_on()
ax.set_xlim(-20, 20)
ax.set_ylim(-20, 20)

a=5
b=3.4
c = np.sqrt(a**2 - b**2)
R=a


u = np.linspace(0, 2*np.pi, 100)
v = np.linspace(-1, 1.73, 100)
U,V = np.meshgrid(np.linspace(0, 2*np.pi, 100),np.linspace(-1.5, 1.5, 100))

Cyclide=[-c*np.cosh(V)+( (-4+a*np.cosh(V))*(-a*np.cos(U)+c*np.cosh(V)) )/( -c*np.cos(U) + a*np.cosh(V) ),
    ( b*( -4 + a*np.cosh(V) ) * np.sin(U) ) / ( -c*np.cos(U) + a* np.cosh(V)  ),
    b*np.sinh(V) - ( b*( -4 +a*np.cosh(V) )*np.sinh(V) ) / ( -c * np.cos(U) + a*np.cosh(V)  )]

Ellipse=[a * np.cos(u),  b*np.sin(u),np.zeros(len(u))]

ax.plot_surface(Cyclide[0], Cyclide[1], Cyclide[2])
ax.plot(Ellipse[0], Ellipse[1], Ellipse[2])


#Rotation :
Ellipse_rot=rot_3D(Ellipse,180,1)
Cyclide_rot=rot_3D_surf(Cyclide,180,1)

ax.plot_surface(Cyclide_rot[0], Cyclide_rot[1], Cyclide_rot[2])
ax.plot(Ellipse_rot[0], Ellipse_rot[1], Ellipse_rot[2])
plt.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rotplot-0.0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rotplot-0.0.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file rotplot-0.0.1.tar.gz.

File metadata

  • Download URL: rotplot-0.0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for rotplot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 59155245f37c5998880ccd051826983aac9d59efc96e29895cbc6ade50e0a583
MD5 e764319c4083f4c0a06c2d4f2b519630
BLAKE2b-256 836f8cf37401e45cf104f698407a4c0ccd89a08c237489840e182cc1a75e5a7c

See more details on using hashes here.

File details

Details for the file rotplot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rotplot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for rotplot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 049a8884ed7a344af6c3dc70cfe59a77bd63b20c0e34562df91444f399ae70f3
MD5 3a2532d12d304ee8f05b3df47672beae
BLAKE2b-256 9a2bd25a2dee430617927bb47666c4709b2930b5fc2fd252acb7869bc8e0611a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page