class Point:
x=0.0
y=0.0
def affichage(self):
print(f"({self.x},{self.y})")
def initialiser(self,nvx,nvy):
self.x=nvx
self.y=nvy
def deplacer(self,dx,dy):
self.x=self.x+dx #self.x+=dx
self.y=self.y+dy
return self.x,self.y
#Creer les instance
p1=Point()
[Link](2,3)
p2=Point()
p2.x=4
p2.y=3
[Link]()
[Link]()
t=[Link](2,4)
[Link]()
a=2
print(isinstance(p1,Point))#True
# print(isinstance(p2,Personne))#False
#---Manipulation-----
# listPoints=[]
# nombrePoints=int(input("Saisir le nombre de points"))
# for i in range(nombrePoints):
# x=float(input("saisir x"))
# y = float(input("saisir y"))
# pt=Point()
# [Link](x,y)
# [Link](pt)
# #affichage
# for i in range(len(listPoints)):
# print("Point numero ",i+1)
# listPoints[i].affichage()
from math import *
class Vecteur3D:
def __init__(self,nx,ny,nz):
self.x=nx
self.y=ny
self.z=nz
def affichage(self):
print(f"<{self.x},{self.y},{self.z}>")
def nomre(self):
return sqrt(self.x**2+self.y**2+self.z**2)
def somme(self,v1):
somx=self.x+v1.x
somy=self.y+v1.y
somz=self.z+v1.z
Vsomm=Vecteur3D(somx,somy,somz)
return Vsomm
def produitSclaire(self,v1):
res=self.x*v1.x+self.y*v1.y+self.z*v1.z
return res
v1=Vecteur3D(2,3,1)
v2=Vecteur3D(1,1,5)
[Link]()
[Link]()
V=[Link](v2)
[Link]()
produitS=[Link](v2)
print(produitS)
print([Link]())
print([Link]())