PeriDyno 1.0.0
Loading...
Searching...
No Matches
BoundaryConstraint.h
Go to the documentation of this file.
1#pragma once
3
4namespace dyno {
5
6 template<typename TDataType> class DistanceField3D;
7
8 template<typename TDataType>
10 {
11 //DECLARE_TCLASS(BoundaryConstraint, TDataType)
12 public:
13 typedef typename TDataType::Real Real;
14 typedef typename TDataType::Coord Coord;
15
18
19 void constrain() override;
20
21 bool constrain(DArray<Coord>& position, DArray<Coord>& velocity, Real dt);
22
24
25 void load(std::string filename, bool inverted = false);
26 void setCube(Coord lo, Coord hi, Real distance, bool inverted = false);
27 void setSphere(Coord center, Real r, Real distance, bool inverted = false);
28 void setCylinder(Coord center, Real r, Real height, Real distance, int axis, bool inverted = false);
29
30 public:
33
34 DEF_VAR(Real, TangentialFriction, Real(0.95), "Tangential friction");
35 DEF_VAR(Real, NormalFriction, Real(0), "Normal friction");
36
37 std::shared_ptr<DistanceField3D<TDataType>> m_cSDF;
38 };
39}
void constrain(DArray< Coord > &position, DArray< Coord > &velocity, DistanceField3D< TDataType > &sdf, Real dt)
DEF_VAR(Real, TangentialFriction, Real(0.95), "Tangential friction")
void setCylinder(Coord center, Real r, Real height, Real distance, int axis, bool inverted=false)
~BoundaryConstraint() override
DeviceArrayField< Coord > m_position
std::shared_ptr< DistanceField3D< TDataType > > m_cSDF
DEF_VAR(Real, NormalFriction, Real(0), "Normal friction")
void setSphere(Coord center, Real r, Real distance, bool inverted=false)
void constrain() override
void load(std::string filename, bool inverted=false)
void setCube(Coord lo, Coord hi, Real distance, bool inverted=false)
DeviceArrayField< Coord > m_velocity
bool constrain(DArray< Coord > &position, DArray< Coord > &velocity, Real dt)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89
FArray< T, DeviceType::GPU > DeviceArrayField
Definition Field.h:279