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


C++ TriangleMesh::align_to_origin方法代码示例

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


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

示例1: main

int main(const int argc, const char *argv[]) {
    using namespace Slic3r;
    using std::cout; using std::endl;

    if(argc < 2) {
        cout << USAGE_STR << endl;
        return EXIT_SUCCESS;
    }

    TriangleMesh model;
    Benchmark bench;

    model.ReadSTLFile(argv[1]);
    model.align_to_origin();

    ExPolygons ground_slice;
    TriangleMesh basepool;

    sla::base_plate(model, ground_slice, 0.1f);

    bench.start();
    sla::create_base_pool(ground_slice, basepool);
    bench.stop();

    cout << "Base pool creation time: " << std::setprecision(10)
         << bench.getElapsedSec() << " seconds." << endl;

    basepool.write_ascii("out.stl");

    return EXIT_SUCCESS;
}
开发者ID:repetier,项目名称:Slic3r,代码行数:31,代码来源:slabasebed.cpp

示例2: main

int main(const int argc, const char *argv[]) {
    using namespace Slic3r;
    using std::cout; using std::endl;

    if(argc < 2) {
        cout << USAGE_STR << endl;
        return EXIT_SUCCESS;
    }

    TriangleMesh model;
    Benchmark bench;

    model.ReadSTLFile(argv[1]);
    model.align_to_origin();

    ExPolygons ground_slice;
    sla::Contour3D mesh;
//    TriangleMesh basepool;

    sla::base_plate(model, ground_slice, 0.1f);

    if(ground_slice.empty()) return EXIT_FAILURE;

    ExPolygon bottom_plate = ground_slice.front();
    ExPolygon top_plate = bottom_plate;
    sla::offset(top_plate, coord_t(3.0/SCALING_FACTOR));
    sla::offset(bottom_plate, coord_t(1.0/SCALING_FACTOR));

    bench.start();

    Polygons top_plate_triangles, bottom_plate_triangles;
    top_plate.triangulate_p2t(&top_plate_triangles);
    bottom_plate.triangulate_p2t(&bottom_plate_triangles);

    auto top_plate_mesh = sla::convert(top_plate_triangles, coord_t(3.0/SCALING_FACTOR), false);
    auto bottom_plate_mesh = sla::convert(bottom_plate_triangles, 0, true);

    mesh.merge(bottom_plate_mesh);
    mesh.merge(top_plate_mesh);

    sla::Contour3D w = sla::walls(bottom_plate.contour, top_plate.contour, 0, 3, 2.0, [](){});

    mesh.merge(w);
//    sla::create_base_pool(ground_slice, basepool);
    bench.stop();

    cout << "Base pool creation time: " << std::setprecision(10)
         << bench.getElapsedSec() << " seconds." << endl;

//    basepool.write_ascii("out.stl");

    std::fstream outstream("out.obj", std::fstream::out);
    mesh.to_obj(outstream);

    return EXIT_SUCCESS;
}
开发者ID:prusa3d,项目名称:Slic3r,代码行数:56,代码来源:slabasebed.cpp


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