mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
Merge branch 'curved_splinesurface' into 'master'
Curved splinesurface See merge request jschoeberl/netgen!110
This commit is contained in:
commit
459f168126
@ -1236,7 +1236,15 @@ namespace netgen
|
||||
return max2(bb/(aa*aa),aa/(bb*bb));
|
||||
}
|
||||
|
||||
int EllipticCylinder :: IsIdentic(const Surface& s2, int& inv, double eps) const
|
||||
{
|
||||
const EllipticCylinder* ps2 = dynamic_cast<const EllipticCylinder*>(&s2);
|
||||
if (!ps2) return 0;
|
||||
|
||||
if((vl - ps2->vl).Length() > eps || (vs - ps2->vs).Length() > eps || (a-ps2->a).Length() > eps)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Point<3> EllipticCylinder :: GetSurfacePoint () const
|
||||
{
|
||||
|
@ -303,7 +303,8 @@ namespace netgen
|
||||
const Box<3> & bbox,
|
||||
double facets) const;
|
||||
|
||||
|
||||
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
|
||||
|
||||
virtual double MaxCurvature () const;
|
||||
|
||||
virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
|
||||
|
@ -235,13 +235,17 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
return self.GetNP()-1;
|
||||
}),
|
||||
py::arg("x"),py::arg("y"),py::arg("z"),py::arg("hpref")=false)
|
||||
.def("AddSegment", FunctionPointer
|
||||
([] (SplineSurface & self, int i1, int i2, string bcname, double maxh)
|
||||
.def("AddSegment", [] (SplineSurface & self, int i1, int i2, string bcname, double maxh)
|
||||
{
|
||||
auto seg = make_shared<LineSeg<3>>(self.GetPoint(i1),self.GetPoint(i2));
|
||||
self.AppendSegment(seg,bcname,maxh);
|
||||
}),
|
||||
},
|
||||
py::arg("pnt1"),py::arg("pnt2"),py::arg("bcname")="default", py::arg("maxh")=-1.)
|
||||
.def("AddSegment", [] (SplineSurface& self, int i1, int i2, int i3, string bcname, double maxh)
|
||||
{
|
||||
auto seg = make_shared<SplineSeg3<3>>(self.GetPoint(i1), self.GetPoint(i2), self.GetPoint(i3));
|
||||
self.AppendSegment(seg, bcname, maxh);
|
||||
}, py::arg("pnt1"),py::arg("pnt2"), py::arg("pnt3"),py::arg("bcname")="default", py::arg("maxh")=-1.)
|
||||
;
|
||||
|
||||
py::class_<SPSolid, shared_ptr<SPSolid>> (m, "Solid")
|
||||
@ -471,7 +475,12 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
|
||||
self.GetTopLevelObject(tlonr) -> SetBCProp(surf->GetBase()->GetBCProperty());
|
||||
self.GetTopLevelObject(tlonr) -> SetBCName(surf->GetBase()->GetBCName());
|
||||
self.GetTopLevelObject(tlonr) -> SetMaxH(surf->GetBase()->GetMaxH());
|
||||
for(auto p : surf->GetPoints())
|
||||
Array<Point<3>> non_midpoints;
|
||||
for(auto spline : surf->GetSplines())
|
||||
{
|
||||
non_midpoints.Append(spline->GetPoint(0));
|
||||
}
|
||||
for(auto p : non_midpoints)
|
||||
self.AddUserPoint(p);
|
||||
self.AddSplineSurface(surf);
|
||||
}),
|
||||
|
@ -62,7 +62,30 @@ void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const
|
||||
cuttings->Append(plane);
|
||||
}
|
||||
else
|
||||
throw NgException("Spline type not implemented for SplineSurface!");
|
||||
{
|
||||
auto spline3 = dynamic_cast<SplineSeg3<3>*>(spline.get());
|
||||
if(spline3)
|
||||
{
|
||||
auto p1 = Point<3>(spline3->StartPI());
|
||||
Project(p1);
|
||||
auto p2 = Point<3>(spline3->TangentPoint());
|
||||
Project(p2);
|
||||
auto p3 = Point<3>(spline3->EndPI());
|
||||
Project(p3);
|
||||
Vec<3> v1 = p2-p1;
|
||||
Vec<3> v2 = p2-p3;
|
||||
Point<3> mid = p1 - v2;
|
||||
cout << "mid point = " << mid << endl;
|
||||
cout << "v1 = " << v1 << endl;
|
||||
cout << "v2 = " << v2 << endl;
|
||||
auto cyl = make_shared<EllipticCylinder>(mid, v1, v2);
|
||||
if(maxh[i] > 0)
|
||||
cyl->SetMaxH(maxh[i]);
|
||||
cuttings->Append(cyl);
|
||||
}
|
||||
else
|
||||
throw NgException("Spline type not implemented for SplineSurface!");
|
||||
}
|
||||
}
|
||||
all_cuts = cuttings;
|
||||
return cuttings;
|
||||
|
Loading…
Reference in New Issue
Block a user