예제 #1
0
        public MyVector MutliplyMatrix(MyMaxtrix m)
        {
            var newX = this.X * m.M11 + this.Y * m.M21 + 0 * m.M31;
            var newY = this.X * m.M12 + this.Y * m.M22 + 0 * m.M32;

            return(new MyVector(newX, newY));
        }
예제 #2
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);
        }
예제 #3
0
 public MyVector MutliplyMatrix(MyMaxtrix m)
 {
     var newX = this.X * m.M11 + this.Y * m.M21 + 0 * m.M31;
     var newY = this.X * m.M12 + this.Y * m.M22 + 0 * m.M32;
     return new MyVector(newX, newY);
 }
예제 #4
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);
 }