Initial commit.
This commit is contained in:
commit
44b5f2392f
98 changed files with 11750 additions and 0 deletions
20
room_force.cpp
Normal file
20
room_force.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
#include "room_force.h"
|
||||
#include "physics/particle.h"
|
||||
#include "physics/vector.h"
|
||||
|
||||
using namespace mbostock;
|
||||
|
||||
ConstantRoomForce::ConstantRoomForce(const Vector& min, const Vector& max,
|
||||
const Vector& f)
|
||||
: box_(min, max), force_(f) {
|
||||
}
|
||||
|
||||
const Shape& ConstantRoomForce::shape() const {
|
||||
return box_;
|
||||
}
|
||||
|
||||
Vector ConstantRoomForce::force(const Particle& p) {
|
||||
return box_.contains(p.position) ? force_ : Vector::ZERO();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue