HighMap library (C++)
Loading...
Searching...
No Matches
particles.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
15#pragma once
16
17#include "highmap/algebra.hpp"
18#include "highmap/array.hpp"
19
20#define HMAP_PARTICLES_GRADIENT_MIN 0.0001f
21#define HMAP_PARTICLES_VELOCITY_MIN 0.001f
22
23namespace hmap
24{
25
26struct Pos
27{
28 float x;
29 float y;
30 int i;
31 int j;
32 float u;
33 float v;
34};
35
37{
38 // parameters
40 float c_erosion;
42 float c_inertia;
43 float drag_rate;
44
45 // features
46 float sediment = 0.f;
47 float volume = 0.f; // water
48
49 // dynamic
52 float vnorm;
53 bool vlim = 1.f;
54 bool is_active = true;
55
56 // constructor
57 Particle(float c_capacity,
58 float c_erosion,
59 float c_deposition,
60 float c_inertia,
61 float drag_rate);
62
63 // methods
64 void move(const Array &h, float dt);
65
66 void set_xy(float x, float y);
67};
68
69} // namespace hmap
Header file defining basic vector and matrix manipulation classes.
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:32
Definition algebra.hpp:28
Definition particles.hpp:37
void set_xy(float x, float y)
Definition particles.cpp:73
void move(const Array &h, float dt)
Definition particles.cpp:25
float c_capacity
Definition particles.hpp:39
float c_erosion
Definition particles.hpp:40
bool is_active
Definition particles.hpp:54
Vec2< float > vel
Definition particles.hpp:51
float vnorm
Definition particles.hpp:52
float volume
Definition particles.hpp:47
Pos pos
Definition particles.hpp:50
float c_deposition
Definition particles.hpp:41
float drag_rate
Definition particles.hpp:43
float sediment
Definition particles.hpp:46
float c_inertia
Definition particles.hpp:42
bool vlim
Definition particles.hpp:53
Definition particles.hpp:27
int i
Definition particles.hpp:30
float u
Definition particles.hpp:32
int j
Definition particles.hpp:31
float v
Definition particles.hpp:33
float y
Definition particles.hpp:29
float x
Definition particles.hpp:28
Vec2 class for basic manipulation of 2D vectors.
Definition algebra.hpp:40