-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForce.cpp
executable file
·45 lines (45 loc) · 1.95 KB
/
Force.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
///////////////////////////////////////////////////////////////////////////////
// This file is part of ShapeOp, a lightweight C++ library
// for static and dynamic geometry processing.
//
// Copyright (C) 2014 Sofien Bouaziz <sofien.bouaziz@gmail.com>
// Copyright (C) 2014 LGG EPFL
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
///////////////////////////////////////////////////////////////////////////////
#include "Force.h"
///////////////////////////////////////////////////////////////////////////////
namespace ShapeOp {
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE GravityForce::GravityForce(const Vector3 &f) :
f_(f) {
}
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE Vector3 GravityForce::get(const Matrix3X &/*positions*/, int /*id*/) const {
return f_;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE VertexForce::VertexForce(const Vector3 &f, int id) :
f_(f), id_(id) {
}
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE Vector3 VertexForce::get(const Matrix3X &/*position*/, int id) const {
if (id == id_)
return f_;
else
return Vector3::Zero();
}
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE void VertexForce::setId(int id) {
id_ = id;
}
///////////////////////////////////////////////////////////////////////////////
SHAPEOP_INLINE void VertexForce::setForce(const Vector3 &f) {
f_ = f;
}
///////////////////////////////////////////////////////////////////////////////
} // namespace ShapeOp
///////////////////////////////////////////////////////////////////////////////