""" Hata Kurve 13.10.2019 www.3d-meier.de """ import c4d import random import math import cmath # Variablen und Konstanten Titel = 'Hata Kurve ' # Name N = 1000000 # Anzahl Punkte Nv = 10 # Anzahl Punkte verwerfen dx = 1.10 # Breite Polygon dy = 1.10 # Hoehe Polygon Faktor = 1000 # Skalierungsfaktor # Eckpunkte A1= complex(0, 0) A2= complex(5, -2)/8 A3= complex(3, -1)/4 A4= complex(1, 0) A5= complex(1, 1)/2 A6= complex(1, 2)/4 A7= complex(3, 7)/16 print(A1) print(A2) print(A3) print(A4) print(A5) print(A6) print(A7) print("------------------") print(complex(1, 1)*A1.conjugate()/2.0) print((A6.conjugate() + 1)/2.0) print((A5.conjugate() + 1)/2.0) print((A4.conjugate() + 1)/2.0) print(complex(1, 1)*A4.conjugate()/2.0) print(complex(1, 1)*A3.conjugate()/2.0) print(complex(1, 1)*A2.conjugate()/2.0) print("------------------") print(complex(1, 1)*A5.conjugate()/2.0) print(complex(1, 1)*A6.conjugate()/2.0) print(complex(1, 1)*A7.conjugate()/2.0) print((A1.conjugate() + 1)/2.0) print((A2.conjugate() + 1)/2.0) print((A3.conjugate() + 1)/2.0) A8= complex(3, -1)/8 A9= complex(5, -2)/16 A10= complex(13, 2)/16 A11= complex(7, 1)/8 print("------------------") print(complex(1, 1)*A8.conjugate()/2.0) print(complex(1, 1)*A9.conjugate()/2.0) print(complex(1, 1)*A10.conjugate()/2.0) print(complex(1, 1)*A11.conjugate()/2.0) print((A8.conjugate() + 1)/2.0) print((A9.conjugate() + 1)/2.0) print((A10.conjugate() + 1)/2.0) print((A11.conjugate() + 1)/2.0) A12= complex(1, 2)/8 A13= complex(3, 7)/32 A14= complex(15, 11)/32 A15= complex(4, 3)/8 A16= complex(11, 1)/16 A17= complex(21, 2)/32 A18= complex(29, -2)/32 A19= complex(30, -2)/32 print("------------------") print(complex(1, 1)*A12.conjugate()/2.0) print(complex(1, 1)*A13.conjugate()/2.0) print(complex(1, 1)*A14.conjugate()/2.0) print(complex(1, 1)*A15.conjugate()/2.0) print(complex(1, 1)*A16.conjugate()/2.0) print(complex(1, 1)*A17.conjugate()/2.0) print(complex(1, 1)*A18.conjugate()/2.0) print(complex(1, 1)*A19.conjugate()/2.0) print("------------------") print((A12.conjugate() + 1)/2.0) print((A13.conjugate() + 1)/2.0) print((A14.conjugate() + 1)/2.0) print((A15.conjugate() + 1)/2.0) print((A16.conjugate() + 1)/2.0) print((A17.conjugate() + 1)/2.0) print((A18.conjugate() + 1)/2.0) print((A19.conjugate() + 1)/2.0) A20= complex(3, -1)/16 A21= complex(5, -2)/32 A22= complex(13, 2)/32 A23= complex(14, 2)/32 A24= complex(6, 5)/16 A25= complex(23, 19)/64 A26= complex(27, 31)/64 A27= complex(14, 16)/32 print("------------------") print(complex(1, 1)*A20.conjugate()/2.0) print(complex(1, 1)*A21.conjugate()/2.0) print(complex(1, 1)*A22.conjugate()/2.0) print(complex(1, 1)*A23.conjugate()/2.0) print(complex(1, 1)*A24.conjugate()/2.0) print(complex(1, 1)*A25.conjugate()/2.0) print(complex(1, 1)*A26.conjugate()/2.0) print(complex(1, 1)*A27.conjugate()/2.0) print("------------------") print((A20.conjugate() + 1)/2.0) print((A21.conjugate() + 1)/2.0) print((A22.conjugate() + 1)/2.0) print((A23.conjugate() + 1)/2.0) print((A24.conjugate() + 1)/2.0) print((A25.conjugate() + 1)/2.0) print((A26.conjugate() + 1)/2.0) print((A27.conjugate() + 1)/2.0) B1= complex(1, 0)/2 print("------------------") print(complex(1, 1)*B1.conjugate()/2.0) print((B1.conjugate() + 1)/2.0) B2= complex(1, 1)/4 B3= complex(3, 0)/4 print("------------------") print(complex(1, 1)*B2.conjugate()/2.0) print(complex(1, 1)*B3.conjugate()/2.0) print((B2.conjugate() + 1)/2.0) print((B3.conjugate() + 1)/2.0) def CreatePolygonObject(): obj = c4d.BaseObject(c4d.Opolygon) obj.ResizeObject(4*N, N) obj.SetName(Titel) # Startwert der Berechnung z = complex(0.50, 0.50) # Zähler für Punkte setzten zz = 0 # Zähler für Polygone setzten zzz = 0 for i in xrange(0,Nv): zufall = random.randint(0,1) if zufall == 0: z = complex(1, 1)*z.conjugate()/2.0 if zufall == 1: z = (z.conjugate() + 1)/2.0 for i in xrange(0,N): zufall = random.randint(0,1) if zufall == 0: z = complex(1, 1)*z.conjugate()/2.0 if zufall == 1: z = (z.conjugate() + 1)/2.0 x = z.real*Faktor y = z.imag*Faktor obj.SetPoint(zz, c4d.Vector((x-dx/2.0),(y+dy/2.0),0)) zz=zz+1 obj.SetPoint(zz, c4d.Vector((x-dx/2.0),(y-dy/2.0),0)) zz=zz+1 obj.SetPoint(zz, c4d.Vector((x+dx/2.0),(y+dy/2.0),0)) zz=zz+1 obj.SetPoint(zz, c4d.Vector((x+dx/2.0),(y-dy/2.0),0)) zz=zz+1 obj.SetPolygon(zzz, c4d.CPolygon(zz-1,zz-2,zz-4,zz-3)) zzz=zzz+1 obj.Message(c4d.MSG_UPDATE) return obj def CreateSplineObject(): obj = c4d.BaseObject(c4d.Ospline) # Splineobjekt erzeugen obj.ResizeObject(7) # Groesse des Spline obj.SetPoint(0, c4d.Vector(A1.real*Faktor, A1.imag*Faktor, 0)) obj.SetPoint(1, c4d.Vector(A2.real*Faktor, A2.imag*Faktor, 0)) obj.SetPoint(2, c4d.Vector(A3.real*Faktor, A3.imag*Faktor, 0)) obj.SetPoint(3, c4d.Vector(A4.real*Faktor, A4.imag*Faktor, 0)) obj.SetPoint(4, c4d.Vector(A5.real*Faktor, A5.imag*Faktor, 0)) obj.SetPoint(5, c4d.Vector(A6.real*Faktor, A6.imag*Faktor, 0)) obj.SetPoint(6, c4d.Vector(A7.real*Faktor, A7.imag*Faktor, 0)) obj[c4d.SPLINEOBJECT_CLOSED] = True obj.SetName("Hüllkurve") obj.Message(c4d.MSG_UPDATE) return obj def main(): plyobj = CreatePolygonObject() slinobj = CreateSplineObject() doc.InsertObject(plyobj, None, None, True) doc.InsertObject(slinobj, None, None, True) c4d.EventAdd() if __name__=='__main__': main()