# The corners of the rectangle are not good.

**URL:** https://discourse.vtk.org/t/the-corners-of-the-rectangle-are-not-good/8779
**Category:** Development
**Created:** [June 22, 2022, 7:38am UTC](https://discourse.vtk.org/t/the-corners-of-the-rectangle-are-not-good/8779 "2022-06-22T07:38:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ldk7972](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@ldk7972](https://discourse.vtk.org/u/ldk7972)
#### Post date: [June 22, 2022, 7:38am UTC](https://discourse.vtk.org/t/the-corners-of-the-rectangle-are-not-good/8779/1 "2022-06-22T07:38:36Z")

</div>

![사각형끝모양](https://discourse.vtk.org/uploads/default/original/2X/9/970619aedc4e2178ddb0c7b64d92de2204bf371a.jpeg)

m\_pvtkDicomImageReader-\>SetFileName(“D:\XRay3.dcm”);  
m\_pvtkDicomImageReader-\>Update();  
m\_pvtkImageViewer-\>SetInputConnection(m\_pvtkDicomImageReader-\>GetOutputPort());

CStatic\* pctrlPicture = (CStatic\*)GetDlgItem(IDC\_RECT);  
CRect PictureRect;  
pctrlPicture-\>GetWindowRect(&PictureRect);  
this-\>ScreenToClient(&PictureRect);

m\_pvtkImageViewer-\>GetRenderWindow()-\>SetParentId(this-\>m\_hWnd);  
m\_pvtkImageViewer-\>SetPosition(PictureRect.left, PictureRect.top);  
m\_pvtkImageViewer-\>SetSize(PictureRect.Width(), PictureRect.Height());

vtkNew Interactor;  
m\_pvtkImageViewer-\>SetupInteractor(Interactor);

vtkNew polygonSource;

polygonSource-\>SetNumberOfSides(4);  
polygonSource-\>SetRadius(20);  
polygonSource-\>SetNormal(0.0, 0.0, 1.0);  
polygonSource-\>SetCenter(50, 50, 1);  
polygonSource-\>SetGeneratePolygon(FALSE);  
polygonSource-\>SetGeneratePolyline(TRUE);  
polygonSource-\>Update();

vtkNew mapper;  
mapper-\>SetInputConnection(polygonSource-\>GetOutputPort());

vtkNew colors;  
m\_pvtkActor-\>SetMapper(mapper);

m\_pvtkActor-\>GetProperty()-\>SetLineWidth(10.0);  
m\_pvtkActor-\>GetProperty()-\>SetAmbient(1);  
m\_pvtkActor-\>GetProperty()-\>SetSpecular(1);  
m\_pvtkActor-\>GetProperty()-\>SetDiffuse(1);

m\_pvtkActor-\>GetProperty()-\>ShadingOn();  
m\_pvtkActor-\>GetProperty()-\>SetPointSize(1);  
m\_pvtkActor-\>GetProperty()-\>SetAnisotropyRotation(0);

m\_pvtkActor-\>GetProperty()-\>SetColor(1.0, 0.2, 0.6);  
m\_pvtkActor-\>GetProperty()-\>SetOpacity(0.7);  
m\_pvtkActor-\>GetProperty()-\>RenderLinesAsTubesOff();  
m\_pvtkActor-\>SetOrigin(50, 50, 1);

m\_pvtkImageViewer-\>GetRenderer()-\>SetUseFXAA(TRUE);  
m\_pvtkImageViewer-\>GetRenderWindow()-\>SetMultiSamples(0);

m\_pvtkImageViewer-\>GetRenderer()-\>AddActor(m\_pvtkActor);

m\_pvtkImageViewer-\>GetImageActor()-\>InterpolateOff();  
m\_pvtkImageViewer-\>GetRenderer()-\>ResetCamera();  
m\_pvtkImageViewer-\>GetRenderer()-\>SetBackground(40.0 / 255.0, 60.0 / 255.0, 90.0 / 255.0);  
m\_pvtkImageViewer-\>Render();

The corners of the rectangle are not good.  
how can i do that?

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [June 22, 2022, 11:30pm UTC](https://discourse.vtk.org/t/the-corners-of-the-rectangle-are-not-good/8779/2 "2022-06-22T23:30:35Z")

</div>

I would try this:

> polygonSource-\>SetGeneratePolygon(TRUE)

Hope it helps
