Search the Community
Showing results for tags 'trig functions'.
Found 1 result
The equations facility in Affinity is not well documented. There is limited support in some AP actions, but the Transform and Distort > Equations filter offers a wide range of functions. This tutorial focuses on using the trigonometrical functions, sine, tangent and arctangent. The argument to many trigonometrical functions is an angle. In mathematics this is usually expressed in radians. However, the Affinity functions expect their argument in degrees. Sines and cosines The argument expected is in degrees, and over 360 degrees, the value of the function varies between -1 and +1. The sine function starts at zero and rises to a maximum at 90 deg, then falls to zero at 180 deg, falling to a minimum of -1 at 270 deg before rising to zero at 360 deg. If we wish to map this cycle to the width of an image, then we can use sin(360*x/w). Typically we would want the amplitude of the cycle (the maximum and minimum) to be more than 1 and -1, so we add a scale factor, measured in pixels. For an amplitude of 100 pixels, we have 100*sin(360*x/w). This gives one cycle across the width of the image. If we want more than one cycle, we can add a multiplier in the argument, so for three cycles per width, we can use 100*sin(3*360*x/w). Note that I use 3*360 rather than 1080 since it preserves the standard 360 multiplier. As an example, here is a checkerboard with Filter > Distort > Equations: x=x y=y+100*sin(2*360*x/w) If we apply this to a real image, we get: This is varying the vertical position of a point along the x-axis. We could vary the vertical position of a point along the y-axis by using the equation: y=y+100*sin(2*360*y/h) For the checkerboard, this would give: And for the Severn Bridge we get: We could even combine them both with the formula: y=y+100*sin(2*360*x/w)*sin(2*360*y/h) to give: or, for a real image: I will be adding further examples using tangents and cotangents.