This is a continuation on a series of POV-ray posts all focused on the Pysanky decoration of egg shapes. An attempt to represent the drop pull method of wax application to the egg is the subject of this post. To represent this I've borrowed some work on flower shapes from a previous post and added a simple methodology for extending the flower in a simple V shape lengthwise:

"""

Returns list of x, y coordinates that correspond

to the equation of the form

factorr * r * r = (trigfunc(factortheta * theta)) ** 2

theta will be incremented by step.

start is the first value of theta.

stop is the last value of theta.

Shape starts and ends at startend, preferably a

coordinate along the POV-ray z axis in the

direction negative of the other points.

"""

coords = [startend]

theta = start

while theta < stop:

coords.append(getcoords(theta, factorr, factortheta, trigfunc))

theta += step

coords.append(getcoords(stop, factorr, factortheta, trigfunc))

coords.append(startend)

return coords

The head of the shape is formed by the equation

r ** 2 = (math.cos(2.0 * theta)) ** 2

from math.pi/4.0 + 0.2 to 3 * math.pi/4.0 - 0.2

For a long drop pull shape, a start and end point of (0.0, -15.0) yields a shape like the one pictured below:

The head and the lengthwise extension are slightly slope discordant. I did this intentionally to try to get the effect of the real life dropping of hot wax on the egg and pulling away from the drop to make the V shape.

With a parameter of (0.0, -5.0) for the start-stop point, a shorter, stubby drop is formed:

Through a series of scaling and rotation operations, I was able to get the drop shapes positioned to decorate my egg:

It takes 41 different strokes to make this egg (the way I approached it). I fell into the temptation briefly of naming the strokes 'stroke1', 'stroke2', etc. This is bad. Descriptive names are good. Even with a deceptively simple design like this, it's impossible to figure out what's going on and mirror the strokes that can be mirrored without descriptive names like 'northeastcenter', 'northwestcenter', etc.

Once I get a chance to rework the code, I can shorten the names and eliminate repetitive code. This pattern recognition/code refactoring exercise should keep me busy for a bit. In the meantime, thanks for having a look.

## No comments:

## Post a Comment