vtTin Class Reference

Inheritance diagram for vtTin:

Inheritance graph
[legend]
List of all members.

Public Member Functions

unsigned int NumVerts () const
unsigned int NumTris () const
void AddVert (const DPoint2 &p, float z)
void AddVert (const DPoint2 &p, float z, FPoint3 &normal)
void AddTri (int v1, int v2, int v3, int surface_type=-1)
void RemVert (int v)
void RemTri (int t)
bool Read (const char *fname)
bool Write (const char *fname) const
bool ReadDXF (const char *fname, bool progress_callback(int)=NULL)
bool ReadADF (const char *fname, bool progress_callback(int)=NULL)
unsigned int AddSurfaceType (const vtString &surface_texture, bool bTiled=false)
bool ComputeExtents ()
void Offset (const DPoint2 &p)
bool ConvertProjection (const vtProjection &proj_new)
virtual bool FindAltitudeOnEarth (const DPoint2 &p, float &fAltitude, bool bTrue=false) const
bool FindAltitudeAtPoint (const FPoint3 &p3, float &fAltitude, bool bTrue=false, int iCultureFlags=0, FPoint3 *vNormal=NULL) const
bool CastRayToSurface (const FPoint3 &point, const FPoint3 &dir, FPoint3 &result) const
 Find the intersection point of a ray with the heightfield.
void CleanupClockwisdom ()
int RemoveUnusedVertices ()
double GetTriMaxEdgeLength (int iTri) const
void MergeSharedVerts (bool progress_callback(int)=NULL)
bool HasVertexNormals ()
int RemoveTrianglesBySegment (const DPoint2 &ep1, const DPoint2 &ep2)
void SetupTriangleBins (int bins, bool progress_callback(int)=NULL)

Public Attributes

vtProjection m_proj

Protected Member Functions

bool TestTriangle (int tri, const DPoint2 &p, float &fAltitude) const
bool _ReadTin (FILE *fp)
bool _ReadTinOld (FILE *fp)
void _UpdateIndicesInInBin (int bin)
void _CompareBins (int bin1, int bin2)

Protected Attributes

DLine2 m_vert
vtArray< float > m_z
vtArray< int > m_tri
FLine3 m_vert_normal
vtArray< int > m_surfidx
vtStringArray m_surftypes
vtArray< bool > m_surftype_tiled
int * m_bReplace
Binm_vertbin
Binm_tribin
BinArray * m_trianglebins
DPoint2 m_BinSize

Detailed Description

This class represents a TIN, a 'triangulated irregular network'. A TIN consists of a set of vertices connected by triangles with no regularity. However this class does expect to operate on a particular kind of TIN, specifically a heightfield TIN.

The triangles are defined by indices into the vertex array, so this is an "indexed TIN".


Member Function Documentation

void vtTin::CleanupClockwisdom  ) 
 

Test each triangle for clockwisdom, fix if needed. The result should be a TIN with consistent vertex ordering, such that all face normals point up rather than down, that is, counter-clockwise.

bool vtTin::FindAltitudeAtPoint const FPoint3 p3,
float &  fAltitude,
bool  bTrue = false,
int  iCultureFlags = 0,
FPoint3 vNormal = NULL
const [inline, virtual]
 

Given a point in world coordinates, determine the elevation at that point.

Parameters:
p3 The point to test. Only the X and Z values are used.
fAltitude The resulting elevation at that point, by reference.
bTrue True to test true elevation. False to test the displayed elevation (possibly exaggerated.)
iCultureFlags Pass 0 to test only the heightfield itself, non-zero to test any culture objects which may be sitting on the heightfield. Values include:
  • CE_STRUCTURES Test structures on the ground.
  • CE_ROADS Test roads on the ground.
  • CE_ALL Test everything on the ground.
vNormal If you supply a pointer to a vector, it will be set to the upward-pointing surface normal at the ground point.
Returns:
true if successful, false if there was nothing found at that point.

Implements vtHeightField3d.

double vtTin::GetTriMaxEdgeLength int  iTri  )  const
 

Return the length of the longest edge of a specific triangle.

void vtTin::MergeSharedVerts bool   progress_callback(int) = NULL  ) 
 

Combine all vertices which are at the same location. By removing these redundant vertices, the mesh will consume less space in memory and on disk.

bool vtTin::Read const char *  fname  ) 
 

Read the TIN from a file. This can either be an old-style or new-style .tin format (custom VTP format)

bool vtTin::ReadDXF const char *  fname,
bool   progress_callback(int) = NULL
 

Attempt to read TIN data from a DXF file.

int vtTin::RemoveTrianglesBySegment const DPoint2 ep1,
const DPoint2 ep2
 

Remove all the triangles of this TIN which intersect a given line segment.

Parameters:
ep1,ep2 The endpoints of the line segment.
Returns:
The number of triangles removed.

int vtTin::RemoveUnusedVertices  ) 
 

Because the TIN triangles refer to their vertices by index, it's possible to have some vertices which are not referenced. Find and remove those vertices.

Returns:
The number of unused vertices removed.

void vtTin::SetupTriangleBins int  bins,
bool   progress_callback(int) = NULL
 

If you are going to do a large number of height-testing of this TIN (with FindAltitudeOnEarth), call this method once first to set up a series of bins which greatly speed up testing.

Parameters:
bins Number of bins per dimension, e.g. a value of 50 produces 50*50=2500 bins. More bins produces faster height-testing with the only tradeoff being a small amount of RAM per bin.
progress_callback If supplied, this function will be called back with a value of 0 to 100 as the operation progresses.

bool vtTin::Write const char *  fname  )  const
 

Write the TIN to a new-style .tin file (custom VTP format).


Generated on Tue Apr 22 10:11:01 2008 for vtdata library by  doxygen 1.4.5