1

私は数学の問題を抱えています。私は各極値を持つ線、垂直線を作成しますが、これらの垂直線の長さを選択したいのですが、これを行う方法がわかりません:(

これは私のコードです:

int vX = fleche.endPoint.x - fleche.startPoint.x;
        int vY = fleche.endPoint.y - fleche.startPoint.y;

        int vXP = - ( fleche.endPoint.y - fleche.startPoint.y );

        Paint p = new Paint();
        p.setColor(fleche.color);
        p.setTextSize(30);
        p.setTextAlign(Paint.Align.CENTER);
        p.setStrokeWidth(8);
        p.setAlpha(fleche.alpha);

        Path path = new Path();

        path.moveTo(fleche.startPoint.x - 10,fleche.startPoint.y - 10);
        path.lineTo(fleche.endPoint.x - 10, fleche.endPoint.y - 10);
        c.drawTextOnPath(fleche.value + fleche.unit, path, 30, 0, p);

        c.drawPath(path, p);

        path.moveTo(fleche.startPoint.x - 10,fleche.startPoint.y - 10);
        path.lineTo(fleche.endPoint.x - 10, fleche.endPoint.y - 10);
        c.drawTextOnPath(fleche.value + fleche.unit, path, 30, 0, p);

        //ligne principale
        c.drawLine(fleche.startPoint.x, fleche.startPoint.y, fleche.endPoint.x, fleche.endPoint.y, p);

        //left
        c.drawLine(fleche.startPoint.x, fleche.startPoint.y, fleche.startPoint.x + vXP, fleche.startPoint.y + vX, p);
        c.drawLine(fleche.startPoint.x, fleche.startPoint.y, fleche.startPoint.x - vXP, fleche.startPoint.y - vX, p);

        //right
        c.drawLine(fleche.endPoint.x, fleche.endPoint.y, fleche.endPoint.x + vXP, fleche.endPoint.y + vX, p);
        c.drawLine(fleche.endPoint.x, fleche.endPoint.y, fleche.endPoint.x - vXP, fleche.endPoint.y - vX, p);
        //Tools.logDebug("Fleche créée(" + i + "/" +  (arrows.size()-1) +  ") :" + fleche.toString());

すべてに前もって感謝します:D

4

1 に答える 1