xforms for Chaotica
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

9 months ago
<?xml version="1.0" encoding="utf-8"?>
<user_transforms>
<transform_def name="curlerq">
<node name="input_params">
<real name="curlerq">1</real>
<real name="curlerq_c1" >0</real>
<real name="curlerq_c2" >0</real>
<real name="curlerq_rotate" >0</real>
<real name="curlerq_axisflip" >0</real>
</node>
<node name="internal_params">
<real name="weight" />
<real name="c1" />
<real name="c2" />
<real name="rotate" />
<real name="axisflip" />
</node>
<string name="winter_init_function">
<![CDATA[
curlerq_init_result(curlerq, curlerq_c1, curlerq_c2, curlerq_rotate, curlerq_axisflip)
]]>
</string>
<string name="winter_eval_function">
<![CDATA[
let
re = 1 + c1 * p_in.x + c2 * (p_in.x * p_in.x - p_in.y * p_in.y)
im = (c1 + 2 * c2 * p_in.x) * p_in.y
fx = if axisflip <= 0
then sinh(p_in.x * re) + sinh(p_in.y * im)
else tanh(p_in.x * re) + sinh(p_in.y * im)
fy = if fx == sinh(p_in.x * re) + sinh(p_in.y * im)
then tanh(p_in.y * re) - tanh(p_in.x * im)
else sinh(p_in.y * re) - tanh(p_in.x * im)
fr = weight / (re * re + im * im)
in
(mat2x2(cos(rotate), -sin(rotate),
sin(rotate), cos(rotate)) * vec2(fx, fy)) * fr
]]>
</string>
</transform_def>
</user_transforms>