fix CalcProj for ExtrusionFace and export to python

This commit is contained in:
Christoph Wintersteiger 2017-01-27 16:14:27 +01:00
parent 660425ab61
commit 551db1627e
3 changed files with 17 additions and 2 deletions

View File

@ -186,7 +186,7 @@ namespace netgen
for(int i=0; i<path->GetNSplines(); i++) for(int i=0; i<path->GetNSplines(); i++)
{ {
if(mindist[i] > cutdist) continue; if(mindist[i] > cutdist*(1+1e-10)) continue;
double thist = CalcProj(point3d,testpoint2d,i); double thist = CalcProj(point3d,testpoint2d,i);

View File

@ -110,7 +110,7 @@ namespace netgen
{ {
private: private:
const SplineGeometry<3> & path; const SplineGeometry<3> & path;
const SplineGeometry<2> & profile; const SplineGeometry<2> & profile; // closed, clockwise oriented curve
const Vec<3> & z_direction; const Vec<3> & z_direction;

View File

@ -187,6 +187,7 @@ DLL_HEADER void ExportCSG(py::module &m)
; ;
py::class_<SplineGeometry<3>,shared_ptr<SplineGeometry<3>>> (m,"SplineCurve3d") py::class_<SplineGeometry<3>,shared_ptr<SplineGeometry<3>>> (m,"SplineCurve3d")
.def(py::init<>())
.def ("AddPoint", FunctionPointer .def ("AddPoint", FunctionPointer
([] (SplineGeometry<3> & self, double x, double y, double z) ([] (SplineGeometry<3> & self, double x, double y, double z)
{ {
@ -301,6 +302,12 @@ DLL_HEADER void ExportCSG(py::module &m)
Solid * sol = new Solid (brick); Solid * sol = new Solid (brick);
return make_shared<SPSolid> (sol); return make_shared<SPSolid> (sol);
})); }));
m.def ("Torus", FunctionPointer([](Point<3> c, Vec<3> n, double R, double r)
{
Torus * torus = new Torus (c,n,R,r);
Solid * sol = new Solid (torus);
return make_shared<SPSolid> (sol);
}));
m.def ("Revolution", FunctionPointer([](Point<3> p1, Point<3> p2, m.def ("Revolution", FunctionPointer([](Point<3> p1, Point<3> p2,
const SplineGeometry<2> & spline) const SplineGeometry<2> & spline)
{ {
@ -308,6 +315,14 @@ DLL_HEADER void ExportCSG(py::module &m)
Solid * sol = new Solid(rev); Solid * sol = new Solid(rev);
return make_shared<SPSolid> (sol); return make_shared<SPSolid> (sol);
})); }));
m.def ("Extrusion", FunctionPointer([](const SplineGeometry<3> & path,
const SplineGeometry<2> & profile,
Vec<3> n)
{
Extrusion * extr = new Extrusion (path,profile,n);
Solid * sol = new Solid(extr);
return make_shared<SPSolid> (sol);
}));
m.def ("Or", FunctionPointer([](shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2) m.def ("Or", FunctionPointer([](shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2)
{ {