""" Rham Curve 1 17.07.2019 www.3d-meier.de """ import c4d import random import math import cmath # Variablen und Konstanten Titel = 'Rham Curve 1' # Name N = 1000000 # Anzahl Punkte Nv = 100 # Anzahl Punkte verwerfen dx = 5.50 # Breite Polygon dy = 5.50 # Hoehe Polygon Faktor = 1000 # Skalierungsfaktor 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.5, 0.5) # a = complex(0.3, 0.3) # a = complex(0.2, 0.5) # a = complex(0.40, 0.4) # a = complex(0.50, 0.44) # a = complex(0.61, 0.54) # a = complex(0.45, 0.53) # a = complex(0.55, 0.12) # a = complex(0.21, 0.17) # a = complex(0.66, 0.64) # a = complex(0.0, 0.25) # 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 if zufall == 1: z = a + (1-a)*z for i in xrange(0,N): zufall = random.randint(0,1) if zufall == 0: z = a*z if zufall == 1: z = a + (1-a)*z 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()