Beispiel #1
0
    public static int Main()
    {
        var v = new vector3d(1, 2, 3);
        var u = new vector3d(3, 4, 5);

        WriteLine($"{v} + {u} = {v+u}");
        WriteLine($"{v} - {u} = {v-u}");
        WriteLine($"{v} * {2} = {v*2}");
        WriteLine($"{2} * {v} = {2*v}");
        WriteLine($"{v} dot {u} = {v.dot_product(u)}");
        WriteLine($"{v} cross {u} = {v.cross_product(u)}");
        WriteLine($"The magnitude of the vector {v} is {vector3d.magnitude(v)}");
        WriteLine($"{v} / {2} = {v/2}");
        v.x = 9;
        WriteLine(v);
        return(0);
    }
Beispiel #2
0
    static void Main()
    {
        vector3d v = new vector3d(1, 2, 3);

        Write("v = {0}\n", v);

        ivector3d iv = new vector3d(4, 5, 6);

        Write("iv = {0}\n", iv);

        ivector3d iv2 = new vector3d_array(7, 8, 9);

        Write("iv2 = {0}\n", iv2);

        iv2 = v.cross_product(iv);
        Write("iv2 = v x iv = {0}\n", iv2);
    }