Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
BulletTargetShape.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7
8#include "BulletTargetShape.h"
9#include "BulletDskShape.h"
10
11#include <iostream>
12#include <iomanip>
13#include <numeric>
14#include <sstream>
15
16#include "FileName.h"
17#include "IException.h"
18#include "IString.h"
19#include "Pvl.h"
20
21namespace Isis {
22
30
31
38 BulletTargetShape::BulletTargetShape(btCollisionObject *btbody, const QString &name) {
39 m_name = name;
40 m_btbody = std::shared_ptr<btCollisionObject> ( btbody, BulletTargetShape::btDelete );
42 }
43
44
49
50
56 if (m_btbody) {
57 btVector3 center;
58 m_btbody->getCollisionShape()->getBoundingSphere(center, m_maximumDistance);
60 }
61 else {
63 }
64 }
65
66
72 QString BulletTargetShape::name() const {
73 return ( m_name );
74 }
75
76
85 BulletTargetShape *BulletTargetShape::load(const QString &dem, const Pvl *conf) {
86 FileName v_file(dem);
87
88 QString ext = v_file.extension().toLower();
89
90 if ( "bds" == ext) return ( loadDSK(dem) );
91 if ( "cub" == ext) return ( loadCube(dem) );
92 return ( loadPC(dem) );
93 }
94
95
106 BulletTargetShape *BulletTargetShape::loadPC(const QString &dem, const Pvl *conf) {
107 return (0);
108 }
109
118 BulletTargetShape *BulletTargetShape::loadDSK(const QString &dem, const Pvl *conf) {
119 return ( new BulletDskShape(dem) );
120 }
121
131 BulletTargetShape *BulletTargetShape::loadCube(const QString &dem, const Pvl *conf) {
132 return (0);
133 }
134
142 void BulletTargetShape::writeBullet(const QString &btName) const {
143
144 }
145
151 btCollisionObject *BulletTargetShape::body() const {
152 return ( m_btbody.get() );
153 }
154
155
157 void BulletTargetShape::setTargetBody(btCollisionObject *body) {
158 m_btbody = std::shared_ptr<btCollisionObject> ( body, BulletTargetShape::btDelete );
159 m_btbody->setUserPointer(this);
161 return;
162 }
163
164 btScalar BulletTargetShape::maximumDistance() const {
165 return m_maximumDistance;
166 }
167
168 void BulletTargetShape::btDelete( btCollisionObject *btbody ) {
169 if ( nullptr != btbody ) {
170 delete btbody->getCollisionShape();
171 delete btbody;
172 }
173 return;
174 }
175
176
177} // namespace Isis
Bullet Target Shape for NAIF type 2 DSK models.
static BulletTargetShape * loadCube(const QString &dem, const Pvl *conf=0)
Load an ISIS cube type DEM in Bullet.
void setTargetBody(btCollisionObject *body)
Set the Bullet shape object to this object instance.
static BulletTargetShape * loadDSK(const QString &dem, const Pvl *conf=0)
Load a DSK in Bullet.
btCollisionObject * body() const
Return a pointer to the Bullet target object/shape.
static BulletTargetShape * loadPC(const QString &dem, const Pvl *conf=0)
Load a point cloud type DEM in Bullet.
void writeBullet(const QString &btName) const
Write a serialized version of the target shape to a Bullet file.
static BulletTargetShape * load(const QString &dem, const Pvl *conf=0)
Load a DEM file into the target shape.
QString name() const
Return name of the target shape.
void setMaximumDistance()
Calculate and save the maximum distance across the body.
std::shared_ptr< btCollisionObject > m_btbody
!
BulletTargetShape()
Default empty constructor.
virtual ~BulletTargetShape()
Desctructor.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16