mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
export SetTransformation
This commit is contained in:
parent
63ee20cb29
commit
c20c2061f4
@ -162,4 +162,16 @@ ostream & operator<< (ostream & ost, Transformation3d & trans)
|
|||||||
}
|
}
|
||||||
return ost;
|
return ost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <int D>
|
||||||
|
Transformation<D> :: Transformation (const Point<D> * pp)
|
||||||
|
{
|
||||||
|
v = Vec<D> (pp[0]);
|
||||||
|
for (int i = 0; i < D; i++)
|
||||||
|
for (int j = 0; j < D; j++)
|
||||||
|
m(j,i) = pp[i+1](j)-pp[0](j);
|
||||||
|
}
|
||||||
|
|
||||||
|
template class Transformation<3>;
|
||||||
}
|
}
|
||||||
|
@ -124,15 +124,26 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); })
|
.def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); })
|
||||||
;
|
;
|
||||||
|
|
||||||
m.def ("SetTransformation", FunctionPointer
|
m.def ("SetTransformation",
|
||||||
([](int dir, double angle)
|
[](int dir, double angle)
|
||||||
{
|
{
|
||||||
if (dir > 0)
|
if (dir > 0)
|
||||||
global_trafo.SetAxisRotation (dir, angle*M_PI/180);
|
global_trafo.SetAxisRotation (dir, angle*M_PI/180);
|
||||||
else
|
else
|
||||||
global_trafo = Transformation<3> (Vec<3>(0,0,0));
|
global_trafo = Transformation<3> (Vec<3>(0,0,0));
|
||||||
}),
|
},
|
||||||
py::arg("dir")=int(0), py::arg("angle")=int(0));
|
py::arg("dir")=int(0), py::arg("angle")=int(0));
|
||||||
|
m.def ("SetTransformation",
|
||||||
|
[](Point<3> p0, Vec<3> ex, Vec<3> ey, Vec<3> ez)
|
||||||
|
{
|
||||||
|
Point<3> pnts[4];
|
||||||
|
pnts[0] = p0;
|
||||||
|
pnts[1] = p0 + ex;
|
||||||
|
pnts[2] = p0 + ey;
|
||||||
|
pnts[3] = p0 + ez;
|
||||||
|
global_trafo = Transformation<3> (pnts);
|
||||||
|
},
|
||||||
|
py::arg("p0"), py::arg("ex"), py::arg("ey"), py::arg("ez"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user