Beispiel #1
0
 def __init__(self, CentreDeMasse=V3D(), masse=0., EffortsExt=[]):
     self.CentreDeMasse = CentreDeMasse
     self.masse = masse
     self.Poids = Torseur(CentreDeMasse, V3D(0, 0, -masse * 9.8), V3D())
     self.Poids.chgPt()
     self.EffortsExt = EffortsExt + [self.Poids]
     self.EffortLiaison = Torseur()
     self.equilibre()
Beispiel #2
0
#~ def EnfantstoTorseur():
#~ for enfant in self.Enfants:
#~ position = self.Enfants[enfant]
#~ if len(enfant.Enfants) = 0:
#~ S = Torseur()
#~ S.P = position
#~ S.R = -enfant.EffortLiaison.R
#~ S.P = -enfant.EffortLiaison.P

#~ else :
#~ enfant.EnfantstoTorseur()

if __name__ == "__main__":  # false lors d'un import

    P1 = V3D(y=3)
    R1 = V3D(1, 2, 3)
    M1 = V3D(3, 2, 3)

    P2 = V3D()
    R2 = V3D(4, 1, 3)
    M2 = V3D(3, 0, 3)

    T1 = Torseur(P1, R1, M1)
    T0 = Torseur()
    T2 = Torseur(P2, R2, M2)

    S0 = SolideEncastre(masse=10)

    S0.ajoutFEXT(T1)
Beispiel #3
0
 def __init__(self, nom='sat', mass=1, pos=V3D(), vit=V3D(), accel=V3D()):
     self.nom = nom
     self.pos = [pos]
     self.vit = [vit]
     self.accel = [accel]
     self.mass = mass
Beispiel #4
0
 def setForce(self, Force=V3D()):
     self.accel.append(Force / self.mass)
Beispiel #5
0
        print("on peut faire autre chose sans attendre la fermeture du plot")

        for i in range(1000):

            plt.cla()  # Efface le contenu # On recalcule tout
            ax = fig.gca(projection='3d')
            X = []
            Y = []
            Z = []

            for j in self.pos:
                X.append(j.x)
                Y.append(j.y)
                Z.append(j.z)
            plt.plot(X, Y, Z)
            ax.plot(X, Y, Z, c='red')  #, marker='o')
            fig.canvas.flush_events()  # on affiche
        input("Press a key"
              )  # pour empecher la fin du programme et fermeture du plot


if __name__ == "__main__":  # false lors d'un import

    Voyager = particule(mass=1, vit=V3D(0, 9, 500))

    for i in range(10000):
        Voyager.setForce(V3D(0, 0, -Voyager.mass * 9.8))
        Voyager.simule(.01)

    Voyager.trace()
Beispiel #6
0
from Vecteur3D import Vecteur3D as V3D
import math

theta = input('Rotation de visée !:')
theta = float (theta)

elevation = input('Aaaaangle de tiiiir ?! :')
elevation = float(elevation)

force = input('Puissance du tir mon capitaine ? :')
force = float(force)

coeff = input('coefficient de trainée :')
coeff = float(coeff)

V0 = force * V3D(math.cos(theta) * math.cos(elevation), math.sin(theta), math.sin(elevation)).norm()

LimiteX = 10
LimiteZ = 0
LimiteY = 12

class Tirs(object):

    Particules=[]

    def __init__(self,nom):
        self.nom=nom

    def ajoutParticule(self,P=part()):
        self.Particules.append(P)
Beispiel #7
0
import math

theta = input('Rotation de visée !:')
theta = float(theta)

elevation = input('Aaaaangle de tiiiir ?! :')
elevation = float(elevation)

force = input('Puissance du tir mon capitaine ? :')
force = float(force)

coeff = input('coefficient de trainée :')
coeff = float(coeff)

V0 = force * V3D(
    math.cos(theta) * math.cos(elevation), math.sin(theta),
    math.sin(elevation)).norm()

boulet = part(mass=10, pos=V3D(0, 0, 1.5), vit=V0)

LimiteX = 10
LimiteZ = 0
LimiteY = 12

for i in range(600):
    if boulet.pos[-1].z < LimiteZ:
        boulet.chocz(coeff)

    if boulet.pos[-1].x > LimiteX:
        boulet.chocx(coeff)