VR-Forces Developer's Guide
 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 #include <osg/BoundingBox>
23 
24 class DtSphere;
25 class Coordinate_System;
28 
29 DtSphere boundingSphere2DtSphere(const osg::BoundingSphere& boundingSphere);
30 
31 DtExtent boundingBox2DtExtent(const osg::BoundingBoxd& boundingBox);
32 
33 
36 void convertGeometry(
37  const DtTerrainPagingGeometryPtr& geometry, const Coordinate_System* CS,
38  const double worldWidth, std::vector<DtTerrainPagingGeometryPtr>& output);
39 
42 
45 
48 
51 
55 void unwrap(double width, DtLocalVertexList& list, std::vector<DtTerrainPagingGeometryPtr>& output);
56 
58 
60  const DtVector& min1 /*rhs sw*/, const DtVector& max1 /*rhs ne*/,
61  const DtVector& min2 /*mysw*/, const DtVector& max2 /*myne*/);
62 
63 bool boundariesOverlap(double min1, double max1, double min2, double max2);
64 
65 DtExtent sphereExtent(const DtSphere& sphere);
66 
68  const DtLocalVertexList& shape,
69  const DtVector& lower, const DtVector& upper);
70 
72  const DtVector& p,
73  const DtVector& lower, const DtVector& upper);
74 
75 bool doubleEqual(double d1, double d2);
76 
80  const DtVrfChordIntersectionRecord& record,
82 
84 struct MinMaxInfo
85 {
86  double min, max;
87 
89  void update(const DtPoint& p)
90  {
91  double value = p.x();
92 
93  if (value > max)
94  {
95  max = value;
96  }
97 
98  if (value < min)
99  {
100  min = value;
101  }
102  }
103 
105  bool wrapsAround(double width) const
106  {
108  return max - min > width / 2;
109  }
110 
112  : min(std::numeric_limits<double>::infinity())
113  , max(-std::numeric_limits<double>::infinity())
114  {
115  }
116 };
bool shapeIntersectsAABB(const DtLocalVertexList &shape, const DtVector &lower, const DtVector &upper)
Convert geometry to internal coordinate system.
const double & x() const
Definition: point.h:188
void convertToOsgEarthCoordSys(DtPoint &p, CS_Type cstype)
convert to coordinate system used by osgEarth tiles
DtBoost::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:46
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
Definition: sphere.h:22
void update(const DtPoint &p)
update min and max values
Definition: terrainUtil.h:89
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
bool doubleEqual(double d1, double d2)
Convert geometry to internal coordinate system.
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:84
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:105
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:86
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)
Convert geometry to internal coordinate system.
MinMaxInfo()
Definition: terrainUtil.h:111
DtExtent sphereExtent(const DtSphere &sphere)
Convert geometry to internal coordinate system.
bool boundariesOverlap(double min1, double max1, double min2, double max2)
Convert geometry to internal coordinate system.
DtExtent boundingBox2DtExtent(const osg::BoundingBoxd &boundingBox)
Definition: point.h:34
double max
Definition: terrainUtil.h:86

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)