*in_x = gt->width * theta / (circle->spread_angle + 0.0001);
*in_y =
- gt->height * (1 - (distance - cgt->radius) / (circle->height + 0.0001));
+ gt->height * (1 - (distance - cgt->precalc_radius) / (circle->height +
+ 0.0001));
GST_DEBUG_OBJECT (circle, "Inversely mapped %d %d into %lf %lf",
x, y, *in_x, *in_y);
#define DEFAULT_X_CENTER 0.5
#define DEFAULT_Y_CENTER 0.5
-#define DEFAULT_RADIUS 100
+#define DEFAULT_RADIUS 0.35
static void
gst_circle_geometric_transform_set_property (GObject * object, guint prop_id,
cgt->precalc_x_center = cgt->x_center * gt->width;
cgt->precalc_y_center = cgt->y_center * gt->height;
- cgt->precalc_radius2 = cgt->radius * cgt->radius;
+ cgt->precalc_radius =
+ cgt->radius * 0.5 * sqrt (gt->width * gt->width +
+ gt->height * gt->height);
+ cgt->precalc_radius2 = cgt->precalc_radius * cgt->precalc_radius;
return TRUE;
}
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_RADIUS,
g_param_spec_double ("radius", "radius",
- "radius of the circle_geometric_transform effect", 0.0, G_MAXDOUBLE,
+ "radius of the circle_geometric_transform effect", 0.0, 1.0,
DEFAULT_RADIUS,
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
theta = geometric_math_triangle (theta / G_PI * kaleidoscope->sides * 0.5);
- if (cgt->radius != 0) {
- gdouble radiusc = cgt->radius / cos (theta);
+ if (cgt->precalc_radius != 0) {
+ gdouble radiusc = cgt->precalc_radius / cos (theta);
distance = radiusc * geometric_math_triangle (distance / radiusc);
}
*in_y = y;
} else {
gdouble d = sqrt (distance);
- gdouble a = atan2 (dy, dx) + twirl->angle * (cgt->radius - d) / cgt->radius;
+ gdouble a = atan2 (dy,
+ dx) + twirl->angle * (cgt->precalc_radius - d) / cgt->precalc_radius;
*in_x = cgt->precalc_x_center + d * cos (a);
*in_y = cgt->precalc_y_center + d * sin (a);
water->amplitude * sin (d / water->wavelength * G_PI * 2 -
water->phase);
- amount *= (cgt->radius - d) / cgt->radius;
+ amount *= (cgt->precalc_radius - d) / cgt->precalc_radius;
if (d != 0)
amount *= water->wavelength / d;
*in_x = x + dx * amount;