""" Rham Curve 4 31.07.2019 www.3d-meier.de """ import c4d import random import math import cmath # Variablen und Konstanten Titel = 'Rham Curve 4' # Name N = 1000000 # Anzahl Punkte Nv = 100 # Anzahl Punkte verwerfen dx = 0.002 # Breite Polygon dy = 0.002 # Hoehe Polygon Faktor = 1000 # Skalierungsfaktor def CreatePolygonObject(): obj = c4d.BaseObject(c4d.Opolygon) obj.ResizeObject(4*N, N) obj.SetName(Titel) # Startwerte Berechnung x = 0.5 y = 0.5 # Konstanten a = 0.50 b = 1.00 c = 0.25 d = -0.47 e = -0.25 f = -0.47 # c = 0.25 # d = -0.25 # e = -0.25 # f = -0.25 # c = 0.25 # d = 0.00 # e = -0.25 # f = 0.00 # c = 0.18 # d = -0.38 # e = -0.18 # f = -0.42 # c = 0.49 # d = -0.38 # e = 0.10 # f = -0.42 # c = 0.03 # d = -0.26 # e = -0.24 # f = -0.47 # c = -0.21 # d = 0.44 # e = -0.45 # f = -0.27 # c = 0.08 # d = -0.71 # e = 0.03 # f = -0.63 # c = -0.02 # d = -0.38 # e = 0.01 # f = 0.25 # c = 0.62 # d = -0.29 # e = -0.04 # f = 0.30 # c = 0.52 # d = -0.02 # e = 0.14 # f = -0.96 # c = -0.11 # d = -0.68 # e = 0.03 # f = 0.25 # c = 0.36 # d = -0.08 # e = -0.22 # f = 0.43 # c = 0.59 # d = -0.06 # e = -0.14 # f = 0.60 # c = -0.30 # d = 0.15 # e = -0.09 # f = 0.23 # c = -0.23 # d = -0.61 # e = 0.74 # f = 0.45 # c = 0.42 # d = -0.39 # e = -0.02 # f = -0.23 # c = 0.45 # d = -0.51 # e = -0.26 # f = 0.08 # c = 0.44 # d = -0.21 # e = -0.45 # f = -0.27 # a = 0.45 # b = 0.09 # c = 0.57 # d = 0.12 # e = -0.41 # f = -0.33 # a = 0.26 # b = 0.54 # c = -0.18 # d = 0.32 # e = 0.68 # f = 0.25 # a = 0.48 # b = 0.31 # c = -0.35 # d = 0.71 # e = -0.66 # f = -0.53 # a = 0.99 # b = 0.45 # c = -0.67 # d = -0.31 # e = 0.45 # f = 0.37 # a = 0.81 # b = 0.66 # c = -0.16 # d = -0.13 # e = 0.40 # f = 0.62 # a = 1.00 # b = 0.12 # c = -0.72 # d = 0.62 # e = -0.95 # f = 0.74 # a = 0.12 # b = 0.16 # c = -0.59 # d = -0.89 # e = 0.26 # f = -0.95 # 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: xa = x x = a*xa + c*y y = b*xa + d*y if zufall == 1: xa = x x = a + (1-a)*xa + e*y y = b - b*xa + f*y for i in xrange(0,N): zufall = random.randint(0,1) if zufall == 0: xa = x x = a*xa + c*y y = b*xa + d*y if zufall == 1: xa = x x = a + (1-a)*xa + e*y y = b - b*xa + f*y 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()