Vec2<float> mod(const Vec2<float> &v1, const Vec2<float> &v2) { Vec2<float> rv; rv.x = mod_float(v1.x, v2.x); rv.y = mod_float(v1.y, v2.y); return rv; }
Vec4<float> mod(const Vec4<float> &v1, const Vec4<float> &v2) { Vec4<float> rv; rv.x = mod_float(v1.x, v2.x); rv.y = mod_float(v1.y, v2.y); rv.z = mod_float(v1.z, v2.z); rv.w = mod_float(v1.w, v2.w); return rv; }
static gboolean circle_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) { GstCircleGeometricTransform *cgt = GST_CIRCLE_GEOMETRIC_TRANSFORM_CAST (gt); GstCircle *circle = GST_CIRCLE_CAST (gt); gdouble distance; gdouble dx, dy; gdouble theta; dx = x - cgt->precalc_x_center; dy = y - cgt->precalc_y_center; distance = sqrt (dx * dx + dy * dy); theta = atan2 (-dy, -dx) + circle->angle; theta = mod_float (theta, 2 * G_PI); *in_x = gt->width * theta / (circle->spread_angle + 0.0001); *in_y = 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); return TRUE; }
VecN<float, N> mod(const VecN<float, N> &v1, const VecN<float, N> &v2) { VecN<float, N> rv; for(unsigned int i=0; i < N; i++) { rv.v[i] = mod_float(v1.v[i], v2.v[i]); } return rv; }
static void gst_geometric_transform_do_map (GstGeometricTransform * gt, GstBuffer * inbuf, GstBuffer * outbuf, gint x, gint y, gdouble in_x, gdouble in_y) { gint in_offset; gint out_offset; out_offset = y * gt->row_stride + x * gt->pixel_stride; /* operate on out of edge pixels */ switch (gt->off_edge_pixels) { case GST_GT_OFF_EDGES_PIXELS_CLAMP: in_x = CLAMP (in_x, 0, gt->width - 1); in_y = CLAMP (in_y, 0, gt->height - 1); break; case GST_GT_OFF_EDGES_PIXELS_WRAP: in_x = mod_float (in_x, gt->width); in_y = mod_float (in_y, gt->height); if (in_x < 0) in_x += gt->width; if (in_y < 0) in_y += gt->height; break; default: break; } { gint trunc_x = (gint) in_x; gint trunc_y = (gint) in_y; /* only set the values if the values are valid */ if (trunc_x >= 0 && trunc_x < gt->width && trunc_y >= 0 && trunc_y < gt->height) { in_offset = trunc_y * gt->row_stride + trunc_x * gt->pixel_stride; memcpy (GST_BUFFER_DATA (outbuf) + out_offset, GST_BUFFER_DATA (inbuf) + in_offset, gt->pixel_stride); } } }
float mod(const float v1, const float v2) { return mod_float(v1, v2); }
Fixed mod_fixed(Fixed v1, Fixed v2) { return FloatToFixed( mod_float(FixedToFloat(v1), FixedToFloat(v2)) ); }