EMODnet Quantized Mesh Generator for Cesium
quantized_mesh_tile.h
1 // Copyright (c) 2018 Coronis Computing S.L. (Spain)
2 // All rights reserved.
3 //
4 // This file is part of EMODnet Quantized Mesh Generator for Cesium.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <https://www.gnu.org/licenses/>.
18 //
19 // Author: Ricard Campos (ricardcd@gmail.com)
20 
21 #ifndef EMODNET_QMGC_QUANTIZED_MESH_TILE_H
22 #define EMODNET_QMGC_QUANTIZED_MESH_TILE_H
23 
24 #include "quantized_mesh.h"
25 #include "ellipsoid.h"
26 #include "tin_creation/tin_creation_cgal_types.h"
27 
28 
34 public QuantizedMesh, public ctb::Tile
35 {
36  friend class TerrainTiler;
37  friend class QuantizedMeshTiler;
38 
39 public:
40  // --- Typedefs ---
41  typedef TinCreation::Point_3 Point_3 ;
42  typedef TinCreation::Vector_3 Vector_3 ;
43 
49  QuantizedMeshTile(const ctb::TileCoordinate &coord,
50  const Ellipsoid& e = WGS84Ellipsoid())
51  : QuantizedMesh()
52  , Tile(coord)
53  , m_ellipsoid(e) {}
54 
61  QuantizedMeshTile(const char *fileName,
62  const ctb::TileCoordinate &coord,
63  const Ellipsoid& e = WGS84Ellipsoid())
64  : QuantizedMesh(fileName)
65  , Tile(coord)
66  , m_ellipsoid(e) {}
67 
75  const ctb::TileCoordinate &coord,
76  const Ellipsoid& e = WGS84Ellipsoid())
77  : QuantizedMesh(qm)
78  , Tile(coord)
79  , m_ellipsoid(e) {}
80 
82  void convertUVHToLonLatHeight( const unsigned short &u, const unsigned short &v, const unsigned short &h,
83  double &lon, double &lat, double &height ) const ;
84 
91  bool exportToOFF( const std::string &outFilePath, const bool& useRealWorldValues = false ) ;
92 
99  Point_3 horizonOcclusionPoint( const std::vector<Point_3> &pts, const Point_3 &center ) ;
100 
101 private:
102  // Function as described in https://cesium.com/blog/2013/05/09/computing-the-horizon-occlusion-point/
103  // We ommit the ellipsoid here for simplicity (hard-coded)
104  double computeHorizonOcclusionPointMagnitude( const Point_3 &position, const Vector_3 &scaledSpaceDirectionToPoint ) ;
105 
106  // --- Attributes ---
107  Ellipsoid m_ellipsoid ;
108 };
109 
110 #endif //EMODNET_QMGC_QUANTIZED_MESH_TILE_H
Point_3 horizonOcclusionPoint(const std::vector< Point_3 > &pts, const Point_3 &center)
Compute the horizon occlusion point for the given tile.
Definition: quantized_mesh_tile.cpp:86
QuantizedMeshTile(const char *fileName, const ctb::TileCoordinate &coord, const Ellipsoid &e=WGS84Ellipsoid())
Create a quantized mesh tile from a file.
Definition: quantized_mesh_tile.h:61
Describes an ellipsoid.
Definition: ellipsoid.h:32
void convertUVHToLonLatHeight(const unsigned short &u, const unsigned short &v, const unsigned short &h, double &lon, double &lat, double &height) const
Convert U/V/Height coordinates in quantized mesh tile to Lon/Lat/Height.
Definition: quantized_mesh_tile.cpp:28
Contains all the data of a Quantized-mesh.
Definition: quantized_mesh.h:35
Tiler of a terrain generating quantized-mesh tiles.
Definition: quantized_mesh_tiler.h:41
bool exportToOFF(const std::string &outFilePath, const bool &useRealWorldValues=false)
Exports the geometry of the tile to OFF format.
Definition: quantized_mesh_tile.cpp:42
The WGS84 ellipsoid.
Definition: ellipsoid.h:86
QuantizedMeshTile(const QuantizedMesh &qm, const ctb::TileCoordinate &coord, const Ellipsoid &e=WGS84Ellipsoid())
Creates a quantized mesh tile from quantized mesh data.
Definition: quantized_mesh_tile.h:74
QuantizedMeshTile(const ctb::TileCoordinate &coord, const Ellipsoid &e=WGS84Ellipsoid())
Creates a quantized mesh tile from a tile coordinate.
Definition: quantized_mesh_tile.h:49
Encapsulates a Tile in Quantized Mesh format *.
Definition: quantized_mesh_tile.h:33