""" Rham Curve 3 21.07.2019 www.3d-meier.de """ import c4d import random import math import cmath # Variablen und Konstanten Titel = 'Rham Curve 3' # Name N = 1000000 # Anzahl Punkte Nv = 100 # Anzahl Punkte verwerfen dx = 1.05 # Breite Polygon dy = 1.05 # Hoehe Polygon Faktor = 1000 # Skalierungsfaktor s = math.sqrt(3.0) # Konstante def CreatePolygonObject(): obj = c4d.BaseObject(c4d.Opolygon) obj.ResizeObject(4*N, N) obj.SetName(Titel) # Startwert der Berechnung z = complex(0.50, 0) # Konstante a a = complex(0.46, 0.46) b = complex(0.00, 0.00) c = complex(0.62, -0.20) d = complex(0.00, 0.00) # a = complex(0.00, 0.00) # b = complex(0.30, 0.30) # c = complex(0.00, 0.00) # d = complex(0.82, 0.00) # a = complex(0.00, 0.00) # b = complex(0.50, 0.50) # c = complex(0.00, 0.00) # d = complex(-0.50, 0.50) # a = complex(0.46, 0.46) # b = complex(0.00, 0.00) # c = complex(0.00, 0.00) # d = complex(0.29, -0.59) # a = complex(0.60, 0.50) # b = complex(0.50, 0.20) # c = complex(0.30, -0.22) # d = complex(0.60, -0.30) # a = complex(0.12, 0.93) # b = complex(0.56, 0.15) # c = complex(0.28, 0.41) # d = complex(0.36, 0.22) # a = complex(0.03, 0.82) # b = complex(0.20, 0.29) # c = complex(0.63, 0.03) # d = complex(0.16, 0.36) # a = complex(0.00, 0.40) # b = complex(0.62, 0.65) # c = complex(0.62, 0.26) # d = complex(0.43, 0.16) # a = complex(0.17, 0.24) # b = complex(0.62, 0.22) # c = complex(0.60, 0.56) # d = complex(0.07, 0.07) # a = complex(0.19, 0.56) # b = complex(0.23, 0.64) # c = complex(0.39, 0.88) # d = complex(0.34, 0.39) # a = complex(0.21, 0.53) # b = complex(0.81, 0.33) # c = complex(0.04, 0.69) # d = complex(0.67, -0.63) # a = complex(0.45, 0.61) # b = complex(0.08, 0.20) # c = complex(0.55, 0.47) # d = complex(0.52, -0.07) # a = complex(0.04, 0.37) # b = complex(0.58, 0.61) # c = complex(0.13, -0.41) # d = complex(0.20, -0.38) # a = complex(0.34, 0.13) # b = complex(0.05, 0.44) # c = complex(0.03, -0.19) # d = complex(0.91, -0.09) # a = complex(0.27, -0.64) # b = complex(0.27, -0.06) # c = complex(0.04, -0.40) # d = complex(0.15, -0.07) # 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 = a*z + b*z.conjugate() if zufall == 1: z = c*(z-1) + d*(z.conjugate()-1) + 1 for i in xrange(0,N): zufall = random.randint(0,1) if zufall == 0: z = a*z + b*z.conjugate() if zufall == 1: z = c*(z-1) + d*(z.conjugate()-1) + 1 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 main(): plyobj = CreatePolygonObject() # doc.InsertObject(plyobj, None, None, True) c4d.EventAdd() if __name__=='__main__': main()