1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

refactoed plane

This commit is contained in:
Anatoly Baksheev
2014-01-12 14:58:22 +04:00
parent 53b8218652
commit 658f4a7d38
4 changed files with 54 additions and 14 deletions
+30
View File
@@ -125,6 +125,36 @@ namespace cv { namespace viz { namespace
};
}}}
cv::viz::WPlane::WPlane(const Size2d& size, const Color &color)
{
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
plane->SetOrigin(-0.5 * size.width, -0.5 * size.height, 0.0);
plane->SetPoint1( 0.5 * size.width, -0.5 * size.height, 0.0);
plane->SetPoint2(-0.5 * size.width, 0.5 * size.height, 0.0);
plane->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
VtkUtils::SetInputData(mapper, plane->GetOutput());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->LightingOff();
WidgetAccessor::setProp(*this, actor);
setColor(color);
}
cv::viz::WPlane::WPlane(const Point3d& center, const Vec3d& normal, const Vec3d& new_plane_yaxis, const Size2d& size, const Color &color)
{
Vec3d zvec = normalize(normal);
Vec3d xvec = normalize(new_plane_yaxis.cross(zvec));
Vec3d yvec = zvec.cross(xvec);
WPlane plane(size, color);
plane.applyTransform(makeTransformToGlobal(xvec, yvec, zvec, center));
*this = plane;
}
cv::viz::WPlane::WPlane(const Vec4d& coefs, double size, const Color &color)
{
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();