Beispiel #1
0
        private Tuple <Mesh, Matrix44d> CreateArrowData(int priority,
                                                        Pointd fromPoint, Pointd toPoint)
        {
            var diff      = toPoint - fromPoint;
            var length    = diff.Distance;
            var lengthMax = SquareSize.Width * 9.0;

            // 距離が近いものほど小さくなる
            var lengthRate = Math.Min(length, lengthMax) / lengthMax;

            // 優先順位の低い矢印ほど、小さくなる値
            var priorityRate = 1.0 / priority;

            // 先にメッシュを作成
            var mesh = MeshUtil.CreateArrow(
                MathEx.InterpLiner(0.4, 0.2, lengthRate),
                0.2, 0.05);

            var rad       = Math.Atan2(diff.Y, diff.X);
            var transform = new Matrix44d();

            transform.Translate(fromPoint.X, fromPoint.Y, 1.0);
            transform.Rotate(rad - Math.PI / 2, 0, 0, 1);
            transform.Scale(
                SquareSize.Width *
                MathEx.InterpLiner(1.2, 1.5, lengthRate) *
                priorityRate,
                length, 1.0);

            return(Tuple.Create(mesh, transform));
        }
Beispiel #2
0
 private Mesh CreateArrowMesh(double length, double priorityRate, bool outline)
 {
     return(MeshUtil.CreateArrow(
                SquareSize.Width / length *
                MathEx.InterpLiner(0.6, 0.2, priorityRate),
                0.7, 0.05, 0.05, outline));
 }