very cool thanks
mrrouge
@mrrouge
Best posts made by mrrouge
Latest posts made by mrrouge
-
RE: Random Lines with no intersection
hey thanks for the answer
but its not totally what i meant
if I had to reformulate it now i would have asked for a function which scans the previous one and creates a random pair of legs "on top" of the other and places it without intersections ans rescans the newly created one again and again .
the basic "idea" of the sketch was how i wanted it
but the lines were too chaotici hope my text is not too incomprehensible
regards David
-
Random Lines with no intersection
Hi its me again with another problem
newPage(2000, 2000) xMiddle = 2000/2 yMiddle = 2000/2 strokeWidht=2 g1=randint (20,100) g2=randint (500,900) g3=randint (20,100) g4=randint (20,100) g5=randint (20,100) w=1 h=1 def legs (x,y,w,h): scale(w, h) newPath() stroke(0) fill(None) strokeWidth(strokeWidht) polygon ((0,0),(g2,0),(g2,-g3),(g4,-g5),(g1,-g2),close=False) def legs2 (x,y,w,h): scale(w, h) newPath() stroke(0) fill(None) strokeWidth(strokeWidht) polygon ((0,0),(-g2,0),(-g2,-g3),(-g4,-g5),(-g1,-g2),close=False) # def wing (x,y): # newPath() # stroke(None) # fill(0,0,20, 0.5) # blendMode('exclusion') # strokeWidth(strokeWidht) # polygon ((0,29),(g2,g5),(g2,-g3),(g4,-g5),(g1,-g2),close=True) translate(xMiddle,yMiddle) rect(-20,-3,40,40) # wing(0,0) for i in range(4): g1=randint (20,100) g2=randint (20,644) g3=randint (20,100) g4=randint (20,100) g5=randint (20,100) translate (0,+i+5) legs(0,0,w,h) legs2(-0,-0,w,h)
I wrote this code which generates "legs "randomly
now Iam looking to generate these randomly without them intersecting each othersMaybe one of you have a little hint for me
Greetings David
-
RE: determine centerpoint in irregular rectangle / create "composition"
@gferreira said in determine centerpoint in irregular rectangle / create "composition":
def myShape(x, y, w, h):
save()
translate(x, y)
scale(w, h)
newPath()
moveTo((0., 0.0))
lineTo((1.0, 0.0))
curveTo((0.7, 0.3), (0.7, 0.7), (1.0, 1.0))
lineTo((0, 1.0))
closePath()
drawPath()
restore()newPage(500, 500)
xMiddle = width()/2
yMiddle = height()/2shapeWidth, shapeHeight = 354, 242
shapeX = xMiddle - shapeWidth/2
shapeY = yMiddle - shapeHeight/2myShape(shapeX, shapeY, shapeWidth, shapeHeight)
Thanks Mister Ferreira
for your quick and detailed answercan I ask you why suddenly everything is now in decimal numbers ?
this is the only thing i didnt really understandBest regards David
-
determine centerpoint in irregular rectangle / create "composition"
Hi Iam still learning the basics and i have a new problem !
I drew a rectangle using lineTo commands and curveTo commands
and I managed to center it but I wanted to ask if there is a way to treat the 4 commands more like a group or rect without loosing the ability to control the handles.the only solution i found was to return a distance value for each point
thanks a lot
regards david
for i in range(1) : newPage (5000,5000) xMiddle, yMiddle = 2500, 2500 # mitte stroke(0) fill(0) translate(xMiddle, yMiddle) for i in range(1): #Body translate (-450,450) stroke() # create a new empty path newPath() # set the first oncurve point moveTo((-0, -0)) # line to from the previous point to a new point curveTo((74, -362), (-106, -360),(-0, -900)) lineTo((900, -900)) curveTo((162, -290), (450, -292),(900,-0)) # curve to a point with two given handles # close the path closePath() # draw the path drawPath()
-
RE: Hi can somebody help me randomize shapes within a loop ?
Cool thanks for your help !
Iam really struggling to find the right information in the reference -
Hi can somebody help me randomize shapes within a loop ?
Hi Community
I would wish that every shape in the loop is unique and not repeatedis that somehow possible ?
cheers davidsize(2000,2000) x,y=1000,1000 ranp1= randint(-1000,1000) ranp2=randint(-1000,1000) ranp3=randint(-1000,1000) ranp4=randint(-1000,1000) ranp5=randint(-1000,1000) ranp6=randint(-1000,1000) ranp7=randint(-1000,1000) ranp8=randint(-1000,1000) ranp9=randint(-1000,1000) ranp10=randint(-1000,1000) ranp11=randint(-1000,1000) ranp12=randint(-1000,1000) ranp13=randint(-1000,1000) ranp14=randint(-1000,1000) ranpc=randint(-1000,1000) ranpc1=randint(-1000,1000) ranpc2=randint(-1000,1000) distance = 22 translate(x, y) for i in range (43): translate(0,+i*distance) fill(ranpc,ranpc1,ranpc2,0.2) # create a new empty path newPath() # set the first oncurve point moveTo((0, 0)) # line to from the previous point to a new point lineTo((ranp1, ranp2)) lineTo((ranp4, ranp5)) # curve to a point with two given handles curveTo((ranp6, ranp7), (ranp8, ranp9), (ranp10, ranp11)) # close the path closePath() # draw the path drawPath()
-
Moving Anchor point of a Primitive to its middle ?
Hi
I think I have a easy to solve problem
can somebody tell me how to center an anchor point to the "ovals" middle ?
and is there a trick to move a primitive itself to the middle of the canvas ?
I appreciate every help
thank you