packages feed

opencascade-hs-0.9.0.0: cpp/hs_BRep_Tool.cpp

#include <BRep_Tool.hxx>
#include <Standard_Handle.hxx>
#include "hs_Exception.h"
#include "hs_BRep_Tool.h"

Handle(Geom_Curve) * hs_BRep_Tool_curve(
        TopoDS_Edge * edge,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleEx(
        exType,
        exPtr,
        [edge]{
            double s, e;
            return new Handle(Geom_Curve)(BRep_Tool::Curve(*edge, s, e));
        }
    );
}

double hs_BRep_Tool_curveParamFirst(
        TopoDS_Edge * edge,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleExWithDefault(
        exType,
        exPtr,
        [edge]{
            double s, e;
            BRep_Tool::Curve(*edge, s, e);
            return s;
        },
        0.0
    );
}

double hs_BRep_Tool_curveParamLast(
        TopoDS_Edge * edge,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleExWithDefault(
        exType,
        exPtr,
        [edge]{
            double s, e;
            BRep_Tool::Curve(*edge, s, e);
            return e;
        },
        0.0
    );
}

gp_Pnt * hs_BRep_Tool_pnt(
        TopoDS_Vertex * vertex,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleEx(
        exType,
        exPtr,
        [vertex]{
            return new gp_Pnt(BRep_Tool::Pnt(*vertex));
        }
    );
}

Handle(Poly_Triangulation) * hs_BRep_Tool_triangulation(
        TopoDS_Face * face, TopLoc_Location * loc,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleEx(
        exType,
        exPtr,
        [face, loc]{
            return new opencascade::handle<Poly_Triangulation>(BRep_Tool::Triangulation(*face, *loc));
        }
    );
}

bool hs_BRep_Tool_degenerated(
        TopoDS_Edge * edge,
        HSExceptionType* exType, void ** exPtr
){
    return hs_handleExWithDefault(
        exType,
        exPtr,
        [edge]{
            return BRep_Tool::Degenerated(*edge);
        },
        true
    );
}

GeomAbs_Shape hs_BRep_Tool_continuity(
    TopoDS_Edge *edge, TopoDS_Face *face1, TopoDS_Face* face2,
    HSExceptionType* exType, void ** exPtr
){
    return hs_handleExWithDefault(
        exType,
        exPtr,
        [edge, face1, face2]{
            return BRep_Tool::Continuity(*edge, *face1, *face2);
        },
        GeomAbs_C0
    );
}