vtdata library
|
Public Member Functions | |
uint | NumVerts () const |
uint | 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 progress_callback(int)=NULL) |
bool | ReadHeader (const char *fname) |
bool | ReadBody (const char *fname, bool progress_callback(int)=NULL) |
bool | Write (const char *fname, bool progress_callback(int)=NULL) const |
bool | ReadDXF (const char *fname, bool progress_callback(int)=NULL) |
bool | ReadADF (const char *fname, bool progress_callback(int)=NULL) |
bool | ReadGMS (const char *fname, bool progress_callback(int)=NULL) |
bool | ReadPLY (const char *fname, bool progress_callback(int)=NULL) |
bool | WriteGMS (const char *fname, bool progress_callback(int)=NULL) const |
bool | WriteDAE (const char *fname, bool progress_callback(int)=NULL) const |
bool | WriteWRL (const char *fname, bool progress_callback(int)=NULL) const |
bool | WriteOBJ (const char *fname, bool progress_callback(int)=NULL) const |
bool | WritePLY (const char *fname, bool progress_callback(int)=NULL) const |
bool | WriteDXF (const char *fname, bool progress_callback(int)=NULL) const |
void | FreeData () |
uint | AddSurfaceType (const vtString &surface_texture, float fTiling) |
void | SetSurfaceType (int iTri, int surface_type) |
bool | ComputeExtents () |
void | Offset (const DPoint2 &p) |
void | Scale (float fFactor) |
void | VertOffset (float fAmount) |
bool | ConvertProjection (const vtCRS &proj_new) |
void | GetVert (int v, DPoint2 &p, float &z) const |
void | GetTri (int t, int &v0, int &v1, int &v2) const |
const int * | GetAtTri (int t) const |
virtual bool | FindAltitudeOnEarth (const DPoint2 &p, float &fAltitude, bool bTrue=false) const |
virtual bool | FindAltitudeAtPoint (const FPoint3 &p3, float &fAltitude, bool bTrue=false, int iCultureFlags=0, FPoint3 *vNormal=NULL) const |
bool | FindTriangleOnEarth (const DPoint2 &p, float &fAltitude, int &iTriangle, bool bTrue=false) const |
FPoint3 | GetTriangleNormal (int iTriangle) 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 () |
void | AppendFrom (const vtTin *pTin) |
double | GetTriMaxEdgeLength (int iTri) const |
void | MergeSharedVerts (bool progress_callback(int)=NULL) |
bool | HasVertexNormals () const |
int | RemoveTrianglesBySegment (const DPoint2 &ep1, const DPoint2 &ep2) |
void | SetupTriangleBins (int bins, bool progress_callback(int)=NULL) |
int | MemoryNeededToLoad () const |
double | GetArea2D () |
double | GetArea3D () |
Public Member Functions inherited from vtHeightField3d | |
void | Initialize (const LinearUnits units, const DRECT &earthextents, float fMinHeight, float fMaxHeight) |
virtual void | SetEarthExtents (const DRECT &ext) |
int | PointIsAboveTerrain (const FPoint3 &p) const |
bool | ConvertEarthToSurfacePoint (const DPoint2 &epos, FPoint3 &p3, int iCultureFlags=0, bool bTrue=false) const |
bool | ContainsWorldPoint (float x, float z) const |
void | GetCenter (FPoint3 ¢er) const |
void | SetCulture (CultureExtension *ext) |
float | LineOnSurface (const DLine2 &line, float fSpacing, float fOffset, bool bInterp, bool bCurve, bool bTrue, FLine3 &output) |
Public Member Functions inherited from vtHeightField | |
void | Initialize (const DRECT &extents, float fMinHeight, float fMaxHeight) |
bool | ContainsEarthPoint (const DPoint2 &p, bool bInclusive=false) const |
DRECT & | GetEarthExtents () |
const DRECT & | GetEarthExtents () const |
void | GetHeightExtents (float &fMinHeight, float &fMaxHeight) const |
Public Attributes | |
vtCRS | m_proj |
Public Attributes inherited from vtHeightField3d | |
FRECT | m_WorldExtents |
LocalCS | m_LocalCS |
Protected Member Functions | |
bool | TestTriangle (int tri, const DPoint2 &p, float &fAltitude) const |
bool | _ReadTin (FILE *fp, bool progress_callback(int)) |
bool | _ReadTinHeader (FILE *fp) |
bool | _ReadTinBody (FILE *fp, bool progress_callback(int)) |
bool | _ReadTinOld (FILE *fp) |
void | _UpdateIndicesInInBin (int bin) |
void | _CompareBins (int bin1, int bin2) |
void | _GetLocalTrianglePoints (int iTriangle, FPoint3 &p1, FPoint3 &p2, FPoint3 &p3) const |
Protected Member Functions inherited from vtHeightField3d | |
void | UpdateWorldExtents () |
Protected Attributes | |
DLine2 | m_vert |
std::vector< float > | m_z |
std::vector< int > | m_tri |
FLine3 | m_vert_normal |
std::vector< int > | m_surfidx |
vtStringArray | m_surftypes |
std::vector< float > | m_surftype_tiling |
int * | m_bReplace |
Bin * | m_vertbin |
Bin * | m_tribin |
BinArray * | m_trianglebins |
DPoint2 | m_BinSize |
int | m_file_data_start |
int | m_file_verts |
int | m_file_tris |
Protected Attributes inherited from vtHeightField3d | |
float | m_fDiagonalLength |
CultureExtension * | m_pCulture |
Protected Attributes inherited from vtHeightField | |
float | m_fMinHeight |
float | m_fMaxHeight |
DRECT | m_EarthExtents |
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".
void vtTin::AppendFrom | ( | const vtTin * | pTin | ) |
Copy all the vertices and triangle of another TIN to this one. This is a simple join. No attempt is made to share vertices or any other integration. It is further assumed that the two TINs have compatible coordinate systems.
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.
|
virtual |
Given a point in world coordinates, determine the elevation at that point.
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:
|
vNormal | If you supply a pointer to a vector, it will be set to the upward-pointing surface normal at the ground 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_callbackint = 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, |
bool | progress_callbackint = NULL |
||
) |
Read the TIN from a native TIN format (.itf) file.
bool vtTin::ReadBody | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) |
Read the TIN body from a native TIN format (.itf) file. You should first call ReadHeader() if you are doing a two-part read.
bool vtTin::ReadDXF | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) |
Attempt to read TIN data from a DXF file.
bool vtTin::ReadGMS | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) |
Write the TIN to the Aquaveo GMS format.
bool vtTin::ReadHeader | ( | const char * | fname | ) |
Read the TIN header from a native TIN format (.itf). Reading the header is quick and lets you query properties (NumVerts, NumTris, GetEarthExtents) before loading the rest of the file.
Remove all the triangles of this TIN which intersect a given line segment.
ep1,ep2 | The endpoints of the line segment. |
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.
void vtTin::SetupTriangleBins | ( | int | bins, |
bool | progress_callbackint = 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 indexing bins which greatly speed up testing.
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. |
|
protected |
Test if a given 2D point (x, y) is inside a triangle of this TIN (given by index). If so, return true and give the elevation value by reference.
bool vtTin::Write | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a TIN (.itf) file (VTP-defined format).
bool vtTin::WriteDAE | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a Collada (.dae) file. Note that we write X and Y as geographic coordinates, but DAE only supports single-precision floating point values, so it may lose some precision.
bool vtTin::WriteDXF | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a AutoCAD DXF file using 3DFACE entities.
bool vtTin::WriteGMS | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to the GMS format. Historically GMS stood for 'Groundwater Modeling System' from the EMS-I company, now called Aquaveo.
bool vtTin::WriteOBJ | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a Wavefront OBJ file. Note that we write X and Y as geographic coordinates, but OBJ only supports single-precision floating point values, so it may lose some precision.
bool vtTin::WritePLY | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a Stanford Polygon File Format (PLY), http://en.wikipedia.org/wiki/PLY_(file_format)
bool vtTin::WriteWRL | ( | const char * | fname, |
bool | progress_callbackint = NULL |
||
) | const |
Write the TIN to a VRML (.wrl) file as an IndexedFaceSet. Note that we write X and Y as geographic coordinates, but VRML only supports single-precision floating point values, so it may lose some precision.