A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://alandefreitas.github.io/matplotplusplus/plot-types/vector-fields/quiver-3d/ below:

Quiver 3D - Matplot++

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <cmath>
#include <matplot/matplot.h>

matplot::vector_2d get_u();
matplot::vector_2d get_v();
matplot::vector_2d get_w();

int main() {
    using namespace matplot;
    vector_1d x = iota(-3, 0.5, 3);
    vector_1d y = iota(-3, 0.5, 3);
    auto [X, Y] = meshgrid(x, y);
    vector_2d Z = transform(
        X, Y, [](double x, double y) { return pow(y, 2) - pow(x, 2); });
    auto U = get_u();
    auto V = get_v();
    auto W = get_w();

    quiver3(Z, U, V, W, 5);
    view(-35, 45);

    show();
    return 0;
}

matplot::vector_2d get_u() {
    matplot::vector_2d x = {
        {-0.688247, -0.620174, -0.534522, -0.428571, -0.301511, -0.156174, 0,
         0.156174, 0.301511, 0.428571, 0.534522, 0.620174, 0.688247},
        {-0.744208, -0.680414, -0.596285, -0.486664, -0.348155, -0.182574, 0,
         0.182574, 0.348155, 0.486664, 0.596285, 0.680414, 0.744208},
        {-0.801784, -0.745356, -0.666667, -0.557086, -0.408248, -0.218218, 0,
         0.218218, 0.408248, 0.557086, 0.666667, 0.745356, 0.801784},
        {-0.857143, -0.811107, -0.742781, -0.639602, -0.485071, -0.267261, 0,
         0.267261, 0.485071, 0.639602, 0.742781, 0.811107, 0.857143},
        {-0.904534, -0.870388, -0.816497, -0.727607, -0.57735, -0.333333, 0,
         0.333333, 0.57735, 0.727607, 0.816497, 0.870388, 0.904534},
        {-0.937043, -0.912871, -0.872872, -0.801784, -0.666667, -0.408248, 0,
         0.408248, 0.666667, 0.801784, 0.872872, 0.912871, 0.937043},
        {-0.948683, -0.928477, -0.894427, -0.83205, -0.707107, -0.447214, -0,
         0.447214, 0.707107, 0.83205, 0.894427, 0.928477, 0.948683},
        {-0.937043, -0.912871, -0.872872, -0.801784, -0.666667, -0.408248, -0,
         0.408248, 0.666667, 0.801784, 0.872872, 0.912871, 0.937043},
        {-0.904534, -0.870388, -0.816497, -0.727607, -0.57735, -0.333333, -0,
         0.333333, 0.57735, 0.727607, 0.816497, 0.870388, 0.904534},
        {-0.857143, -0.811107, -0.742781, -0.639602, -0.485071, -0.267261, -0,
         0.267261, 0.485071, 0.639602, 0.742781, 0.811107, 0.857143},
        {-0.801784, -0.745356, -0.666667, -0.557086, -0.408248, -0.218218, -0,
         0.218218, 0.408248, 0.557086, 0.666667, 0.745356, 0.801784},
        {-0.744208, -0.680414, -0.596285, -0.486664, -0.348155, -0.182574, -0,
         0.182574, 0.348155, 0.486664, 0.596285, 0.680414, 0.744208},
        {-0.688247, -0.620174, -0.534522, -0.428571, -0.301511, -0.156174, -0,
         0.156174, 0.301511, 0.428571, 0.534522, 0.620174, 0.688247}};
    return x;
}

