Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
Capsule Class Reference

specialised particle that represent a capsule More...

#include <Capsule.h>

Inheritance diagram for Capsule:
Collaboration diagram for Capsule:

List of all members.

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

Detailed Description

specialised particle that represent a capsule

Definition at line 16 of file Capsule.h.


Constructor & Destructor Documentation

Capsule::Capsule ( )

ctor

Definition at line 8 of file Capsule.cpp.

                 : Particle()
{
    Capsule(0);
}
Capsule::Capsule ( const Capsule _capsule)

copy ctor

Parameters:
[in]_capsulethe 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();
}

Here is the call graph for this function:

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

Parameters:
[in]_idthe id of the capsule
[in]_massthe mass of the capsule
[in]_centerPositionthe center position of the capsule
[in]_colourthe colour of the capsule
[in]_radiusthe radius of the capsule
[in]_heightthe height of the capsule
[in]_orientationVectorthe orientation of the capsule
[in]_incrementAnglethe increment angle for the capsule rotation
[in]_initialAnglethe initial angle of the capsule orientation
[in]_moveableflag 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 ( )

dtor

Definition at line 65 of file Capsule.cpp.

{
}

Member Function Documentation

float Capsule::getAngle ( ) const [inline]

return the angle of rotation

Definition at line 64 of file Capsule.h.

References m_angle.

{ return m_angle; }

Here is the caller graph for this function:

ngl::Real Capsule::getHeight ( ) const [inline]

return the height

Definition at line 70 of file Capsule.h.

References m_height.

{ return m_height; }

Here is the caller graph for this function:

float Capsule::getIncrementAngle ( ) const [inline]

return the increment angle

Definition at line 61 of file Capsule.h.

References m_incrementAngle.

{ return m_incrementAngle; }

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

ngl::Vector Capsule::getOrientationVector ( ) const [inline]

return the orientation vector

Definition at line 55 of file Capsule.h.

References m_orientationVector.

{ return m_orientationVector; }

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

void Capsule::setIncrementAngle ( const ngl::Real  _v) [inline]

set the increment angle

Parameters:
[in]_vthe 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();
}

Here is the caller graph for this function:


Member Data Documentation

ngl::Real Capsule::m_angle [private]

angle of rotation

Definition at line 91 of file Capsule.h.

ngl::Real Capsule::m_height [private]

half height from center position

Definition at line 88 of file Capsule.h.

ngl::Real Capsule::m_incrementAngle [private]

increment angle

Definition at line 94 of file Capsule.h.

ngl::Real Capsule::m_initialAngle [private]

initial angle of orientation

Definition at line 97 of file Capsule.h.

ngl::Vector Capsule::m_orientationVector [private]

orientation vector connecting 2 endpoints

Definition at line 85 of file Capsule.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator