Help with complex homework(Solved)

Yeah and alpha (how dark the leafs look)

I leave you alone with that now, but good job!

Also, welcome to the forum!

Warm Regards,

Chrisir :wink:

P.S. you could also add something to the position (+random(-9,9)); in fact, the initial image from your teacher might suggest there is in fact a small ring in the center the leafs grow out of, because the leafs don’t really touch in the center. But that is only speculation.

2 Likes

thank you very much and I was hoping if you’re able to help me with another later around 6:30 pm today. If possible.

1 Like

post a new discussion then, it depends a bit of the time zone.

I or others will help.

:wink:

1 Like

thank you very much hope you have a great day.

1 Like

The angle

when we pass i as the angle to the function it is from 0 to 71

since rotate expects the angle in radians (between 0 and 2 PI)
we should say rotate(radians(angle)) - but the the call with i doesn’t make sense then anymore.

You can use i * (360 / 72) for example or random(360) I think

not tested

1 Like

Hello @Onipunch777,

There are tutorials, resources and examples here:

I would look up the references for each of these to understand each element of the code:

setup()
size()
noLoop()
draw()
background()
noStroke()
for()
*fill()
*translate()
*rotate()
*scale()
beginShape
vertex()
bezierVertex()
endShape
popMatrix()

There is a lot there to absorb so focus on the *missing elements.

There are tutorials and examples that piece it all together.

Part of learning to code is understanding the flow of the program and each element of your code.
I use the Processing resources and references all the time and learn something new with each visit.

If you are using the Processing IDE (3.5.4 or 4) use can also right click on a keyword and select “Find in Reference”. The website is updated and may have more links and visuals with examples.

:)

In this case adding a random(-9, 9) to x or y will offset the center of rotation randomly.

I’ll stop there and will not share any examples for this homework topic.

Less is more… especially when helping beginners and especially so for a homework question.

In general, you can modify all the elements of the shape; the variables that you are passing and inside the function.

New programmers need to engage their brains and focus on the immediate task and learning outcomes. Speculation with a specific case may lead them down the wrong path and not achieve the expected results… exploration on the other hand is an adventure.

There is a lot that can be done with this basic code to create cool effects; this may be part of the homework exercise.

This is just using the original code and a few tweaks to modify scale (with a factor) and the use of random() for other elements of the flower without an offset to x or y:

image

I have made the mistake of providing to much help and usually throttle back these days and temper my enthusiasm… less is more. How much I volunteer to help very much depends on the participant, their experience and how much they are engaging in the topic.

:)