DLA-Fire-Prediction-Thesis 1.0

FirePath Class Reference

#include <FirePath.h>

List of all members.

Public Member Functions

 FirePath (std::vector< FuelPoint > _allDLAList, std::vector< FuelPoint > _allDLALine, std::vector< FuelPoint > _fuelList, float _approxObjMoisture, std::vector< FuelPoint > _originList, bool _windStatus, int _windSpeed, ngl::Vector _windDirection)
 ctor of fire path. It would assign the area point, dla point, wind variables and scene weather variables
void drawDLAPath (const std::string &_shaderName, ngl::TransformStack &_transformStack)
 This method will draw fire path from the calculated from burning time.
void updateDLAList (std::vector< FuelPoint > _allDLAList, std::vector< FuelPoint > _allDLALine)
 This method will update the dla point list whenever the new fire path is generated.
void updateFuelOnGrid (std::vector< FuelPoint > _fuelOnGridList)
 This method will update the fuel object variables list.
void resetFuel ()
 This method will reset the fuel object colour to initial colour.
std::vector< FuelPointgetCurrentFuelList ()
 This method will return the current fuel object variables list @return m_fuelOnGridList is the fuel object list.
void resetFuelListToOriginal ()
 This method will reset the fuel object variables to initial state.
void timeUpdate (int _time)
 This method will update the fire path along the time.
void resetList ()
 This method will reset all the list to initial state.
void controlFirePathColour ()
 This method will control the colout of fire path.
void assignNewMoisture (double _newMoisture)
 This method will adjust the moisture value of fire scene.
void assignNewTemp (double _newTemp)
 This method will adjust the temperatue of fire scene.
void setFirePath ()
 This method will set the dla path to be ready to fire.
void assignNewObjMoisture (float _newObjMoisture)
 This method will adjust the moisture value of fuel object.
void analyzeBurningArea ()
 This method will analyze the current burning area with the fuel object and heat transferring.
void setNewOriginList (std::vector< FuelPoint > _newOriginList)
 This method will update the origin list whenever the new fire path is generated or adjusted the origin amount.
void analyzeDLAAmount (int m_newTime)
 This method will analyze the current burning spot respecting to burning time of each fuel at the current time step.
void resetGrid (std::vector< FuelPoint > _currentGridPoint)
 This method will update the grid point.
void pauseTheAnimation (bool _status)
 This method will toggle the animation.
int getIndexNumber (ngl::Vector m_position)
 This method will return the index number of head dla point.
void transferHeat (int m_gridIndex, int m_heat, int m_mode)
 This method will transfer the heat to surrounding area.
void calculateRateOfGrowth ()
 This method will calculate the fire spread rate.
bool checkCollisionWithBurningArea (ngl::Vector m_currentPos)
 This method will check collision with burning area with the current new born fire point.
void showFireLineOnly (bool _showingLineOnlyStatus)
 This method will toggle the only line showing.

Private Attributes

std::vector< FuelPointm_fireDLAForm
 the list contains dla point, which it concerns as the head of fire point
std::vector< FuelPointm_fireDLALine
 the list contains dla point, which it concerns as the tail of fire point
std::vector< FuelPointm_fuelOnGridList
 the list contains position and variables of flammable object
std::vector< FuelPointm_originalFuelOnGridList
 the list contains the initial fuel variables of flammable object
std::vector< FuelPointm_gridList
 the list contains point on the grid or fire scene
std::vector< FuelPointm_originList
 the list contains origin point
std::vector< FuelPointm_currentIndexForm
 the list contains current position of fire path drawing method
std::vector< FuelPointm_burningPointList
 burning dla point list
int m_timeStep
 current drawing time step
int m_currentDLAPointIndex
 current drawing index
bool m_allShow
 fire path drawing status that is drawn all of the dla point or not
float m_rateOfGrowth
 spread rate of fire
double m_sceneMoisture
 scene moisture
double m_sceneTemp
 scene temperature
float m_objMoisture
 fuel objec moisture value
bool m_pause
 animation pause status
ngl::Vector m_windDirection
 wind direction
int m_windSpeed
 wind speed
bool m_windEnable
 wind status
bool m_onlyLine
 only line showing status

Detailed Description

Definition at line 26 of file FirePath.h.


Constructor & Destructor Documentation

FirePath::FirePath ( std::vector< FuelPoint _allDLAList,
std::vector< FuelPoint _allDLALine,
std::vector< FuelPoint _fuelList,
float  _approxObjMoisture,
std::vector< FuelPoint _originList,
bool  _windStatus,
int  _windSpeed,
ngl::Vector  _windDirection 
)

ctor of fire path. It would assign the area point, dla point, wind variables and scene weather variables

Parameters:
_allDLAListis the dla tail point list
_allDLALineis the dla head point list
_fuelListis fuel object list
_approxObjMoistureis moisture of object
_originListis the origin list
_windStatusis the wind status
_windSpeedis the wind speed
_windDirectionis wind direction

Definition at line 20 of file FirePath.cpp.

References FuelPoint::changeColour(), FuelPoint::getColour(), FuelPoint::getGeneration(), FuelPoint::isFuel(), m_allShow, m_currentDLAPointIndex, m_currentIndexForm, m_fireDLAForm, m_fireDLALine, m_fuelOnGridList, m_gridList, m_objMoisture, m_onlyLine, m_originalFuelOnGridList, m_originList, m_pause, m_rateOfGrowth, m_sceneMoisture, m_sceneTemp, m_timeStep, m_windDirection, m_windEnable, m_windSpeed, setFirePath(), FuelPoint::setGeneration(), and FuelPoint::setGridIndex().

