def __init__(self): self.radius = 2 self.vel = rg.Vector3d(random.uniform(-1,1), random.uniform(-1,1), random.uniform(-1,1)) self.vel.Unitize() self.vel *= 3 self.attr = rc.DocObjects.ObjectAttributes() self.attr.ColorSource = rc.DocObjects.ObjectColorSource.ColorFromObject self.attr.ObjectColor = color.ColorBetweenColors(drawing.Color.Red, drawing.Color.White, random.uniform(0,1)) self.attr.MaterialSource = rc.DocObjects.ObjectMaterialSource.MaterialFromObject index = sc.doc.Materials.Add() self.mat = sc.doc.Materials[index] self.mat.DiffuseColor = self.attr.ObjectColor self.mat.CommitChanges() self.attr.MaterialIndex = index self.pos = geo.RandomPoint(self.radius, 100-self.radius, self.radius, 100-self.radius, self.radius, 100-self.radius) #self.sphere = rg.Sphere(self.pos, self.radius) self.xSize = rg.Interval(-self.radius, self.radius) self.ySize = rg.Interval(-self.radius, self.radius) self.zSize = rg.Interval(-self.radius, self.radius) self.plane = rg.Plane.WorldXY self.plane.Origin = self.pos #self.plane.XAxis = self.vel self.box = rg.Box(self.plane, self.xSize, self.ySize, self.zSize) self.boxID = sc.doc.Objects.AddBox(self.box, self.attr)
def __init__(self, system): self.system = system self.radius = 2 self.size = 4 self.vel = rg.Vector3d(random.uniform(-1, 1), random.uniform(-1, 1), random.uniform(-.3, .3)) self.vel.Unitize() self.speed = random.uniform(1, 2) self.vel *= self.speed self.acc = rg.Vector3d(0, 0, 0) self.attr = rc.DocObjects.ObjectAttributes() self.attr.ColorSource = rc.DocObjects.ObjectColorSource.ColorFromObject self.attr.ObjectColor = color.ColorBetweenColors( drawing.Color.DeepSkyBlue, drawing.Color.LimeGreen, random.uniform(0, 1)) self.attr.MaterialSource = rc.DocObjects.ObjectMaterialSource.MaterialFromObject index = sc.doc.Materials.Add() self.mat = sc.doc.Materials[index] self.mat.DiffuseColor = self.attr.ObjectColor self.mat.CommitChanges() self.attr.MaterialIndex = index self.pos = geo.RandomPoint(self.size * 2, 100 - self.size * 2, self.size * 2, 100 - self.size * 2, self.size * 2, 100 - self.size * 2) self.xSize = rg.Interval(-self.size * .25, self.size * .25) self.ySize = rg.Interval(-self.size * .125, self.size * .125) self.zSize = rg.Interval(-self.size, self.size) up = rg.Vector3d(0, 0, 1) xvec = rg.Vector3d.CrossProduct(self.vel, rg.Vector3d(0, 0, 1)) yvec = rg.Vector3d.CrossProduct(self.vel, xvec) self.plane = rg.Plane(self.pos, yvec, xvec) self.box = rg.Box(self.plane, self.xSize, self.ySize, self.zSize) #self.boxID = sc.doc.Objects.AddBox(self.box, self.attr) self.srfIDs = [] self.connectionIDs = []
def __init__(self, system, x, y, row, col): self.system = system self.row = row self.col = col self.nUp = None self.nDown = None self.nLeft = None self.nRight = None #self.m = rg.Mesh() #self.mID = None #p.noise3(util.Remap(self.pos.X, 0, 100, 0, 1), util.Remap(self.pos.Y, 0, 100, 0, 1), system.time*.05) #self.perlin = p.noise3() #perlin.SimplexNoise #Movement self.vel = rg.Vector3d(0,0, random.uniform(-.3,.3)) self.vel.Unitize() self.speed = random.uniform(1, 2) self.vel *= self.speed self.acc = rg.Vector3d(0,0,0) self.size = 2 #Color and material self.attr = rc.DocObjects.ObjectAttributes() self.attr.ColorSource = rc.DocObjects.ObjectColorSource.ColorFromObject self.attr.ObjectColor = color.ColorBetweenColors(drawing.Color.DeepSkyBlue, drawing.Color.LimeGreen, random.uniform(0,1)) self.attr.MaterialSource = rc.DocObjects.ObjectMaterialSource.MaterialFromObject index = sc.doc.Materials.Add() self.mat = sc.doc.Materials[index] self.mat.DiffuseColor = self.attr.ObjectColor self.mat.CommitChanges() self.attr.MaterialIndex = index #Position self.pos = rg.Point3d(x, y, 10) #Bake self.ids = []
def __init__(self, system): self.system = system self.neigh0 = None self.neigh1 = None self.neigh2 = None self.neigh3 = None self.val = None #self.m = rg.Mesh() #self.mID = None #Movement self.vel = rg.Vector3d(0, 0, random.uniform(-.3, .3)) self.vel.Unitize() self.speed = random.uniform(1, 2) self.vel *= self.speed self.acc = rg.Vector3d(0, 0, 0) self.size = 2 #Color and material self.attr = rc.DocObjects.ObjectAttributes() self.attr.ColorSource = rc.DocObjects.ObjectColorSource.ColorFromObject self.attr.ObjectColor = color.ColorBetweenColors( drawing.Color.DeepSkyBlue, drawing.Color.LimeGreen, random.uniform(0, 1)) self.attr.MaterialSource = rc.DocObjects.ObjectMaterialSource.MaterialFromObject index = sc.doc.Materials.Add() self.mat = sc.doc.Materials[index] self.mat.DiffuseColor = self.attr.ObjectColor self.mat.CommitChanges() self.attr.MaterialIndex = index #Position self.pos = rg.Point3d(random.uniform(5, 95), random.uniform(5, 95), random.uniform(5, 95)) self.sphere = rg.Sphere(self.pos, 2) #Bake self.ids = [] self.ids.append(sc.doc.Objects.AddSphere(self.sphere, self.attr))
def __init__(self): self.radius = 2 self.vel = rg.Vector3d(random.uniform(-1, 1), random.uniform(-1, 1), random.uniform(-.5, 1)) self.vel.Unitize() self.vel *= random.uniform(2, 5) self.acc = rg.Vector3d(0, 0, -.3) self.attr = rc.DocObjects.ObjectAttributes() self.attr.ColorSource = rc.DocObjects.ObjectColorSource.ColorFromObject self.attr.ObjectColor = color.ColorBetweenColors( drawing.Color.DeepSkyBlue, drawing.Color.LimeGreen, random.uniform(0, 1)) self.attr.MaterialSource = rc.DocObjects.ObjectMaterialSource.MaterialFromObject index = sc.doc.Materials.Add() self.mat = sc.doc.Materials[index] self.mat.DiffuseColor = self.attr.ObjectColor self.mat.CommitChanges() self.attr.MaterialIndex = index #self.pos = geo.RandomPoint(self.radius, 100-self.radius, self.radius, 100-self.radius, self.radius, 100-self.radius) self.pos = rg.Point3d(50, 50, 80) #self.sphere = rg.Sphere(self.pos, self.radius) self.xSize = rg.Interval(-self.radius * .5, self.radius * .5) self.ySize = rg.Interval(-self.radius * .125, self.radius * .125) self.zSize = rg.Interval(-self.radius, self.radius) #self.plane = rg.Plane.WorldXY #self.plane.Origin = self.pos self.plane = rg.Plane(self.pos, self.vel) #self.plane.XAxis = self.vel self.box = rg.Box(self.plane, self.xSize, self.ySize, self.zSize) self.boxID = sc.doc.Objects.AddBox(self.box, self.attr)