Esempio n. 1
0
        private static Bezier3 GetBezier(Vector3 startPos, Vector3 startDir, Vector3 endPos)
        {
            var startAngle   = startDir.AbsoluteAngle();
            var dir          = endPos - startPos;
            var strangeAngle = dir.AbsoluteAngle();
            var endAngle     = strangeAngle + Mathf.PI + (strangeAngle - startAngle);

            var bezier = new Bezier3()
            {
                a = startPos,
                d = endPos,
            };

            if (Vector3.Dot(startDir, dir) < 0)
            {
                NetSegment.CalculateMiddlePoints(bezier.a, dir, bezier.d, -dir, true, true, out bezier.b, out bezier.c);
            }
            else
            {
                NetSegment.CalculateMiddlePoints(bezier.a, startDir, bezier.d, endAngle.Direction(), true, true, out bezier.b, out bezier.c);
            }

            return(bezier);
        }
Esempio n. 2
0
 public MarkupStylePart(Vector3 start, Vector3 end, Vector3 dir, float length, float width, Color32 color, MaterialType materialType = MaterialType.RectangleLines)
     : this(start, end, dir.AbsoluteAngle(), length, width, color, materialType)
 {
 }