I am trying to draw lines with an offset to the main line, for example, when nesting. 
I have problems with my code. It creates intersections and return points on lines. (Application)

Perhaps someone can help me with this code to provide any working example that I can execute.
// LEFT SIDE OF MAIN LINE int numberOfLines = 10; float offset = 10f; lastLinePoints = outerPoints; // outerPoint = Points from Main Line for(int i = 0; i < numberOfLines; i++) { List<Vector3> tempPoints = new List<Vector3> (); for (int k = 0; k < lastLinePoints.Count; k++) { if (k + 1 < lastLinePoints.Count) { Vector3 direction = lastLinePoints [k + 1] - lastLinePoints [k]; // up direction: Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); // find right vector: Vector3 right = Vector3.Cross(direction.normalized, up.normalized); Vector3 newPoint = lastLinePoints [k] + (right * offset); tempPoints.Add (newPoint); } } VectorLine lineTemp = new VectorLine ("lineCurved", tempPoints, 120f / _camera2DObject.GetComponent<Camera> ().orthographicSize, LineType.Continuous); lineTemp.Draw3D (); lastLinePoints = tempPoints; }
After some research, I know that the solution for drawing curved parallel lines can be difficult. I also found some algorithms ( https://hal.inria.fr/inria-00518005/document ), but for this math it is difficult for me to make the code.
After a suggestion from @jstreet, I tried the CLIPPER library. The results are very good, but is it possible to use only a parallel line instead of a closed polygon around the line (for example, on an attachment) 
UPDATE
I wrote another question because I think using CLIPPER for parallel lines is worth it. LINK To the question

source share