matplot::vector_2d get_v() {
    matplot::vector_2d x = {
        {0.688247, 0.744208, 0.801784, 0.857143, 0.904534, 0.937043, 0.948683,
         0.937043, 0.904534, 0.857143, 0.801784, 0.744208, 0.688247},
        {0.620174, 0.680414, 0.745356, 0.811107, 0.870388, 0.912871, 0.928477,
         0.912871, 0.870388, 0.811107, 0.745356, 0.680414, 0.620174},
        {0.534522, 0.596285, 0.666667, 0.742781, 0.816497, 0.872872, 0.894427,
         0.872872, 0.816497, 0.742781, 0.666667, 0.596285, 0.534522},
        {0.428571, 0.486664, 0.557086, 0.639602, 0.727607, 0.801784, 0.83205,
         0.801784, 0.727607, 0.639602, 0.557086, 0.486664, 0.428571},
        {0.301511, 0.348155, 0.408248, 0.485071, 0.57735, 0.666667, 0.707107,
         0.666667, 0.57735, 0.485071, 0.408248, 0.348155, 0.301511},
        {0.156174, 0.182574, 0.218218, 0.267261, 0.333333, 0.408248, 0.447214,
         0.408248, 0.333333, 0.267261, 0.218218, 0.182574, 0.156174},
        {-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0},
        {-0.156174, -0.182574, -0.218218, -0.267261, -0.333333, -0.408248,
         -0.447214, -0.408248, -0.333333, -0.267261, -0.218218, -0.182574,
         -0.156174},
        {-0.301511, -0.348155, -0.408248, -0.485071, -0.57735, -0.666667,
         -0.707107, -0.666667, -0.57735, -0.485071, -0.408248, -0.348155,
         -0.301511},
        {-0.428571, -0.486664, -0.557086, -0.639602, -0.727607, -0.801784,
         -0.83205, -0.801784, -0.727607, -0.639602, -0.557086, -0.486664,
         -0.428571},
        {-0.534522, -0.596285, -0.666667, -0.742781, -0.816497, -0.872872,
         -0.894427, -0.872872, -0.816497, -0.742781, -0.666667, -0.596285,
         -0.534522},
        {-0.620174, -0.680414, -0.745356, -0.811107, -0.870388, -0.912871,
         -0.928477, -0.912871, -0.870388, -0.811107, -0.745356, -0.680414,
         -0.620174},
        {-0.688247, -0.744208, -0.801784, -0.857143, -0.904534, -0.937043,
         -0.948683, -0.937043, -0.904534, -0.857143, -0.801784, -0.744208,
         -0.688247}};
    return x;
}

matplot::vector_2d get_w() {
    matplot::vector_2d x = {
        {0.229416, 0.248069, 0.267261, 0.285714, 0.301511, 0.312348, 0.316228,
         0.312348, 0.301511, 0.285714, 0.267261, 0.248069, 0.229416},
        {0.248069, 0.272166, 0.298142, 0.324443, 0.348155, 0.365148, 0.371391,
         0.365148, 0.348155, 0.324443, 0.298142, 0.272166, 0.248069},
        {0.267261, 0.298142, 0.333333, 0.371391, 0.408248, 0.436436, 0.447214,
         0.436436, 0.408248, 0.371391, 0.333333, 0.298142, 0.267261},
        {0.285714, 0.324443, 0.371391, 0.426401, 0.485071, 0.534522, 0.5547,
         0.534522, 0.485071, 0.426401, 0.371391, 0.324443, 0.285714},
        {0.301511, 0.348155, 0.408248, 0.485071, 0.57735, 0.666667, 0.707107,
         0.666667, 0.57735, 0.485071, 0.408248, 0.348155, 0.301511},
        {0.312348, 0.365148, 0.436436, 0.534522, 0.666667, 0.816497, 0.894427,
         0.816497, 0.666667, 0.534522, 0.436436, 0.365148, 0.312348},
        {0.316228, 0.371391, 0.447214, 0.5547, 0.707107, 0.894427, 1, 0.894427,
         0.707107, 0.5547, 0.447214, 0.371391, 0.316228},
        {0.312348, 0.365148, 0.436436, 0.534522, 0.666667, 0.816497, 0.894427,
         0.816497, 0.666667, 0.534522, 0.436436, 0.365148, 0.312348},
        {0.301511, 0.348155, 0.408248, 0.485071, 0.57735, 0.666667, 0.707107,
         0.666667, 0.57735, 0.485071, 0.408248, 0.348155, 0.301511},
        {0.285714, 0.324443, 0.371391, 0.426401, 0.485071, 0.534522, 0.5547,
         0.534522, 0.485071, 0.426401, 0.371391, 0.324443, 0.285714},
        {0.267261, 0.298142, 0.333333, 0.371391, 0.408248, 0.436436, 0.447214,
         0.436436, 0.408248, 0.371391, 0.333333, 0.298142, 0.267261},
        {0.248069, 0.272166, 0.298142, 0.324443, 0.348155, 0.365148, 0.371391,
         0.365148, 0.348155, 0.324443, 0.298142, 0.272166, 0.248069},
        {0.229416, 0.248069, 0.267261, 0.285714, 0.301511, 0.312348, 0.316228,
         0.312348, 0.301511, 0.285714, 0.267261, 0.248069, 0.229416}};
    return x;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4