Improve physical geometry, fluid solvers, audio, and profiling
This commit is contained in:
42
include/FluidSim/PhysicalGeometry.hpp
Normal file
42
include/FluidSim/PhysicalGeometry.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "FluidSim/AudioProcessing.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fluidsim::port {
|
||||
struct EngineConfig;
|
||||
struct ExhaustConfig;
|
||||
struct JunctionConfig;
|
||||
struct TwoStrokeConfig;
|
||||
struct GeometryPath {
|
||||
bool operator==(const GeometryPath&) const = default;
|
||||
std::vector<Vec3> points;
|
||||
float length() const;
|
||||
Vec3 position(float distance) const;
|
||||
};
|
||||
struct GeometryBox {
|
||||
bool operator==(const GeometryBox&) const = default;
|
||||
Vec3 center{},size{};
|
||||
float volume() const {return size.x*size.y*size.z;}
|
||||
Vec3 minimum() const {return {center.x-size.x*.5f,center.y-size.y*.5f,center.z-size.z*.5f};}
|
||||
Vec3 maximum() const {return {center.x+size.x*.5f,center.y+size.y*.5f,center.z+size.z*.5f};}
|
||||
};
|
||||
struct GeometryVolume {std::string id;GeometryBox box;bool operator==(const GeometryVolume&) const = default;};
|
||||
struct CylinderPlacement {Vec3 origin{};float tilt_degrees{};bool operator==(const CylinderPlacement&) const = default;};
|
||||
struct PhysicalGeometry {
|
||||
bool operator==(const PhysicalGeometry&) const = default;
|
||||
std::vector<GeometryPath> pipes;
|
||||
std::vector<GeometryVolume> volumes;
|
||||
std::vector<CylinderPlacement> cylinders;
|
||||
const GeometryBox* volume(const std::string& id) const;
|
||||
GeometryBox* volume(const std::string& id);
|
||||
bool empty() const {return pipes.empty();}
|
||||
};
|
||||
float geometry_distance(Vec3 a,Vec3 b);
|
||||
Vec3 cylinder_point(const CylinderPlacement& cylinder,Vec3 local);
|
||||
PhysicalGeometry default_geometry(const EngineConfig&,const ExhaustConfig&,const JunctionConfig&);
|
||||
PhysicalGeometry default_geometry(const TwoStrokeConfig&);
|
||||
EngineConfig resolve_engine_geometry(EngineConfig,const ExhaustConfig&,const JunctionConfig&);
|
||||
TwoStrokeConfig resolve_two_stroke_geometry(TwoStrokeConfig);
|
||||
void validate_geometry(const PhysicalGeometry&,std::size_t pipes,std::size_t cylinders);
|
||||
}
|
||||
Reference in New Issue
Block a user