mirror of
https://github.com/NGSolve/netgen.git
synced 2026-05-31 01:06:10 +08:00
Vec3d to Vec<3>, comparison operator for Vec<>
This commit is contained in:
@@ -138,6 +138,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::class_<Vec<2>> (m, "Vec2d")
|
||||
.def(py::init<double,double>())
|
||||
.def ("__str__", &ToString<Vec<3>>)
|
||||
.def(py::self==py::self)
|
||||
.def(py::self+py::self)
|
||||
.def(py::self-py::self)
|
||||
.def(-py::self)
|
||||
@@ -150,6 +151,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::class_<Vec<3>> (m, "Vec3d")
|
||||
.def(py::init<double,double,double>())
|
||||
.def ("__str__", &ToString<Vec<3>>)
|
||||
.def(py::self==py::self)
|
||||
.def(py::self+py::self)
|
||||
.def(py::self-py::self)
|
||||
.def(-py::self)
|
||||
@@ -492,20 +494,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
[](FaceDescriptor & self) -> string { return self.GetBCName(); },
|
||||
[](FaceDescriptor & self, string name) { self.SetBCName(new string(name)); } // memleak
|
||||
)
|
||||
.def_property("color",
|
||||
[](FaceDescriptor & self)
|
||||
{
|
||||
auto c = self.SurfColour();
|
||||
return py::make_tuple( c.X(), c.Y(), c.Z() );
|
||||
},
|
||||
[](FaceDescriptor & self, py::tuple color)
|
||||
{
|
||||
Vec3d c;
|
||||
c.X() = py::extract<double>(color[0])();
|
||||
c.Y() = py::extract<double>(color[1])();
|
||||
c.Z() = py::extract<double>(color[2])();
|
||||
self.SetSurfColour(c);
|
||||
})
|
||||
.def_property("color", &FaceDescriptor::SurfColour, &FaceDescriptor::SetSurfColour )
|
||||
;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user