29 lines
508 B
C++
29 lines
508 B
C++
|
/**
|
||
|
* Implementation of a spheroid
|
||
|
**/
|
||
|
|
||
|
#include "spheroid.hpp"
|
||
|
|
||
|
Spheroid::Spheroid(Point& _center, size_t _p, size_t _q) :
|
||
|
center(_center), p(_p), q(_q), stiffness(0) {
|
||
|
_compute_volume();
|
||
|
}
|
||
|
|
||
|
void Spheroid::_compute_volume() {
|
||
|
V = (4/3) * PI * p * q * q;
|
||
|
}
|
||
|
|
||
|
void Spheroid::set_stiffness(size_t _stiffness) {
|
||
|
stiffness = _stiffness;
|
||
|
}
|
||
|
|
||
|
|
||
|
void Spheroid::update_radius() {
|
||
|
q = sqrt((3/4) * V / PI / p);
|
||
|
}
|
||
|
|
||
|
|
||
|
void Spheroid::update_center_pos(Point& _center) {
|
||
|
center = _center;
|
||
|
}
|