VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
terrainUtil.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include <osg/BoundingSphere>
18 
19 #include <terrainCS/geodeticCS.h>
20 
21 #include <vector>
22 
23 class DtSphere;
24 class Coordinate_System;
27 
28 DtSphere boundingSphere2DtSphere(const osg::BoundingSphere& boundingSphere);
29 
30 
33 void convertGeometry(
34  const DtTerrainPagingGeometryPtr& geometry, const Coordinate_System* CS,
35  const double worldWidth, std::vector<DtTerrainPagingGeometryPtr>& output);
36 
39 
42 
45 
48 
52 void unwrap(double width, DtLocalVertexList& list, std::vector<DtTerrainPagingGeometryPtr>& output);
53 
55 
57  const DtVector& min1 /*rhs sw*/, const DtVector& max1 /*rhs ne*/,
58  const DtVector& min2 /*mysw*/, const DtVector& max2 /*myne*/);
59 
60 bool boundariesOverlap(double min1, double max1, double min2, double max2);
61 
62 DtExtent sphereExtent(const DtSphere& sphere);
63 
65  const DtLocalVertexList& shape,
66  const DtVector& lower, const DtVector& upper);
67 
69  const DtVector& p,
70  const DtVector& lower, const DtVector& upper);
71 
72 bool doubleEqual(double d1, double d2);
73 
77  const DtVrfChordIntersectionRecord& record,
79 
81 struct MinMaxInfo
82 {
83  double min, max;
84 
86  void update(const DtPoint& p)
87  {
88  double value = p.x();
89 
90  if (value > max)
91  {
92  max = value;
93  }
94 
95  if (value < min)
96  {
97  min = value;
98  }
99  }
100 
102  bool wrapsAround(double width) const
103  {
105  return max - min > width / 2;
106  }
107 
109  : min(std::numeric_limits<double>::infinity())
110  , max(-std::numeric_limits<double>::infinity())
111  {
112  }
113 };
bool shapeIntersectsAABB(const DtLocalVertexList &shape, const DtVector &lower, const DtVector &upper)
const double & x() const
Definition: point.h:180
void convertToOsgEarthCoordSys(DtPoint &p, CS_Type cstype)
convert to coordinate system used by osgEarth tiles
DtBoost::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:41
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords.
Definition: vrfChordIntersectRecordList.h:31
Definition: sphere.h:22
void update(const DtPoint &p)
update min and max values
Definition: terrainUtil.h:86
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
bool doubleEqual(double d1, double d2)
Definition: coordSystem.h:54
DtSphere boundingSphere2DtSphere(const osg::BoundingSphere &boundingSphere)
code for checking if a geometry wraps around the borders of the world map
Definition: terrainUtil.h:81
void unwrap(double width, DtLocalVertexList &list, std::vector< DtTerrainPagingGeometryPtr > &output)
unwrap moves points lower one world width if they are on the upper half side of the world this is so ...
DtVrfChordIntersectionRecord * insertRecordAlongChord(const DtVrfChordIntersectionRecord &record, DtVrfChordIntersectRecordList &intList)
inserts points inter intersection record list checks each point against the one before and after and ...
bool wrapsAround(double width) const
check is points analyzed so far indicate shape wraps around the world
Definition: terrainUtil.h:102
Definition: vrfChordIntersectionRecord.h:19
CS_Type
Definition: coordSystem.h:35
void convertFromOsgEarthCoordSys(DtPoint &p, CS_Type cstype)
convert from coordinate system used by osgEarth tiles
double min
Definition: terrainUtil.h:83
void convertGeometry(const DtTerrainPagingGeometryPtr &geometry, const Coordinate_System *CS, const double worldWidth, std::vector< DtTerrainPagingGeometryPtr > &output)
Convert geometry to internal coordinate system.
bool extentIntersectsAABB(const DtVector &min1, const DtVector &max1, const DtVector &min2, const DtVector &max2)
TODO ALL functions below should be inline.
class DtLocalVertexList:
Definition: localVertexList.h:20
bool pointIntersectsAABB(const DtVector &p, const DtVector &lower, const DtVector &upper)
MinMaxInfo()
Definition: terrainUtil.h:108
DtExtent sphereExtent(const DtSphere &sphere)
bool boundariesOverlap(double min1, double max1, double min2, double max2)
Definition: point.h:34
double max
Definition: terrainUtil.h:83

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)