0

I'm working on a app that is based on vector data and using various boolean operations. For these boolean operation I'm using a library called clipper. Now I need to make a vector operation which I'm not sure how to do in Clipper. I have a straight line consisting of two points that always have to stay inside a closed polygon. What I mean by this is the following image. The green line is the closed polygon and the red line is the straight line. When the red line is outside the green polygon it needs to follow the contour of the green polygon.

I'm not sure how to archive this. Any suggestion on how to do this with clipper or maybe another library will be very helpful!

1 Answers1

1

I don't know clipper, but I've seen examples of this using "dashed lines" around a vector image.

THe method is very simple, however. Consider that your line is part of a "dashed line" around the border of the image. To make it appear it only exists one line, the space between each dash has to be at least equal or greater than full_perimeter - dash_size.

In this example, the movement would be generated with an iteration over the offset where the dash is drawn to make it move around the picture.

I hope this helps, or points you in a way to solve this problem :D

Canilho
  • 944
  • 5
  • 11