# 2D arc fillet using VTK

**URL:** https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268
**Category:** Support
**Created:** [July 29, 2021, 7:15pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268 "2021-07-29T19:15:17Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![NameRakes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/b4bc9f/32.png) [@NameRakes](https://discourse.vtk.org/u/NameRakes)
#### Post date: [July 29, 2021, 7:15pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/1 "2021-07-29T19:15:17Z")

</div>

Hi, I would like to add a fillet (or an arc) at the sharp corners of 2D polygons (square, rectangle) etc. Is the following approach correct, say for a square? Especially, is the use of vtkPolyData::CopyCells in step 3 correct?:

1. Pre-allocate vtkPolyData\* sqWithFillet = 4\*nSegmentsPerFillet for vtkIdList and vtkPoints
2. Construct vtkArcSource for first fillet
3. Use sqWithFillet-\>CopyCells( vtkPolyData\* arcPD, vtkIdList\* cellsToCopyFromArcPD ) to copy from arc poly data to sqWithFillet poly data.
4. Repeat steps 2 and 3 for fillets 2, 3 and 4.

Thanks for your insightful comments.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [July 30, 2021, 8:58pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/2 "2021-07-30T20:58:56Z")

</div>

By fillet do you mean a visually equivalent to those fillets added at corners with welding?

---

<div class="post-metadata">

### Author: ![NameRakes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/b4bc9f/32.png) [@NameRakes](https://discourse.vtk.org/u/NameRakes)
#### Post date: [July 31, 2021, 12:52am UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/3 "2021-07-31T00:52:41Z")

</div>

Yes, rounded instead of having sharp corners where two straight edges meet.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [July 31, 2021, 9:02pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/4 "2021-07-31T21:02:00Z")

</div>

I see. What are you getting with your steps? Can you post a figure?

---

<div class="post-metadata">

### Author: ![NameRakes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/b4bc9f/32.png) [@NameRakes](https://discourse.vtk.org/u/NameRakes)
#### Post date: [August 1, 2021, 2:06am UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/5 "2021-08-01T02:06:46Z")

</div>

@Paulo_Carvalho I couldn’t get the CopyCells(…) approach mentioned in the OP to work - the program was crashing, and I wasn’t sure if this was the right approach. So I copy the data manually from **vtkArcSource** when each fillet arc is created, and wasn’t an onerous task. This is the picture I see now.

 ![SquareWithFillets](https://discourse.vtk.org/uploads/default/original/2X/e/e88be4eae6c228a3e9703fcd9e7cf1fcf6acef88.png)  
Unless there’s a significantly simpler means, I plan to use the manual approach.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [August 1, 2021, 12:59pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/6 "2021-08-01T12:59:35Z")

</div>

Can you post the code of your pipeline?

---

<div class="post-metadata">

### Author: ![NameRakes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/b4bc9f/32.png) [@NameRakes](https://discourse.vtk.org/u/NameRakes)
#### Post date: [August 2, 2021, 11:37pm UTC](https://discourse.vtk.org/t/2d-arc-fillet-using-vtk/6268/7 "2021-08-02T23:37:15Z")

</div>

I have 4 arc sources each with 1 cell in its cell list, which I would like to _merge into a single cell/polygon_ - by copying all 4 list of point data into 1 array of points, and assigning the point IDs for the single cell/polygon - which then goes into the poly data pipeline. That’s how I got the picture above.

I went through the code in vtkPolyData::CopyCells method. It creates 1 separate cell for each call to the ::CopyCells method - so it is expecting the target poly data object to have allocation done for 4 cells - which is NOT what I want.

Thus, I see the flaw in my use of the CopyCells method. I will use this method when I have the need to copy each arc source data into a separate target cell.
