osg::Matrixd current_transform ()
{
    return origin_transform () *
           position_transform () *
           scale_transform () *
           rotation_transform () ;
}
Example #2
0
static double calc_den(point *points, size_t point_count, transform_t t, double mx) {
    double sum = 0;
    for (size_t i = 0; i < point_count; i++) {
        point *p = &points[i];
        point tp;
        scale_transform(p, t, &tp);
        sum += (tp.x - mx) * (tp.x - mx);
    }
    return sum;
}
Example #3
0
static bool calc_means(point *points, size_t point_count, transform_t t, double *mx, double *my) {
    double tx = 0;
    double ty = 0;
    size_t cx = 0;
    size_t cy = 0;
    for (size_t i = 0; i < point_count; i++) {
        point *p = &points[i];
        if (IS_EMPTY_POINT(p)) { continue; }
        cx++;
        cy++;
        point tp;
        scale_transform(p, t, &tp);
        tx += tp.x;
        ty += tp.y;
    }

    if (cx == 0) { return false; }
    *mx = tx / cx;
    *my = ty / cy;
    return true;
}