*/
int BinomialCoeff(int n, int k)
{
- return Factorial(n) / Factorial(k) / Factorial(n-k);
+ return Factorial(n) / (Factorial(k) * Factorial(n-k));
}
/**
{
GPUBezierCoeffs coeffs = {
Float(bez->x0), Float(bez->y0),
- Float(bez->x1 - bez->x0), Float(bez->y1 - bez->y0),
- Float(bez->x2 - bez->x0), Float(bez->y2 - bez->y0)
+ Float(bez->x1), Float(bez->y1),
+ Float(bez->x2), Float(bez->y2)
};
builder.Add(coeffs);
}
{
int bezierid = texelFetch(bezier_id_buffer_texture, objectid[0]).r;
vec2 boundssize = gl_in[1].gl_Position.xy - gl_in[0].gl_Position.xy;
- vec2 coeff0 = texelFetch(bezier_buffer_texture, bezierid*3).rg + gl_in[0].gl_Position.xy ;
- vec2 coeff1 = texelFetch(bezier_buffer_texture, bezierid*3+1).rg * boundssize + gl_in[0].gl_Position.xy;
- vec2 coeff2 = texelFetch(bezier_buffer_texture, bezierid*3+2).rg * boundssize + gl_in[0].gl_Position.xy;
+ vec2 coeff0 = texelFetch(bezier_buffer_texture, bezierid*3).rg;
+ vec2 coeff1 = texelFetch(bezier_buffer_texture, bezierid*3+1).rg;
+ vec2 coeff2 = texelFetch(bezier_buffer_texture, bezierid*3+2).rg;
vec2 boundspxsize = pixsize[0];
int blen = clamp(int(abs(boundspxsize.x)),2,100);
float invblen = 1.0f/float(blen);
float bernstein0 = t*t;
float bernstein1 = 2*t*oneminust;
float bernstein2 = oneminust*oneminust;
- gl_Position = vec4(coeff0*bernstein0 + coeff1*bernstein1 + coeff2*bernstein2, 0.0, 1.0);
+ gl_Position = vec4((coeff0*bernstein0 + coeff1*bernstein1 + coeff2*bernstein2) * boundssize + gl_in[0].gl_Position.xy, 0.0, 1.0);
EmitVertex();
}