numerics
Loading...
Searching...
No Matches
main.cpp File Reference

SPH fluid simulation with raylib visualization. More...

#include "raylib.h"
#include "fluid.hpp"
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>

Go to the source code of this file.

Functions

Vector2 sim_to_screen (float sx, float sy)
 
void sim_to_screen (float sx, float sy, float &px, float &py)
 
void screen_to_sim (float px, float py, float &sx, float &sy)
 
int main ()
 

Detailed Description

SPH fluid simulation with raylib visualization.

Dam-break scenario: fluid falls onto a hot sphere (90 degC) and a cold sphere (0 degC). Heat diffuses between particles and exchanges with rigid bodies.

Controls: SPACE – pause / resume R – reset to initial state LMB drag – spawn cool water particles (20 degC) RMB drag – spawn hot water particles (85 degC) +/- – increase / decrease simulation speed (substeps per frame) ESC – quit

Definition in file main.cpp.

Function Documentation

◆ main()

◆ screen_to_sim()

void screen_to_sim ( float  px,
float  py,
float &  sx,
float &  sy 
)
inline

Definition at line 40 of file main.cpp.

Referenced by main().

◆ sim_to_screen() [1/2]

Vector2 sim_to_screen ( float  sx,
float  sy 
)
inline

Definition at line 31 of file main.cpp.

Referenced by main().

◆ sim_to_screen() [2/2]

void sim_to_screen ( float  sx,
float  sy,
float &  px,
float &  py 
)
inline

Definition at line 35 of file main.cpp.