本文整理汇总了C++中Transformer::transform方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::transform方法的具体用法?C++ Transformer::transform怎么用?C++ Transformer::transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformer
的用法示例。
在下文中一共展示了Transformer::transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: corners
static void corners(
Coord& left, Coord& bottom, Coord& right, Coord& top, const Transformer& t
) {
Coord x1, y1, x2, y2, x3, y3, x4, y4;
t.transform(left, bottom, x1, y1);
t.transform(left, top, x2, y2);
t.transform(right, top, x3, y3);
t.transform(right, bottom, x4, y4);
left = Math::min(x1, x2, x3, x4);
bottom = Math::min(y1, y2, y3, y4);
right = Math::max(x1, x2, x3, x4);
top = Math::max(y1, y2, y3, y4);
}
示例2: transform
void View::transform(
Transformer& t, const Allocation& a, const Allocation&
) const {
scene2view(a);
const Allotment& ax = a.x_allotment();
const Allotment& ay = a.y_allotment();
csize(ax.begin(), ax.span(), ay.begin(), ay.span());
float sx = ax.span()/XYView::width();
float sy = ay.span()/XYView::height();
// if (sx > sy) sx = sy;
t.translate( -x(), -y());
t.scale(sx, sx);
View* v = (View*)this;
v->x_pick_epsilon_ = pick_epsilon/sx;
v->y_pick_epsilon_ = pick_epsilon/sx;
t.translate((ax.begin() + ax.end())/2,(ay.begin() + ay.end())/2);
//printf("\nx origin=%g span=%g alignment=%g begin=%g end=%g\n", ax.origin(), ax.span(), ax.alignment(), ax.begin(), ax.end());
//printf("\ny origin=%g span=%g alignment=%g begin=%g end=%g\n", ay.origin(), ay.span(), ay.alignment(), ay.begin(), ay.end());
Coord x1,y1;
t.transform(x() - x_span_/2, y() - y_span_/2, x1, y1);
if (!Math::equal(ax.begin(), x1, 1) || !Math::equal(ay.begin(), y1, 1)) {
t.inverse_transform(ax.begin(), ay.begin(), x1, y1);
v->x_span_ = 2*(x() - x1);
v->y_span_ = 2*(y() - y1);
v->size(x1,y1,x1+v->x_span_, y1+v->y_span_);
}
}
示例3: straight
static bool straight(
const Transformer& tx,
Coord x0, Coord y0, Coord x1, Coord y1,
Coord x2, Coord y2, Coord x3, Coord y3)
{
Coord tx0, tx1, tx2, tx3;
Coord ty0, ty1, ty2, ty3;
tx.transform(x0, y0, tx0, ty0);
tx.transform(x1, y1, tx1, ty1);
tx.transform(x2, y2, tx2, ty2);
tx.transform(x3, y3, tx3, ty3);
float f = (
(tx1 + tx2) * (ty0 - ty3) + (ty1 + ty2) * (tx3 - tx0)
+ 2 * (tx0 * ty3 - ty0 * tx3)
);
return (f * f) < smoothness;
}
示例4: Xform_gs
static void Xform_gs(
Coord x[], Coord y[], int n, Coord tx[], Coord ty[], Graphic31* g
) {
Transformer* t = g->transformer();
if (t != nil) {
register Coord* ox, * oy, *nx, *ny;
Coord* lim;
lim = &x[n];
for (
ox = x, oy = y, nx = tx, ny = ty; ox < lim; ox++, oy++, nx++, ny++
) {
t->transform(*ox, *oy, *nx, *ny);
}
} else {
Memory::copy(x, tx, n*sizeof(Coord));
Memory::copy(y, ty, n*sizeof(Coord));
}
}