Getting perimeter path of area surrounded by multiple pathes (may be arcs)

Skip to first unread message

Oskars S

Dec 9, 2022, 2:03:16 PM12/9/22
to Paper.js
Hi, I am wondering if there is a way how to get closed path from multiple intersecting pathes? Some of those may be even arcs.
What I am trying to do is trying to fill closed area of intersecting path segments (There can me multiple such areas).
For example, I would like to have way of filling:
1) Triangle like shape where red dot is
2) Hexagon like shape where green dot is

var point1 = new Point (210,10)
var point2 = new Point (310,160)
var point3 = new Point (110,160)
var point4 = new Point (210,200)
var point5 = new Point (310,90)
var point6 = new Point (110,90)
var line1 = new Path.Line(point1, point2)
var line2 = new Path.Line(point2, point3)
var line3 = new Path.Line(point3, point1)
var line4 = new Path.Line(point4, point5)
var arc5 = new Path.Arc(point5, new Point(210, 70), point6)
var line6 = new Path.Line(point6, point4)
line1.strokeColor = 'blue';
line2.strokeColor = 'blue';
line3.strokeColor = 'blue';
line4.strokeColor = 'blue';
arc5.strokeColor = 'blue';
line6.strokeColor = 'blue';
var circle1 = new Path.Circle(new Point(210, 50), 3)
circle1.strokeColor = 'red'
circle1.fillColor = 'red'
var circle2 = new Path.Circle(new Point(210, 120), 3)
circle2.strokeColor = 'green'
circle2.fillColor = 'green'

Can not think of any universal solution here. Some hint/suggestion will be highly appreciated. 
Thank you very much in advance

Oskars S

Dec 9, 2022, 2:05:17 PM12/9/22
to Paper.js
Here is screenshot attached of drawing:
Screenshot 2022-12-09 at 21.03.44.png

Reply all
Reply to author
0 new messages