Closed rjsworking closed 10 months ago
Hi, @rjsworking ,
The library doesn't have built-in method to create parallel segments. You should create normal vector to your segment and then translate s1 on this vector multiplied by dist = 50:
const norm = vector(s1.start, s1.end).rotate90CW().normalize();
const s2 = s1.translate(norm.multiply(50));
Then you will get expected result:
ps: Point {x: 248.5071250072666, y: 187.87321874818335}
pe: Point {x: 348.5071250072666, y: 587.8732187481834}
Ask if you have more questions
Hi Alex,
Thank you very much!
Cheers rjs
You are welcome
Hi I've been trying to create parallel segments using translate() without success.
Example: I have a segment S1 segment(200, 200, 300, 600) and I want a 2nd segment S2 at a distance of 50px
The coords of new segment would be (248.5071250072666, 187.87321874818335, 348.5071250072666, 587.8732187481834)
Appreciate any help.
Cheers rjs