23#ifndef _GROUNDCACHE_HXX
24#define _GROUNDCACHE_HXX
26#include <simgear/compiler.h>
27#include <simgear/constants.h>
28#include <simgear/math/SGMath.hxx>
29#include <simgear/math/SGGeometry.hxx>
30#include <simgear/bvh/BVHNode.hxx>
31#include <simgear/structure/SGSharedPtr.hxx>
34#ifdef GROUNDCACHE_DEBUG
37#include <simgear/timing/timestamp.hxx>
58 const SGVec3d& pt,
double rad);
63 bool is_valid(
double& ref_time, SGVec3d& pt,
double& rad);
72 {
return cache_time_offset; }
74 { cache_time_offset = time_offset; }
76 bool get_body(
double t, SGMatrixd& bodyToWorld, SGVec3d& linearVel,
77 SGVec3d& angularVel, simgear::BVHNode::Id
id);
81 double get_cat(
double t,
const SGVec3d& pt,
82 SGVec3d end[2], SGVec3d vel[2]);
90 bool get_agl(
double t,
const SGVec3d& pt, SGVec3d& contact,
91 SGVec3d& normal, SGVec3d& linearVel, SGVec3d& angularVel,
92 simgear::BVHNode::Id&
id,
93 const simgear::BVHMaterial*& material);
95 bool get_nearest(
double t,
const SGVec3d& pt,
double maxDist,
96 SGVec3d& contact, SGVec3d& linearVel, SGVec3d& angularVel,
97 simgear::BVHNode::Id&
id,
98 const simgear::BVHMaterial*& material);
108 bool get_wire_ends(
double t, SGVec3d end[2], SGVec3d vel[2]);
117 class CatapultFinder;
118 class WireIntersector;
125 const simgear::BVHMaterial* _material;
128 double cache_ref_time;
130 double cache_time_offset;
132 const simgear::BVHLineGeometry* _wire;
136 SGVec3d reference_wgs84_point;
137 double reference_vehicle_radius;
141 SGSharedPtr<simgear::BVHNode> _localBvhTree;
143#ifdef GROUNDCACHE_DEBUG
144 SGTimeStamp _lookupTime;
145 unsigned _lookupCount;
146 SGTimeStamp _buildTime;
147 unsigned _buildCount;
149 osg::ref_ptr<osg::Group> _group;
bool get_body(double t, SGMatrixd &bodyToWorld, SGVec3d &linearVel, SGVec3d &angularVel, simgear::BVHNode::Id id)
const SGVec3d & get_down() const
bool get_agl(double t, const SGVec3d &pt, SGVec3d &contact, SGVec3d &normal, SGVec3d &linearVel, SGVec3d &angularVel, simgear::BVHNode::Id &id, const simgear::BVHMaterial *&material)
void set_cache_time_offset(double time_offset)
bool is_valid(double &ref_time, SGVec3d &pt, double &rad)
double get_cat(double t, const SGVec3d &pt, SGVec3d end[2], SGVec3d vel[2])
bool get_nearest(double t, const SGVec3d &pt, double maxDist, SGVec3d &contact, SGVec3d &linearVel, SGVec3d &angularVel, simgear::BVHNode::Id &id, const simgear::BVHMaterial *&material)
bool prepare_ground_cache(double startSimTime, double endSimTime, const SGVec3d &pt, double rad)
double get_cache_time_offset() const
bool get_wire_ends(double t, SGVec3d end[2], SGVec3d vel[2])
bool caught_wire(double t, const SGVec3d pt[4])