当前位置: 首页>>代码示例>>C++>>正文


C++ Transformer::inverse_transform方法代码示例

本文整理汇总了C++中Transformer::inverse_transform方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::inverse_transform方法的具体用法?C++ Transformer::inverse_transform怎么用?C++ Transformer::inverse_transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transformer的用法示例。


在下文中一共展示了Transformer::inverse_transform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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_);
    }

}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:28,代码来源:xyview.cpp

示例2: invXform_gs

static void invXform_gs (Coord& tx, Coord& ty, Graphic31* g) {
    Transformer* t = g->transformer();
    if (t != nil) {
        t->inverse_transform(tx, ty);
    }
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:6,代码来源:figure.c

示例3: if

boolean Graphic31::manipulating (const Event& e, Tool31& tool) {
    if (e.type() == Event::up) {
        return false;
    } else if (e.type() == Event::motion) {
        unsigned int tool_type = tool.tool();
        ToolState& ts = tool.toolstate();

        if (tool_type != Tool31::nop) {
            float pi = 3.14159;
            Graphic31 gs;
            Transformer* tx = ts._gs.transformer();
            
            Coord x, y, lx, ly;
            
            x = ts._last.pointer_x();
            y = ts._last.pointer_y();
            lx = e.pointer_x(); 
            ly = e.pointer_y();
            
            switch(tool_type) {
            case Tool31::select:
                break;
            case Tool31::move:
                {
                    if (tx != nil) {
                        tx->inverse_transform(lx, ly);
                        tx->inverse_transform(x, y);
                    }
                    translate(lx-x, ly-y);
                    ts._last = e;
                }
                break;
            case Tool31::scale:
                {
                    Coord cx, cy;
                    cx = (ts._l + ts._r)/2.0;
                    cy = (ts._b + ts._t)/2.0;
                    
                    scale((lx-cx)/(x-cx), (ly-cy)/(y-cy), cx, cy);
                    ts._last = e;
                } 
                break;
            case Tool31::rotate:
                {
                    Coord cx, cy;
                    cx = (ts._l + ts._r)/2.0;
                    cy = (ts._b + ts._t)/2.0;

                    float ldy = ly-cy; float ldx = lx-cx;
                    float dy = y-cy; float dx = x-cx;

		    float cur = degrees(atan2f(ldy, ldx));
		    float last = degrees(atan2f(dy, dx));
                        
                    rotate(cur-last, cx, cy);
                    ts._last = e;
                }
                break;
            }
        }
    } 
    return true;
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:63,代码来源:figure.c


注:本文中的Transformer::inverse_transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。