Skip to main content

I have a 2d polygon and I wanna fill it with as many parallel lines as possible given the distance between the lines and the angle.

 

I have some problems to create the lines I need.

 

In the image ignore the points.

Input:

Input+ the angle (i.e. 80°)

Result (ignore points)

results

You need to create the line and iterate through an Offsetter until you fill your polygon.

I created a Custom Transformer that generates 10 lines for a polygon. You can increase that or make it dependent on the polygon dimensions.

Fill polygon with linesI use a BoundingBoxReplacer to get the 2D Oriented Bounding Box and put the Length, Wide, and Angle in attributes, Replace the BBOX with it's centerline via CenterlineReplacer, extent it via LineExtender with health it's length (Length/2 attribute from BoundingBoxReplacer). Then iterate through two Offsetters set to Polar Coordinates, one with Width/10 and Angle+90 and the other with Width/10 and Angle-90. Stop the iteration via Tester when your conditions are met.

Fill polygon with lines InspectorEventually buffer the original polygon with some value and clip the output with it.

I attached a sample workspace to get you started.


Majestic Solution.

I need to study loop so hard.

 

Thank you.

 


Reply