nut-code-monkey / field

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Field with Radius and Step

typedef double Value;
typedef double Coord;
typedef field::Field<Value, Coord> Field;

size_t radius = 5;
double step = 0.345;
Field field(radius, step);

for (auto i: field) { // enumerate through all points 
    auto p = i.coord; // access to point coordinate
    auto distance = sqrt(p.x*p.x + p.y*p.y);
    *i = distance;    // read/write access to field value
}

auto cellSize = 20;
Display("distance", cellSize).diplay(field, Display::Wait);

About

License:MIT License


Languages

Language:C++ 100.0%