Esempio n. 1
0
CSGeometry* NGInterface::loadCSG(string data)
{
    strstream in;
    CSGeometry *geom;
    Point<3> pmin(minX,minY,minZ),
             pmax(maxX,maxY,maxZ);
    Box<3> box(pmin,pmax);

    in << data;
    try
    {
        geom = ParseCSG(in);
    }
    catch(...)
    {
        cerr << "Problem in CSG-file!" << endl;
        return NULL;
    }

    if (!geom)
    {
        cout << "geo-file should start with 'algebraic3d'" << endl;
        return NULL;
    }
    else
        geom->FindIdenticSurfaces(1e-8*geom->MaxSize());
    geom->SetBoundingBox(box);
    geom->CalcTriangleApproximation(detail,facets);
    return (CSGeometry*)(geometry = geom);
}