{
    m_fireDLAForm = _allDLAList;
    m_fireDLALine = _allDLALine;
    m_gridList = _fuelList;
    m_originList = _originList;

    std::vector<FuelPoint> m_emptyList;
    m_fuelOnGridList = m_emptyList;

    for(unsigned int q=0; q<m_gridList.size(); ++q)
    {
        FuelPoint m_gridPoint = m_gridList[q];

        m_gridPoint.setGridIndex(q);

        if(m_gridPoint.isFuel()==true)
            m_fuelOnGridList.push_back(m_gridPoint);
    }

    // set the fuel to be not burning first
    for(unsigned int m=0; m<m_fuelOnGridList.size(); ++m)
    {
        FuelPoint m_fuelPoint = m_fuelOnGridList[m];
        ngl::Vector m_fuelPointColour = m_fuelPoint.getColour();

        ngl::Vector m_newColour = ngl::Vector(m_fuelPointColour.m_y, m_fuelPointColour.m_x, m_fuelPointColour.m_z);
        m_fuelPoint.changeColour(m_newColour);

        m_fuelOnGridList[m] = m_fuelPoint;
    }

    m_originalFuelOnGridList = m_fuelOnGridList;

    m_currentDLAPointIndex = 1;
    m_sceneMoisture = 15.0;
    m_sceneTemp = 23.0;
    m_rateOfGrowth = 0.5;
    m_objMoisture = _approxObjMoisture;
    m_timeStep = 0;
    m_pause = false;
    m_onlyLine = true;

    // wind variables
    m_windEnable = _windStatus;
    m_windSpeed = _windSpeed;
    m_windDirection = _windDirection;

    // get maximum generation
    int m_generationCounter=0;
    for(unsigned int k=0; k<m_fireDLAForm.size(); ++k)
    {
        FuelPoint m = m_fireDLAForm[k];
        if(m_generationCounter<m.getGeneration())
            m_generationCounter = m.getGeneration();
    }

    for(unsigned int j=0; j<m_originList.size(); ++j)
    {
        FuelPoint m_origin = m_originList[j];
        m_origin.setGeneration(m_generationCounter);
        m_originList[j] = m_origin;
    }

    m_currentIndexForm.push_back(FuelPoint(ngl::Vector(m_currentDLAPointIndex, 0, m_fireDLAForm.size()-1,0), 0));

    setFirePath();
    m_allShow = false;
}

Here is the call graph for this function:


Member Function Documentation

void FirePath::analyzeBurningArea ( )

This method will analyze the current burning area with the fuel object and heat transferring.

Definition at line 766 of file FirePath.cpp.

References FuelPoint::changeColour(), FuelPoint::getBurningFormNumber(), FuelPoint::getColour(), FuelPoint::getCurrentFuelValue(), FuelPoint::getGridIndex(), FuelPoint::getMoisture(), FuelPoint::getPosition(), FuelPoint::isBurning(), FuelPoint::isBurningDown(), m_currentIndexForm, m_fireDLAForm, m_fuelOnGridList, m_gridList, m_rateOfGrowth, FuelPoint::setBurningFormNumber(), FuelPoint::setEmittedHeat(), FuelPoint::setFire(), FuelPoint::setFuelAmount(), FuelPoint::setNewMoisture(), and FuelPoint::subtractFuel().

