Skip to content

Commit

Permalink
Friction bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuedholt committed Jan 9, 2025
1 parent 3ea5d08 commit 1ac937a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/pysdt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ void add_interactors_submodule(nb::module_& root) {
.SDT_BIND_PROPERTY_RW(stiffness, Impact, Stiffness, double)
.SDT_BIND_PROPERTY_RW(dissipation, Impact, Dissipation, double)
.SDT_BIND_PROPERTY_RW(shape, Impact, Shape, double);

nb::class_<Friction, Interactor>(m, "Friction")
.def(nb::init<>())
.SDT_BIND_PROPERTY_RW(normal_force, Friction, NormalForce, double)
.SDT_BIND_PROPERTY_RW(stribeck_velocity, Friction, StribeckVelocity, double)
.SDT_BIND_PROPERTY_RW(static_coefficient, Friction, StaticCoefficient, double)
.SDT_BIND_PROPERTY_RW(dynamic_coefficient, Friction, DynamicCoefficient, double)
.SDT_BIND_PROPERTY_RW(break_away, Friction, BreakAway, double)
.SDT_BIND_PROPERTY_RW(stiffness, Friction, Stiffness, double)
.SDT_BIND_PROPERTY_RW(dissipation, Friction, Dissipation, double)
.SDT_BIND_PROPERTY_RW(viscosity, Friction, Viscosity, double)
.SDT_BIND_PROPERTY_RW(noisiness, Friction, Noisiness, double);
}

void add_liquids_submodule(nb::module_& root) {
Expand Down Expand Up @@ -451,6 +463,7 @@ void add_resonators_submodule(nb::module_& root) {
.SDT_BIND_PROPERTY_RW(fragment_size, Resonator, FragmentSize, double)
.def("apply_force", &Resonator::applyForce)
.def("compute_energy", &Resonator::computeEnergy)
.def("update", &Resonator::update)
.def("dsp", &Resonator::dsp);
}

Expand Down
2 changes: 2 additions & 0 deletions src/wrappers/Resonators.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace sdtwrappers {
void applyForce(const unsigned int pickup, const double f) { SDTResonator_applyForce(ptr.get(), pickup, f); }
double computeEnergy(const unsigned int pickup, const double f) { return SDTResonator_computeEnergy(ptr.get(), pickup, f); }

void update() { SDTResonator_update(ptr.get()); }

void dsp() { SDTResonator_dsp(ptr.get()); }
};
}

0 comments on commit 1ac937a

Please sign in to comment.