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?:
- Pre-allocate vtkPolyData* sqWithFillet = 4*nSegmentsPerFillet for vtkIdList and vtkPoints
- Construct vtkArcSource for first fillet
- Use sqWithFillet->CopyCells( vtkPolyData* arcPD, vtkIdList* cellsToCopyFromArcPD ) to copy from arc poly data to sqWithFillet poly data.
- Repeat steps 2 and 3 for fillets 2, 3 and 4.
Thanks for your insightful comments.
By fillet do you mean a visually equivalent to those fillets added at corners with welding?
Yes, rounded instead of having sharp corners where two straight edges meet.
I see. What are you getting with your steps? Can you post a figure?
@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.
Unless there’s a significantly simpler means, I plan to use the manual approach.
Can you post the code of your pipeline?
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.