Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Attributes
TerrainInfo Class Reference

This class stores information about the triangle that's under an object, i.e. More...

#include <terrain_info.hpp>

Inheritance diagram for TerrainInfo:
Inheritance graph
[legend]
Collaboration diagram for TerrainInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TerrainInfo (int frequency=1)
 TerrainInfo (const btVector3 &pos, int frequency=1)
virtual ~TerrainInfo ()
virtual void update (const btVector3 &pos)
float getHoT () const
const MaterialgetMaterial () const
const btVector3getNormal () const
float getTerrainPitch (float heading) const
 Returns the pitch of the terrain depending on the heading.

Private Attributes

int m_HoT_frequency
int m_HoT_counter
btVector3 m_normal
const Materialm_material
float m_HoT

Detailed Description

This class stores information about the triangle that's under an object, i.e.

: the normal, a pointer to the material, and the height above th

Definition at line 29 of file terrain_info.hpp.


Constructor & Destructor Documentation

TerrainInfo::TerrainInfo ( int  frequency = 1) [inline]

Definition at line 39 of file terrain_info.hpp.

                                                  {m_HoT_frequency=frequency;
                                                   m_HoT_counter=frequency;  }
TerrainInfo::TerrainInfo ( const btVector3 pos,
int  frequency = 1 
)

Definition at line 26 of file terrain_info.cpp.

{
    m_HoT_frequency = frequency;
    m_HoT_counter   = frequency;
    // initialise HoT
    update(pos);
}

Here is the call graph for this function:

virtual TerrainInfo::~TerrainInfo ( ) [inline, virtual]

Definition at line 42 of file terrain_info.hpp.

{};

Member Function Documentation

float TerrainInfo::getHoT ( ) const [inline]

Definition at line 44 of file terrain_info.hpp.

{ return m_HoT;      }

Here is the caller graph for this function:

const Material* TerrainInfo::getMaterial ( ) const [inline]

Definition at line 45 of file terrain_info.hpp.

{ return m_material; }

Here is the caller graph for this function:

const btVector3& TerrainInfo::getNormal ( ) const [inline]

Definition at line 46 of file terrain_info.hpp.

{ return m_normal;   }
float TerrainInfo::getTerrainPitch ( float  heading) const

Returns the pitch of the terrain depending on the heading.

Definition at line 49 of file terrain_info.cpp.

                                                      {
    if(m_HoT==Track::NOHIT) return 0.0f;

    const float X =-sin(heading);
    const float Y = cos(heading);
    // Compute the angle between the normal of the plane and the line to
    // (x,y,0).  (x,y,0) is normalised, so are the coordinates of the plane,
    // simplifying the computation of the scalar product.
    float pitch = ( m_normal.getX()*X + m_normal.getY()*Y );  // use ( x,y,0)
        
    // The actual angle computed above is between the normal and the (x,y,0)
    // line, so to compute the actual angles 90 degrees must be subtracted.
    pitch = acosf(pitch) - NINETY_DEGREE_RAD;
    return pitch;
}   // getTerrainPitch

Here is the call graph for this function:

Here is the caller graph for this function:

void TerrainInfo::update ( const btVector3 pos) [virtual]

Definition at line 34 of file terrain_info.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

float TerrainInfo::m_HoT [private]

Definition at line 36 of file terrain_info.hpp.

Definition at line 33 of file terrain_info.hpp.

Definition at line 32 of file terrain_info.hpp.

Definition at line 35 of file terrain_info.hpp.

Definition at line 34 of file terrain_info.hpp.


The documentation for this class was generated from the following files: