Пример #1
0
    public static double CalculateA(DxCalculationSet calculationSet)
    {
        double x1 = calculationSet.From.x;
        double y1 = calculationSet.From.y;
        double x2 = calculationSet.To.x;
        double y2 = calculationSet.To.y;

        return(Hypotenuse(x1 - x2, y1 - y2));
    }
Пример #2
0
    /// <summary>
    /// Convert list of Vector2 offsets to list of magnitude values.
    /// </summary>
    public static double CalculateDeltaX(DxCalculationSet calculationSet)
    {
        double x  = calculationSet.Selection.x;
        double y  = calculationSet.Selection.y;
        double x1 = calculationSet.From.x;
        double y1 = calculationSet.From.y;
        double x2 = calculationSet.To.x;
        double y2 = calculationSet.To.y;

        double a = Hypotenuse(x1 - x2, y1 - y2);
        double b = Hypotenuse(x - x2, y - y2);
        double c = Hypotenuse(x1 - x, y1 - y);

        return((c * c - b * b - a * a) / (2.0f * a));
    }