Exemplo n.º 1
0
        private void CalcArrowEdgeVec(Point p1, Point p2, out MyVector topEdgeVec, out MyVector bottomEdgeVec)
        {
            //sin(-θ)=-sinθ
            //cos(-θ)=cosθ
            var lineVec = new MyVector(p1.X - p2.X, p1.Y - p2.Y);

            lineVec.Normalize();
            lineVec.MultplyLen((float)ArrowEdgeLength);
            var rad                = ArrowEdgeAngle / 2 * (Math.PI / 180);
            var sinθ               = Math.Sin(rad);
            var cosθ               = Math.Cos(rad);
            var topRotateMatrix    = new MyMaxtrix(cosθ, sinθ, -sinθ, cosθ, 0, 0);
            var bottomRotateMatrix = new MyMaxtrix(cosθ, -sinθ, sinθ, cosθ, 0, 0);

            topEdgeVec    = lineVec.MutliplyMatrix(topRotateMatrix);
            bottomEdgeVec = lineVec.MutliplyMatrix(bottomRotateMatrix);
        }
Exemplo n.º 2
0
 public static Point SubVec(this Point point, MyVector vec)
 {
     return(new Point(point.X - vec.X, point.Y - vec.Y));
 }
Exemplo n.º 3
0
 public static Point AddVec(this Point point, MyVector vec)
 {
     return(new Point(point.X + vec.X, point.Y + vec.Y));
 }
Exemplo n.º 4
0
 public static Point SubVec(this Point point, MyVector vec)
 {
     return new Point(point.X - vec.X, point.Y - vec.Y);
 }
Exemplo n.º 5
0
 public static Point AddVec(this Point point, MyVector vec)
 {
     return new Point(point.X + vec.X, point.Y + vec.Y);
 }
Exemplo n.º 6
0
 private void CalcArrowEdgeVec(Point p1, Point p2, out MyVector topEdgeVec, out MyVector bottomEdgeVec)
 {
     //sin(-θ)=-sinθ
     //cos(-θ)=cosθ
     var lineVec = new MyVector(p1.X - p2.X, p1.Y - p2.Y);
     lineVec.Normalize();
     lineVec.MultplyLen((float)ArrowEdgeLength);
     var rad = ArrowEdgeAngle / 2 * (Math.PI / 180);
     var sinθ = Math.Sin(rad);
     var cosθ = Math.Cos(rad);
     var topRotateMatrix = new MyMaxtrix(cosθ, sinθ, -sinθ, cosθ, 0, 0);
     var bottomRotateMatrix = new MyMaxtrix(cosθ, -sinθ, sinθ, cosθ, 0, 0);
     topEdgeVec = lineVec.MutliplyMatrix(topRotateMatrix);
     bottomEdgeVec = lineVec.MutliplyMatrix(bottomRotateMatrix);
 }