Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
|
specialised particle that represent a capsule More...
#include <Capsule.h>
Public Member Functions | |
Capsule () | |
ctor | |
Capsule (const Capsule &_capsule) | |
copy ctor | |
Capsule (const int _id, const ngl::Real _mass=0, const ngl::Vector _centerPosition=0, const ngl::Colour _colour=0, const ngl::Real _radius=0, const ngl::Real _height=0, const ngl::Vector _orientationVector=0, const ngl::Real _incrementAngle=0, const ngl::Real _initialAngle=0, const bool _moveable=true) | |
ctor | |
~Capsule () | |
dtor | |
ngl::Vector | getOrientationVector () const |
return the orientation vector | |
void | updateRotation () |
rotates the capsule at each iteration | |
float | getIncrementAngle () const |
return the increment angle | |
float | getAngle () const |
return the angle of rotation | |
float | getInitialAngle () const |
return the initial angle of orientation | |
ngl::Real | getHeight () const |
return the height | |
ngl::Vector | getPoint1 () const |
return the first endpoint of the capsule | |
ngl::Vector | getPoint2 () const |
return the second endpoint of the capsule | |
void | setIncrementAngle (const ngl::Real _v) |
set the increment angle | |
Private Attributes | |
ngl::Vector | m_orientationVector |
orientation vector connecting 2 endpoints | |
ngl::Real | m_height |
half height from center position | |
ngl::Real | m_angle |
angle of rotation | |
ngl::Real | m_incrementAngle |
increment angle | |
ngl::Real | m_initialAngle |
initial angle of orientation |
Capsule::Capsule | ( | ) |
Capsule::Capsule | ( | const Capsule & | _capsule | ) |
copy ctor
[in] | _capsule | the copied object |
Definition at line 14 of file Capsule.cpp.
References getAngle(), getHeight(), getIncrementAngle(), getInitialAngle(), and getOrientationVector().
: Particle ( _particle.getId(), _particle.getMass(), _particle.getPosition(), _particle.getColour(), _particle.getRadius(), _particle.getMoveable() ) { m_height = _particle.getHeight(); m_orientationVector = _particle.getOrientationVector(); m_incrementAngle = _particle.getIncrementAngle(); m_angle = _particle.getAngle(); m_initialAngle = _particle.getInitialAngle(); }
Capsule::Capsule | ( | const int | _id, |
const ngl::Real | _mass = 0 , |
||
const ngl::Vector | _centerPosition = 0 , |
||
const ngl::Colour | _colour = 0 , |
||
const ngl::Real | _radius = 0 , |
||
const ngl::Real | _height = 0 , |
||
const ngl::Vector | _orientationVector = 0 , |
||
const ngl::Real | _incrementAngle = 0 , |
||
const ngl::Real | _initialAngle = 0 , |
||
const bool | _moveable = true |
||
) |
ctor
[in] | _id | the id of the capsule |
[in] | _mass | the mass of the capsule |
[in] | _centerPosition | the center position of the capsule |
[in] | _colour | the colour of the capsule |
[in] | _radius | the radius of the capsule |
[in] | _height | the height of the capsule |
[in] | _orientationVector | the orientation of the capsule |
[in] | _incrementAngle | the increment angle for the capsule rotation |
[in] | _initialAngle | the initial angle of the capsule orientation |
[in] | _moveable | flag to determine whether capsule is static |
Definition at line 39 of file Capsule.cpp.
: Particle(_id, _mass, _centerPosition, _colour, _radius, _moveable) { //init params m_height = _height; m_orientationVector = _orientationVector; m_incrementAngle = _incrementAngle; m_angle = _initialAngle; m_initialAngle = _initialAngle; }
Capsule::~Capsule | ( | ) |
float Capsule::getAngle | ( | ) | const [inline] |
ngl::Real Capsule::getHeight | ( | ) | const [inline] |
float Capsule::getIncrementAngle | ( | ) | const [inline] |
return the increment angle
Definition at line 61 of file Capsule.h.
References m_incrementAngle.
{ return m_incrementAngle; }
float Capsule::getInitialAngle | ( | ) | const [inline] |
return the initial angle of orientation
Definition at line 67 of file Capsule.h.
References m_initialAngle.
{ return m_initialAngle; }
ngl::Vector Capsule::getOrientationVector | ( | ) | const [inline] |
return the orientation vector
Definition at line 55 of file Capsule.h.
References m_orientationVector.
{ return m_orientationVector; }
ngl::Vector Capsule::getPoint1 | ( | ) | const [inline] |
return the first endpoint of the capsule
Definition at line 73 of file Capsule.h.
References m_height, m_orientationVector, and Particle::m_position.
{ return m_position - (m_height * m_orientationVector); }
ngl::Vector Capsule::getPoint2 | ( | ) | const [inline] |
return the second endpoint of the capsule
Definition at line 76 of file Capsule.h.
References m_height, m_orientationVector, and Particle::m_position.
{ return m_position + (m_height * m_orientationVector); }
void Capsule::setIncrementAngle | ( | const ngl::Real | _v | ) | [inline] |
set the increment angle
[in] | _v | the new increment angle |
Definition at line 80 of file Capsule.h.
References m_incrementAngle.
{ m_incrementAngle = _v; }
void Capsule::updateRotation | ( | ) |
rotates the capsule at each iteration
Definition at line 69 of file Capsule.cpp.
References m_angle, m_incrementAngle, m_orientationVector, and Particle::m_position.
{ //increment angle m_angle += m_incrementAngle; //convert degrees to radians float angle = m_angle * (M_PI / 180.0); //calculate new positions following rotations (using pythagoras theorem) float x1 = m_position.m_x + cos(angle); float z1 = m_position.m_z + sin(angle); //set orientation to a normalised vector from centre position to the new position m_orientationVector = m_position - ngl::Vector(x1, m_position.m_y, z1); m_orientationVector.normalize(); }
ngl::Real Capsule::m_angle [private] |
ngl::Real Capsule::m_height [private] |
ngl::Real Capsule::m_incrementAngle [private] |
ngl::Real Capsule::m_initialAngle [private] |
ngl::Vector Capsule::m_orientationVector [private] |