<div dir="ltr">Hi friends,<div><br></div><div><br></div><div> I want to calculate the area of the clipped surface.As shown in image below, I want to calculate the area of red region / read only read region. How can we do that ?</div><div><br></div><div><img src="cid:ii_157dcb8d7e428ae4" alt="Inline image 1" width="317" height="335"><br></div><div><br></div><div><br></div><div>Code:</div><div><br></div><div><pre style="font-family:consolas;color:black;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">vtkSmartPointer<vtkSuperquadricSource> superquadricSource =
vtkSmartPointer<vtkSuperquadricSource>::New();
superquadricSource->SetPhiRoundness(3.1);
superquadricSource->SetThetaRoundness(2.2);
<span style="color:green">// Define a clipping plane</span>
vtkSmartPointer<vtkPlane> clipPlane =
vtkSmartPointer<vtkPlane>::New();
clipPlane->SetNormal(1.0, -1.0, -1.0);
clipPlane->SetOrigin(0.0, 0.0, 0.0);
<span style="color:green">// Clip the source with the plane</span>
vtkSmartPointer<vtkClipPolyData> clipper =
vtkSmartPointer<vtkClipPolyData>::New();
clipper->SetInputConnection(superquadricSource->GetOutputPort());
clipper->SetClipFunction(clipPlane);
<span style="color:green">//Create a mapper and actor</span>
vtkSmartPointer<vtkPolyDataMapper> superquadricMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
superquadricMapper->SetInputConnection(clipper->GetOutputPort());
vtkSmartPointer<vtkActor> superquadricActor =
vtkSmartPointer<vtkActor>::New();
superquadricActor->SetMapper(superquadricMapper);
<span style="color:green">// Create a property to be used for the back faces. Turn off all</span>
<span style="color:green">// shading by specifying 0 weights for specular and diffuse. Max the</span>
<span style="color:green">// ambient.</span>
vtkSmartPointer<vtkProperty> backFaces =
vtkSmartPointer<vtkProperty>::New();
backFaces->SetSpecular(0.0);
backFaces->SetDiffuse(0.0);
backFaces->SetAmbient(1.0);
backFaces->SetAmbientColor(1.0000, 0.3882, 0.2784);
<span style="color:green">//backFaces->SetAmbientColor(1.0000, 0, 0.0);</span>
<span style="color:green">//backFaces->SetOpacity(0.7);</span>
superquadricActor->SetBackfaceProperty(backFaces);
<span style="color:green">// Create a renderer</span>
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->SetWindowName(<span style="color:rgb(163,21,21)">"SolidClip"</span>);
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
<span style="color:green">//Add actors to the renderers</span>
renderer->AddActor(superquadricActor);
renderWindow->Render();
<span style="color:green">//Interact with the window</span>
renderWindowInteractor->Start();</pre></div></div>