{
    // checking with current burning point list
    for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
    {
        FuelPoint m_pointCurrent = m_currentIndexForm[a];
        ngl::Vector m_currentForm = m_pointCurrent.getPosition();
        int m_startIndex = m_currentForm.m_w;
        int m_currentIndex = m_currentForm.m_y;

        for(unsigned int i=m_startIndex; i<m_currentIndex; ++i)
        {
            FuelPoint m_gridPoint = m_fireDLAForm[i];
            int m_recentForm = a;

            // ----- analyze fuel object
            for(unsigned int x=0; x<m_fuelOnGridList.size(); ++x)
            {
                FuelPoint m_fuelPoint = m_fuelOnGridList[x];
                ngl::Vector m_fuelPointPos = m_fuelPoint.getPosition();

                ngl::Vector m_gridPointPos = m_gridPoint.getPosition();

                m_gridPointPos.m_y = 0.0;
                m_fuelPointPos.m_y = 0.0;

                ngl::Vector m_distanceVector = m_gridPointPos - m_fuelPointPos;
                float m_burningDistance = m_distanceVector.length();
                float m_fuelMoisture = m_fuelPoint.getMoisture();
                float m_fuelAmount = m_fuelPoint.getCurrentFuelValue();

                if(m_burningDistance<0.3)
                {
                    // ----- emitting heat
                    m_fuelPoint.setEmittedHeat(m_fuelAmount*20);
                    m_fuelPoint.setFire();

                    if(m_fuelMoisture>0.25)
                        m_fuelMoisture -= 0.01;
                    else
                        m_fuelMoisture = 0.25;

                    m_fuelPoint.setNewMoisture(m_fuelMoisture);

                    // the transparency needs to be lower than 0.25 before loosing the fuel
                    if(m_fuelMoisture<=0.25)
                    {
                        m_fuelPoint.subtractFuel(0.05*m_rateOfGrowth);
                    }
                    m_fuelPoint.setBurningFormNumber(m_recentForm);

                    bool m_checkBurntStatus = m_fuelPoint.isBurningDown();
                    if(m_checkBurntStatus==false)
                    {
                        ngl::Vector m_firePathColour = m_gridPoint.getColour();
                        //m_firePathColour.m_x = m_fuelAmount/100;
                        m_fuelPoint.changeColour(m_firePathColour);

                    }

                    m_fuelPoint.setBurningFormNumber(i);
                    m_fuelOnGridList[x] = m_fuelPoint;

                } // end if burning distance
            }
        } // end for loop of generation
    } // end for loop of dla form

    // ----- check within the fuel list
    for(unsigned int j=0; j<m_fuelOnGridList.size();++j)
    {
        FuelPoint m_burnFuelPoint = m_fuelOnGridList[j];
        float m_burningMoisture = m_burnFuelPoint.getMoisture();
        float m_fuelAmount = m_burnFuelPoint.getCurrentFuelValue();
        int m_closestFirePathIndex = m_burnFuelPoint.getBurningFormNumber();

        if(m_burnFuelPoint.isBurning()==true)
        {
            // ----- if sorrounding fuel is not burn yet
            m_burnFuelPoint.setEmittedHeat(m_fuelAmount*20);
            m_burnFuelPoint.setFire();

            if(m_burningMoisture>0.25)
                m_burningMoisture -= 0.005;
            else
                m_burningMoisture = 0.25;

            m_burnFuelPoint.setNewMoisture(m_burningMoisture);

            // the transparency needs to be lower than 0.25 before loosing the fuel
            if(m_burningMoisture<=0.25)
            {
                float m_subtractValue = 0.05;

                ngl::Vector m_pos = m_burnFuelPoint.getPosition();
                FuelPoint m_g = m_gridList[m_pos.m_w];

                if(m_fuelAmount>0.0)
                    m_burnFuelPoint.subtractFuel(m_subtractValue);
                else
                    m_burnFuelPoint.setFuelAmount(0.0);

                // find the closest fire path
                FuelPoint m_getClosestFirePath = m_fireDLAForm[m_closestFirePathIndex];
                bool m_checkBurntStatus = m_getClosestFirePath.isBurningDown();
                if(m_checkBurntStatus==false)
                {
                    ngl::Vector m_firePathColour = m_getClosestFirePath.getColour();
                    m_burnFuelPoint.changeColour(m_firePathColour);
                }

            }
            m_fuelOnGridList[j] = m_burnFuelPoint;
        }

        if(m_burningMoisture<=0.25)
        {
            int m_recentForm = m_burnFuelPoint.getBurningFormNumber();
            for(unsigned int s = 0; s<m_fuelOnGridList.size(); ++s)
            {
                if(s!=j)
                {
                    FuelPoint m_surroundingPoint = m_fuelOnGridList[s];
                    ngl::Vector m_fuelPos = m_burnFuelPoint.getPosition();
                    ngl::Vector m_surroundPos = m_surroundingPoint.getPosition();
                    ngl::Vector m_distScene = m_fuelPos - m_surroundPos;
                    float m_posDistance = m_distScene.length();
                    float m_fAmount = m_surroundingPoint.getCurrentFuelValue();

                    // ----- if the surround object
                    if(m_posDistance<=0.25)
                    {
                        if(m_surroundingPoint.isBurning()==false)
                        {
                            // ----- if sorrounding fuel is not burn yet
                            m_surroundingPoint.setEmittedHeat(m_fAmount*20);
                            m_surroundingPoint.setFire();

                            m_surroundingPoint.setBurningFormNumber(m_recentForm);
                            m_surroundingPoint.setBurningFormNumber(m_closestFirePathIndex);

                            m_fuelOnGridList[s] = m_surroundingPoint;

                            int m_groundPointIndex = m_surroundingPoint.getGridIndex();//m_surroundPos.m_w;
                            FuelPoint m_groundPoint = m_gridList[m_groundPointIndex];
                            m_groundPoint.setFire();

                            // input the form number if it is not already taken
                            if(m_recentForm<=-10)
                               m_groundPoint.setBurningFormNumber(-5);
                            else
                               m_groundPoint.setBurningFormNumber(m_recentForm);

                            // set colour
                            ngl::Vector m_colour = m_surroundingPoint.getColour();
                            m_groundPoint.changeColour(m_colour);

                            m_gridList[m_groundPointIndex] = m_groundPoint;

                        } // end if it is not ignited yet

                    } // end if the distance is within 0.25
                } // end if it's not duplicate index
            } // end for loop finding surrounding point
        } // end if it is be able to set the fire to surrounding fuel object
    } // end for loop of fuelongrid list
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::analyzeDLAAmount ( int  m_newTime)

This method will analyze the current burning spot respecting to burning time of each fuel at the current time step.

Parameters:
m_newTimeis the current time step

Definition at line 199 of file FirePath.cpp.

References FuelPoint::getBurningTime(), FuelPoint::getPosition(), m_allShow, m_currentIndexForm, m_fireDLAForm, and FuelPoint::setPosition().

{
    for(unsigned int n=0; n<m_currentIndexForm.size(); ++n)
    {
        FuelPoint m_pointCurrent = m_currentIndexForm[n];
        ngl::Vector m_currentForm = m_pointCurrent.getPosition();
        int m_startIndex = m_currentForm.m_w;
        int m_currentGeneration = m_currentForm.m_x;
        int m_currentIndex = m_currentForm.m_y;
        int m_lastIndexOfTheForm = m_currentForm.m_z;

        int m_genTotalTime = 0;
        int m_startTime = 25*n;

        for(unsigned int i=m_startIndex ;i<m_currentIndex; ++i)
        {
            FuelPoint m_firePoint = m_fireDLAForm[i];
            int m_theBurningTime = m_firePoint.getBurningTime();
            m_genTotalTime += m_theBurningTime;
        } // end for within the range

        if((m_genTotalTime<=m_newTime)&&(m_currentIndex<m_lastIndexOfTheForm)&&(m_startTime<m_newTime))
        {
            ++m_currentIndex;
            m_currentForm.m_y = m_currentIndex;
            m_pointCurrent.setPosition(m_currentForm);
            m_currentIndexForm[n] = m_pointCurrent;
            m_allShow = false;
        }
        else if(m_currentIndex>=m_lastIndexOfTheForm)
        {
            m_allShow = true;
        }

        // assign burning area, according to the time
       /* for(unsigned int f=m_startIndex; f<m_currentIndex; ++f)
        {
            FuelPoint m_firePoint = m_fireDLAForm[f];
            int m_recentForm = m_firePoint.getBurningFormNumber();
            m_firePoint.setGridIndex(f);
            if(m_recentForm<0)
                m_firePoint.setBurningFormNumber(n);

            bool m_isDraw = m_firePoint.canDraw();

            if(m_isDraw==true)
                m_burningPointList.push_back(m_firePoint);
        }*/

    } // end for loop of form number
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::assignNewMoisture ( double  _newMoisture)

This method will adjust the moisture value of fire scene.

Parameters:
_newMoistureis the new moisture value of the scene

Definition at line 630 of file FirePath.cpp.

References FuelPoint::getBurningTime(), FuelPoint::getMoisture(), FuelPoint::getPosition(), m_currentIndexForm, m_fireDLAForm, m_rateOfGrowth, m_sceneMoisture, FuelPoint::setBurningTime(), and FuelPoint::setNewMoisture().

{
    if(_newMoisture<m_sceneMoisture)
    {
        double m_deltaMoisture = m_sceneMoisture - _newMoisture;
        float m_stepCount = 0.25;
        float m_gainingValue = 0.0;

        if(m_deltaMoisture<0)
            m_deltaMoisture *= -1;

        // step size
        m_gainingValue = 0.5*(m_deltaMoisture/m_stepCount);

        // fire burning time
        // make the fire speed faster
        for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
        {
            FuelPoint m_pointCurrent = m_currentIndexForm[a];
            ngl::Vector m_currentForm = m_pointCurrent.getPosition();
            int m_currentSize = m_currentForm.m_y;
            int m_lastIndexOfTheForm = m_currentForm.m_z;

            for(int b=m_currentSize; b<m_lastIndexOfTheForm; ++b)
            {
                FuelPoint m_point = m_fireDLAForm[b];
                float m_currentBurningTime = m_point.getBurningTime();

                m_currentBurningTime -= m_gainingValue;

                if(m_currentBurningTime<0)
                    m_currentBurningTime = 1;

                m_point.setBurningTime(m_currentBurningTime);

                // ----- set new moisture of each point
                float m_currentPointMoisture = m_point.getMoisture();
                m_currentPointMoisture -= m_gainingValue/100;
                m_point.setNewMoisture(m_currentPointMoisture);

                m_fireDLAForm[b] = m_point;
            }
        } // end for loop of numbers of dla form

        // adjust rate of growth
        m_rateOfGrowth += m_deltaMoisture/100;

        if(m_rateOfGrowth>1.0)
            m_rateOfGrowth = 0.9;
        else if(m_rateOfGrowth<0.0)
            m_rateOfGrowth = 0.1;
    }
    else if(_newMoisture>m_sceneMoisture)
    {
        double m_deltaMoisture = m_sceneMoisture - _newMoisture;
        float m_stepCount = 0.25;
        float m_gainingValue = 0.0;

        if(m_deltaMoisture<0)
            m_deltaMoisture *= -1;

        m_gainingValue = 0.25*(m_deltaMoisture/m_stepCount);

        // fire burning time
        // make the fire speed slower
        for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
        {
            FuelPoint m_pointCurrent = m_currentIndexForm[a];
            ngl::Vector m_currentForm = m_pointCurrent.getPosition();
            int m_currentSize = m_currentForm.m_y;
            int m_lastIndexOfTheForm = m_currentForm.m_z;

            for(int b=m_currentSize; b<m_lastIndexOfTheForm; ++b)
            {
                FuelPoint m_point = m_fireDLAForm[b];
                float m_currentBurningTime = m_point.getBurningTime();

                m_currentBurningTime += m_gainingValue;

                if(m_currentBurningTime>25)
                    m_currentBurningTime = 25;

                m_point.setBurningTime(m_currentBurningTime);

                // ----- set new moisture of each point
                float m_currentPointMoisture = m_point.getMoisture();
                m_currentPointMoisture += m_gainingValue/100;
                m_point.setNewMoisture(m_currentPointMoisture);

                m_fireDLAForm[b] = m_point;
            }
        } // end for loop of numbers of dla form

        // adjust rate of growth
        m_rateOfGrowth -= m_deltaMoisture/100;

        if(m_rateOfGrowth>1.0)
            m_rateOfGrowth = 0.9;
        else if(m_rateOfGrowth<0.0)
            m_rateOfGrowth = 0.1;
    } // end if-else moisture changes

    m_sceneMoisture = _newMoisture;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::assignNewObjMoisture ( float  _newObjMoisture)

This method will adjust the moisture value of fuel object.

Parameters:
_newObjMoistureis the new moisture value of fuel object

Definition at line 142 of file FirePath.cpp.

References m_fuelOnGridList, m_objMoisture, and FuelPoint::setNewMoisture().

{
    m_objMoisture = _newObjMoisture;

    for(unsigned int m=0; m<m_fuelOnGridList.size(); ++m)
    {
        FuelPoint m_fuelPoint = m_fuelOnGridList[m];
        m_fuelPoint.setNewMoisture(m_objMoisture);
        m_fuelOnGridList[m] = m_fuelPoint;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::assignNewTemp ( double  _newTemp)

This method will adjust the temperatue of fire scene.

Parameters:
_newTempis the new temperature value of the scene

Definition at line 530 of file FirePath.cpp.

References FuelPoint::getBurningTime(), FuelPoint::getMoisture(), FuelPoint::getPosition(), m_currentIndexForm, m_fireDLAForm, m_rateOfGrowth, m_sceneTemp, FuelPoint::setBurningTime(), and FuelPoint::setNewMoisture().

{
    if(_newTemp<m_sceneTemp)
    {
        double m_deltaTemp = m_sceneTemp - _newTemp;
        float m_stepCount = 0.25;
        float m_gainingValue = 0.0;

        if(m_deltaTemp<0)
            m_deltaTemp *= -1;

        // step size
        m_gainingValue = 0.1*(m_deltaTemp/m_stepCount);

        // fire burning time
        // make the fire speed slower
        for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
        {
            FuelPoint m_pointCurrent = m_currentIndexForm[a];
            ngl::Vector m_currentForm = m_pointCurrent.getPosition();
            int m_currentSize = m_currentForm.m_y;
            int m_lastIndexOfTheForm = m_currentForm.m_z;

            for(int b=m_currentSize; b<m_lastIndexOfTheForm; ++b)
            {
                FuelPoint m_point = m_fireDLAForm[b];
                float m_currentBurningTime = m_point.getBurningTime();

                m_currentBurningTime += m_gainingValue;

                if(m_currentBurningTime>25)
                    m_currentBurningTime = 25;

                m_point.setBurningTime(m_currentBurningTime);

                // ----- set new moisture of each point
                float m_currentPointMoisture = m_point.getMoisture();
                m_currentPointMoisture += m_gainingValue/100;
                m_point.setNewMoisture(m_currentPointMoisture);

                m_fireDLAForm[b] = m_point;
            }
        } // end for loop of numbers of dla form

        // adjust rate of growth
        m_rateOfGrowth -= m_deltaTemp/500;

    }
    else if(_newTemp>m_sceneTemp)
    {
        double m_deltaTemp = m_sceneTemp - _newTemp;
        float m_stepCount = 0.25;
        float m_gainingValue = 0.0;

        if(m_deltaTemp<0)
            m_deltaTemp *= -1;

        // step size
        m_gainingValue = 0.1*(m_deltaTemp/m_stepCount);

        // fire burning time
        // make the fire speed faster
        for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
        {
            FuelPoint m_pointCurrent = m_currentIndexForm[a];
            ngl::Vector m_currentForm = m_pointCurrent.getPosition();
            int m_currentSize = m_currentForm.m_y;
            int m_lastIndexOfTheForm = m_currentForm.m_z;

            for(int b=m_currentSize; b<m_lastIndexOfTheForm; ++b)
            {
                FuelPoint m_point = m_fireDLAForm[b];
                float m_currentBurningTime = m_point.getBurningTime();

                m_currentBurningTime -= m_gainingValue;

                if(m_currentBurningTime<0)
                    m_currentBurningTime = 1;

                m_point.setBurningTime(m_currentBurningTime);

                // ----- set new moisture of each point
                float m_currentPointMoisture = m_point.getMoisture();
                m_currentPointMoisture -= m_gainingValue/100;
                m_point.setNewMoisture(m_currentPointMoisture);

                m_fireDLAForm[b] = m_point;
            }
        } // end for loop of numbers of dla form

        // adjust rate of growth
        m_rateOfGrowth += m_deltaTemp/500;

    } // end if-else the increasing and decreasing temperature occurs

    m_sceneTemp = _newTemp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::calculateRateOfGrowth ( )

This method will calculate the fire spread rate.

Definition at line 741 of file FirePath.cpp.

References FuelPoint::getBurningTime(), m_fireDLAForm, and m_rateOfGrowth.

{
    // calculate with slope
    float m_burningTimePrefer = m_fireDLAForm.size()*10;
    float m_burningTimeTotal = 0;

    for(unsigned int t=0; t<m_fireDLAForm.size(); ++t)
    {
        FuelPoint m_dlaPoint = m_fireDLAForm[t];
        float m_bTime= m_dlaPoint.getBurningTime();

        m_burningTimeTotal += m_bTime;
    }

    float m_diffTime = (m_burningTimePrefer - m_burningTimeTotal)/10000;

    m_rateOfGrowth = m_rateOfGrowth + m_diffTime;

    if(m_rateOfGrowth>1.0)
        m_rateOfGrowth = 0.9;
    else if(m_rateOfGrowth<0.0)
        m_rateOfGrowth = 0.1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool FirePath::checkCollisionWithBurningArea ( ngl::Vector  m_currentPos)

This method will check collision with burning area with the current new born fire point.

Parameters:
m_currentPosis the new born fire point position
Returns:
m_collision is the status of collision

Definition at line 269 of file FirePath.cpp.

References FuelPoint::getPosition(), FuelPoint::isFlammable(), and m_gridList.

{
    bool m_isCollided = false;

    int m_minIndex = 0;
    float m_minDist = 10000.0;

    for(unsigned int j=0; j<m_gridList.size(); ++j)
    {
        FuelPoint m_burningPoint = m_gridList[j];
        ngl::Vector m_burningPos = m_burningPoint.getPosition();

        ngl::Vector m_delta = m_burningPos - m_currentPos;
        float m_distance = m_delta.length();

        if(m_distance<m_minDist)
        {
            m_minDist = m_distance;
            m_minIndex = j;
        }
    }

    FuelPoint m_groundPoint = m_gridList[m_minIndex];

    if(m_groundPoint.isFlammable()==false)
    {
        m_isCollided = true;
    } // end if its burning

/*    // check with surrounding burning area with the distance and the fire area of object
    ngl::Vector m_checkingGrondPos = m_groundPoint.getPosition();

    for(unsigned int k=0; k<m_gridList.size(); ++k)
    {
        if(k!=(unsigned)m_minIndex)
        {
            FuelPoint m_surroundGroundPoint = m_gridList[k];
            ngl::Vector m_surroundGroundPos = m_surroundGroundPoint.getPosition();

            if((m_surroundGroundPoint.isBurning()==true)&&(m_surroundGroundPoint.isFuel()==true))
            {
                if((m_surroundGroundPoint.getBurningFormNumber()<0)||(m_surroundGroundPoint.getBurningFormNumber()!=m_currentFormNumber))
                {
                    ngl::Vector m_deltaDistance = m_surroundGroundPos - m_checkingGrondPos;
                    float m_farDistance = m_deltaDistance.length();

                    if(m_farDistance<=0.3)
                        m_isCollided = true;
                } // end if it is in the fuel object area
            } // end if it is burning
        } // end if the duplicate index number
    }
*/
    return m_isCollided;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::controlFirePathColour ( )

This method will control the colout of fire path.

Definition at line 942 of file FirePath.cpp.

References FuelPoint::changeColour(), FuelPoint::getBurningTime(), FuelPoint::getColour(), FuelPoint::getPosition(), FuelPoint::isBurningDown(), m_currentIndexForm, m_fireDLAForm, m_pause, m_rateOfGrowth, and FuelPoint::setToBeBurningDown().

{
    if(m_pause==false)
    {
        // collistion with fuel object
        for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
        {
            FuelPoint m_form = m_currentIndexForm[a];
            ngl::Vector m_currentForm = m_form.getPosition();
            int m_startIndex = m_currentForm.m_w;
            int m_currentIndex =m_currentForm.m_y;
            int m_lastIndexOfTheForm = m_currentForm.m_z;

            float m_adjustXYZColour = 0.0;

            FuelPoint m_lastPoint = m_fireDLAForm[m_lastIndexOfTheForm-1];
            // get burning time to calculate the changing colour step size
            float m_burningTime = m_lastPoint.getBurningTime();

            if(m_burningTime<=10)
            {
                float m_newBurningTime = 10 + (10-m_burningTime);
                m_burningTime = m_newBurningTime;
            }
            else
            {
                float m_newBurningTime = 10 - (m_burningTime - 10);
                m_burningTime = m_newBurningTime;
            }

            m_adjustXYZColour = ((m_burningTime*0.0005)/10);

            // adjust colour changing with rate of growth
            m_adjustXYZColour *= m_rateOfGrowth;

            for(int e=m_startIndex; e<m_currentIndex; ++e)
            {
                FuelPoint m_point = m_fireDLAForm[e];
                bool m_checkBurntStatus = m_point.isBurningDown();

                // ----- set colour to each point
                ngl::Vector m_colour = m_point.getColour();

                if(m_checkBurntStatus==false)
                {
                    // decrease colour
                    if(m_colour.m_y<=1.0)
                    {
                        m_colour.m_y += m_adjustXYZColour;
                    }
                    else if(m_colour.m_z<=1.0)
                    {
                        m_colour.m_z += m_adjustXYZColour;
                    }

                    if((m_colour.m_z>=1.0)&&(m_colour.m_x>=1.0))
                    {
                        m_colour = ngl::Vector(1.0,1.0,1.0);
                        m_point.setToBeBurningDown();
                        m_fireDLAForm[e] = m_point;
                    }
                } // end if it is still burning

                if(m_checkBurntStatus==true)
                {
                    if((m_colour.m_x>0.0)&&(m_colour.m_y>0.0)&&(m_colour.m_z>0.0))
                    {
                        m_colour.m_x -= 0.0002;
                        m_colour.m_y -= 0.0002;
                        m_colour.m_z -= 0.0002;
                    }
                } // end if it is all burnt

                m_point.changeColour(m_colour);
                m_fireDLAForm[e] = m_point;

            } // end for loop of fire dla path
        } // end for loop of fire form number
    } // end if the pause is false
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::drawDLAPath ( const std::string &  _shaderName,
ngl::TransformStack &  _transformStack 
)

This method will draw fire path from the calculated from burning time.

Parameters:
&_shaderNamerefers to the shader of fire path
&_transformStackrefers to the transform stack of points

Definition at line 334 of file FirePath.cpp.

References checkCollisionWithBurningArea(), FuelPoint::getColour(), FuelPoint::getPosition(), m_burningPointList, m_currentIndexForm, m_fireDLAForm, m_fireDLALine, and m_onlyLine.

{
    ngl::ShaderManager *shader=ngl::ShaderManager::instance();
    ngl::VBOPrimitives *prim=ngl::VBOPrimitives::instance();

    for(unsigned int a=0; a<m_currentIndexForm.size(); ++a)
    {

        FuelPoint m_pointCurrent = m_currentIndexForm[a];
        ngl::Vector m_currentForm = m_pointCurrent.getPosition();//m_currentIndexForm[a];
        int m_startIndex = m_currentForm.m_w;
        int m_currentGeneration = m_currentForm.m_x;
        int m_currentIndex = m_currentForm.m_y;
        int m_lastIndexOfTheForm = m_currentForm.m_z;

        std::vector<FuelPoint> m_emptyList;
        m_burningPointList = m_emptyList;

        for(unsigned int i=m_startIndex; i<m_currentIndex; ++i)
        {
            FuelPoint m_drawingPoint = m_fireDLAForm[i];
            ngl::Vector m_drawingPointPos = m_drawingPoint.getPosition();
            //if(m_drawingPoint.canDraw())
        {
            bool m_collision = false;//checkCollisionWithBurningArea(m_drawingPointPos,a);//,q);

            if(m_collision==false)
            {
            (*shader)[_shaderName]->use();
            shader->setShaderParamFromMatrix(_shaderName,"ModelMatrix",_transformStack.getCurrAndGlobal().getMatrix());

            // ----- set colour to each point
            ngl::Vector m_drawingColour = m_drawingPoint.getColour();//ngl::Vector(1.0,2.0,1.0);//ngl::Vector(1.0,2.0,0.0);
            shader->setShaderParam4f(_shaderName,_shaderName,m_drawingColour.m_x,m_drawingColour.m_y,m_drawingColour.m_z,1.0);

            glLineWidth(3.0);
            // ----- draw line
            glBegin(GL_LINES);

                glVertex3f(m_drawingPointPos.m_x, m_drawingPointPos.m_y+0.02, m_drawingPointPos.m_z);
               // int m_lineIndex = getIndexNumber(m_pointPosition);
                FuelPoint m_drawingHPoint = m_fireDLALine[i];//m_fireDLALine[m_lineIndex];//m_fireDLALine[q];//
                ngl::Vector m_drawingHPointPos = m_drawingHPoint.getPosition();
                glVertex3f(m_drawingHPointPos.m_x, m_drawingHPointPos.m_y+0.02, m_drawingHPointPos.m_z);

            glEnd();

            // add to burning point list , thus the program would know the current drawing spot
          //  if(i>=m_burningPointList.size())
               // m_burningPointList.push_back(m_drawingPoint);

            // ----- burning area drawing
            if(m_onlyLine==false)
            {
            float m_yHPos = m_drawingHPointPos.m_y;
            float m_yPos = m_drawingPointPos.m_y;

            if(m_drawingHPointPos.m_y<m_drawingPointPos.m_y)
            {
                m_drawingHPointPos.m_x += 0.18;
                m_drawingHPointPos.m_z += 0.18;

                m_drawingPointPos.m_x -= 0.18;
                m_drawingPointPos.m_z -=0.18;

                float m_tempYPos = m_yPos;
                m_yPos = m_yHPos;
                m_yHPos = m_tempYPos;
            }
            else
            {
                m_drawingHPointPos.m_x -= 0.18;
                m_drawingHPointPos.m_z -= 0.18;

                m_drawingPointPos.m_x += 0.18;
                m_drawingPointPos.m_z +=0.18;
            }

            ngl::Vector m_head = ngl::Vector(m_drawingHPointPos.m_x, m_yHPos ,m_drawingPointPos.m_z );
            ngl::Vector m_tail = ngl::Vector(m_drawingPointPos.m_x, m_yPos , m_drawingHPointPos.m_z);

            bool m_collideWithNonFlammableAreaH = checkCollisionWithBurningArea(m_head);
            bool m_collideWithNonFlammableAreaT = checkCollisionWithBurningArea(m_tail);

            bool m_drawHeatTransferring = true;

            if((m_head.m_x<0.49)&&(m_head.m_x>-0.49)&&(m_tail.m_x<0.49)&&(m_tail.m_x>-0.49)&&(m_head.m_z<0.49)&&(m_head.m_z>-0.49)&&(m_tail.m_z<0.49)&&(m_tail.m_z>-0.49))
                m_drawHeatTransferring = true;

            if((m_collideWithNonFlammableAreaH==true)||(m_collideWithNonFlammableAreaT==true))
                m_drawHeatTransferring = false;

            if(m_drawHeatTransferring==true)
            {
                glBegin(GL_QUADS);
                     glVertex3f( m_drawingHPointPos.m_x, m_drawingHPointPos.m_y-0.02, m_drawingHPointPos.m_z);
                     glVertex3f( m_head.m_x, m_head.m_y-0.02, m_head.m_z);
                     glVertex3f( m_drawingPointPos.m_x, m_drawingPointPos.m_y-0.02, m_drawingPointPos.m_z);
                     glVertex3f( m_tail.m_x, m_tail.m_y-0.02, m_tail.m_z);
                glEnd();
            }

            } // end if only line would show
        }
        }
        }
    } // end for loop of numbers of dla form
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< FuelPoint > FirePath::getCurrentFuelList ( )

This method will return the current fuel object variables list @return m_fuelOnGridList is the fuel object list.

Definition at line 512 of file FirePath.cpp.

References m_fuelOnGridList.

{
    return m_fuelOnGridList;
}

Here is the caller graph for this function:

int FirePath::getIndexNumber ( ngl::Vector  m_position)

This method will return the index number of head dla point.

Parameters:
m_positionis the checking position of tail fire
Returns:
m_headIndex is the index number of head point

Definition at line 252 of file FirePath.cpp.

References FuelPoint::getPosition(), and m_fireDLAForm.

{
    int m_index = 0;

    for(unsigned int j=0; j<m_fireDLAForm.size(); ++j)
    {
        FuelPoint m_point = m_fireDLAForm[j];
        ngl::Vector m_pointPosition = m_point.getPosition();

        if((m_pointPosition.m_x==m_position.m_x)&&(m_pointPosition.m_z==m_position.m_z))
            m_index = j;
    }

    return m_index;
}

Here is the call graph for this function:

void FirePath::pauseTheAnimation ( bool  _status)

This method will toggle the animation.

Parameters:
_statusis the flag of playing animation of fire path

Definition at line 935 of file FirePath.cpp.

References m_pause.

{
    m_pause = _status;
}

Here is the caller graph for this function:

void FirePath::resetFuel ( )

This method will reset the fuel object colour to initial colour.

Definition at line 494 of file FirePath.cpp.

References FuelPoint::changeColour(), FuelPoint::getColour(), m_fuelOnGridList, and m_originalFuelOnGridList.

{
    // set the fuel to be not burning first
    for(unsigned int m=0; m<m_fuelOnGridList.size(); ++m)
    {
        FuelPoint m_fuelPoint = m_fuelOnGridList[m];
        ngl::Vector m_fuelPointColour = m_fuelPoint.getColour();

        ngl::Vector m_newColour = ngl::Vector(m_fuelPointColour.m_y, m_fuelPointColour.m_x, m_fuelPointColour.m_z);
        m_fuelPoint.changeColour(m_newColour);

        m_fuelOnGridList[m] = m_fuelPoint;
    }

    m_originalFuelOnGridList = m_fuelOnGridList;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::resetFuelListToOriginal ( )

This method will reset the fuel object variables to initial state.

Definition at line 518 of file FirePath.cpp.

References m_allShow, m_currentDLAPointIndex, m_fuelOnGridList, m_originalFuelOnGridList, m_rateOfGrowth, and setFirePath().

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::resetGrid ( std::vector< FuelPoint _currentGridPoint)

This method will update the grid point.

Parameters:
_currentGridPointis the new grid point

Definition at line 463 of file FirePath.cpp.

References m_gridList.

{
    m_gridList = _currentGridPoint;
}

Here is the caller graph for this function:

void FirePath::resetList ( )

This method will reset all the list to initial state.

Definition at line 170 of file FirePath.cpp.

References assignNewObjMoisture(), m_allShow, m_currentDLAPointIndex, m_fireDLAForm, m_fireDLALine, m_objMoisture, m_rateOfGrowth, m_timeStep, and setFirePath().

{
    std::vector<FuelPoint> m_emptyList;
    m_fireDLAForm = m_emptyList;
    m_fireDLALine = m_emptyList;

    m_timeStep = 0;
    m_currentDLAPointIndex = 0;
    m_allShow = false;
    m_rateOfGrowth = 0.5;

    assignNewObjMoisture(m_objMoisture);
    setFirePath();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::setFirePath ( )

This method will set the dla path to be ready to fire.

Definition at line 155 of file FirePath.cpp.

References calculateRateOfGrowth(), FuelPoint::getBurningTime(), m_fireDLAForm, m_sceneMoisture, FuelPoint::setEmittedHeat(), and FuelPoint::setNewMoisture().

{
    for(unsigned int g=0; g<m_fireDLAForm.size(); ++g)
    {
        FuelPoint m_firePathPoint = m_fireDLAForm[g];
        m_firePathPoint.setNewMoisture(m_sceneMoisture/100);
        int m_burningTime = m_firePathPoint.getBurningTime();
        m_firePathPoint.setEmittedHeat(1500+(m_burningTime*100));
        m_fireDLAForm[g] = m_firePathPoint;
    }

    calculateRateOfGrowth();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::setNewOriginList ( std::vector< FuelPoint _newOriginList)

This method will update the origin list whenever the new fire path is generated or adjusted the origin amount.

Parameters:
_newOriginListis the new origin list

Definition at line 100 of file FirePath.cpp.

References FuelPoint::getEmittedHeat(), FuelPoint::getPosition(), m_currentIndexForm, and m_originList.

{
    m_originList = _newOriginList;

    std::vector<FuelPoint> m_empty;
    m_currentIndexForm = m_empty;

    for(unsigned int q=0; q<m_originList.size(); ++q)
    {
        FuelPoint m_renewOrigin = m_originList[q];
        ngl::Vector m_renew = m_renewOrigin.getPosition();

        int m_startIndex = 0;
        int m_lastIndex = m_renewOrigin.getEmittedHeat()-1;

        // size for limiting the range of collecting total time that requires for burning
        if(q>0)
        {
            // get the start and last index
            for(unsigned int p=0; p<q; ++p)
            {
                //ngl::Vector m_previousSize = m_currentIndexForm[p];
                m_lastIndex += m_renewOrigin.getEmittedHeat();

                FuelPoint m_previousOrigin = m_originList[p];
                m_startIndex += m_previousOrigin.getEmittedHeat();
            }
        }

        m_renew.m_x = 1;                // current generation
        m_renew.m_y = m_startIndex;     // current index
        m_renew.m_z = m_lastIndex;      // last index
        m_renew.m_w = m_startIndex;     // start index

        if(q==0)
            m_renew.m_w = 0;

        m_currentIndexForm.push_back(FuelPoint(m_renew,0));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::showFireLineOnly ( bool  _showingLineOnlyStatus)

This method will toggle the only line showing.

Parameters:
_statusis the flag of drawing only line of fire path, not including the burning area

Definition at line 326 of file FirePath.cpp.

References m_onlyLine.

{
    m_onlyLine = _showingLineOnlyStatus;
}

Here is the caller graph for this function:

void FirePath::timeUpdate ( int  _time)

This method will update the fire path along the time.

Parameters:
_timecurrent time step

Definition at line 186 of file FirePath.cpp.

References analyzeBurningArea(), analyzeDLAAmount(), and controlFirePathColour().

{
    int m_newTime = _time;

    analyzeDLAAmount(m_newTime);

    // check burning area that attacks with fuel object and area or not
    analyzeBurningArea();

    controlFirePathColour();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::transferHeat ( int  m_gridIndex,
int  m_heat,
int  m_mode 
)

This method will transfer the heat to surrounding area.

Parameters:
m_gridIndexis the index number of emitting heat grid point
m_heatis the amount of emitting heat
m_modeis the mode of transferring heat
void FirePath::updateDLAList ( std::vector< FuelPoint _allDLAList,
std::vector< FuelPoint _allDLALine 
)

This method will update the dla point list whenever the new fire path is generated.

Parameters:
_allDLAListis the new dla point list
_allDLALineis the new dla head point list

Definition at line 447 of file FirePath.cpp.

References assignNewObjMoisture(), m_allShow, m_currentDLAPointIndex, m_fireDLAForm, m_fireDLALine, m_fuelOnGridList, m_objMoisture, m_originalFuelOnGridList, m_rateOfGrowth, m_sceneMoisture, m_sceneTemp, and resetList().

Here is the call graph for this function:

Here is the caller graph for this function:

void FirePath::updateFuelOnGrid ( std::vector< FuelPoint _fuelOnGridList)

This method will update the fuel object variables list.

Parameters:
_fuelOnGridListis the new fuel object list

Definition at line 469 of file FirePath.cpp.

References assignNewObjMoisture(), FuelPoint::isFuel(), m_fuelOnGridList, m_gridList, m_objMoisture, resetFuel(), resetList(), and FuelPoint::setGridIndex().

{
    resetList();

    m_gridList = _fuelOnGridList;

    std::vector<FuelPoint> m_emptyList;
    m_fuelOnGridList = m_emptyList;

    for(unsigned int q=0; q<m_gridList.size(); ++q)
    {
        FuelPoint m_gridPoint = m_gridList[q];

        m_gridPoint.setGridIndex(q);

        if(m_gridPoint.isFuel()==true)
            m_fuelOnGridList.push_back(m_gridPoint);
    }

    resetFuel();
    assignNewObjMoisture(m_objMoisture);

}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool FirePath::m_allShow [private]

fire path drawing status that is drawn all of the dla point or not

Definition at line 264 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_burningPointList [private]

burning dla point list

Definition at line 251 of file FirePath.h.

current drawing index

Definition at line 260 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_currentIndexForm [private]

the list contains current position of fire path drawing method

Definition at line 247 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_fireDLAForm [private]

the list contains dla point, which it concerns as the head of fire point

Definition at line 223 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_fireDLALine [private]

the list contains dla point, which it concerns as the tail of fire point

Definition at line 227 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_fuelOnGridList [private]

the list contains position and variables of flammable object

Definition at line 231 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_gridList [private]

the list contains point on the grid or fire scene

Definition at line 239 of file FirePath.h.

float FirePath::m_objMoisture [private]

fuel objec moisture value

Definition at line 282 of file FirePath.h.

bool FirePath::m_onlyLine [private]

only line showing status

Definition at line 303 of file FirePath.h.

the list contains the initial fuel variables of flammable object

Definition at line 235 of file FirePath.h.

std::vector<FuelPoint> FirePath::m_originList [private]

the list contains origin point

Definition at line 243 of file FirePath.h.

bool FirePath::m_pause [private]

animation pause status

Definition at line 286 of file FirePath.h.

float FirePath::m_rateOfGrowth [private]

spread rate of fire

Definition at line 269 of file FirePath.h.

double FirePath::m_sceneMoisture [private]

scene moisture

Definition at line 274 of file FirePath.h.

double FirePath::m_sceneTemp [private]

scene temperature

Definition at line 278 of file FirePath.h.

int FirePath::m_timeStep [private]

current drawing time step

Definition at line 256 of file FirePath.h.

ngl::Vector FirePath::m_windDirection [private]

wind direction

Definition at line 291 of file FirePath.h.

bool FirePath::m_windEnable [private]

wind status

Definition at line 299 of file FirePath.h.

int FirePath::m_windSpeed [private]

wind speed

Definition at line 295 of file FirePath.h.


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