Isis 3 Programmer Reference
Isis::BulletDskShape Class Reference

Bullet Target Shape for NAIF type 2 DSK models. More...

#include <BulletDskShape.h>

Inheritance diagram for Isis::BulletDskShape:
Inheritance graph
Collaboration diagram for Isis::BulletDskShape:
Collaboration graph

Public Member Functions

 BulletDskShape ()
 Default empty constructor. More...
 
 BulletDskShape (const QString &dskfile)
 Construct a BulletDskShape from a DSK file. More...
 
virtual ~BulletDskShape ()
 Desctructor. More...
 
int getNumTriangles () const
 Return the number of triangles in the shape. More...
 
int getNumVertices () const
 Return the number of verticies in the shape. More...
 
virtual btVector3 getNormal (const int indexId, const int segment=0) const
 Return normal for a given triangle index. More...
 
virtual btMatrix3x3 getTriangle (const int index, const int segment=0) const
 Get the vertices of a triangle in the mesh. More...
 
QString name () const
 Return name of the target shape. More...
 
void writeBullet (const QString &btName) const
 Write a serialized version of the target shape to a Bullet file. More...
 
btCollisionObject * body () const
 Return a pointer to the Bullet target object/shape. More...
 
btScalar maximumDistance () const
 

Static Public Member Functions

static BulletTargetShapeload (const QString &dem, const Pvl *conf=0)
 Load a DEM file into the target shape. More...
 
static BulletTargetShapeloadPC (const QString &dem, const Pvl *conf=0)
 Load a point cloud type DEM in Bullet. More...
 
static BulletTargetShapeloadDSK (const QString &dem, const Pvl *conf=0)
 Load a DSK in Bullet. More...
 
static BulletTargetShapeloadCube (const QString &dem, const Pvl *conf=0)
 Load an ISIS cube type DEM in Bullet. More...
 

Protected Member Functions

void setTargetBody (btCollisionObject *body)
 Set the Bullet shape object to this object instance
More...
 
void setMaximumDistance ()
 Calculate and save the maximum distance across the body. More...
 

Private Member Functions

void loadFromDsk (const QString &dskfile)
 ! Triangular mesh representation of the target shape. More...
 

Private Attributes

QSharedPointer< btTriangleIndexVertexArray > m_mesh
 
QString m_name
 
QSharedPointer< btCollisionObject > m_btbody
 ! The name of the body More...
 
btScalar m_maximumDistance
 ! The Bullet collision object for the body More...
 

Detailed Description

Bullet Target Shape for NAIF type 2 DSK models.

Author
2017-03-17 Kris Becker
History:
2017-03-17 Kris Becker Original Version

Definition at line 26 of file BulletDskShape.h.

Constructor & Destructor Documentation

◆ BulletDskShape() [1/2]

Isis::BulletDskShape::BulletDskShape ( )

Default empty constructor.

Definition at line 34 of file BulletDskShape.cpp.

◆ BulletDskShape() [2/2]

Isis::BulletDskShape::BulletDskShape ( const QString &  dskfile)

Construct a BulletDskShape from a DSK file.

Parameters
dskfileThe DSK file to load into a Bullet target shape.

Definition at line 42 of file BulletDskShape.cpp.

References loadFromDsk(), and Isis::BulletTargetShape::setMaximumDistance().

◆ ~BulletDskShape()

Isis::BulletDskShape::~BulletDskShape ( )
virtual

Desctructor.

Definition at line 51 of file BulletDskShape.cpp.

Member Function Documentation

◆ body()

btCollisionObject * Isis::BulletTargetShape::body ( ) const
inherited

Return a pointer to the Bullet target object/shape.

Returns
btCollisionObject A target to the Bullet collision object.

Definition at line 150 of file BulletTargetShape.cpp.

References Isis::BulletTargetShape::m_btbody.

Referenced by Isis::BulletWorldManager::addTarget(), and Isis::BulletTargetShape::setTargetBody().

◆ getNormal()

btVector3 Isis::BulletDskShape::getNormal ( const int  indexId,
const int  segment = 0 
) const
virtual

Return normal for a given triangle index.

This method is particularly useful to return the normal of a triangle plate in a mesh-based target body.

Author
2017-03-28 Kris Becker
Parameters
indexIdThe index of the triangle in the mesh.
Returns
btVector3 The local normal for the triangle.

Definition at line 113 of file BulletDskShape.cpp.

References getTriangle().

◆ getNumTriangles()

int Isis::BulletDskShape::getNumTriangles ( ) const

Return the number of triangles in the shape.

Returns
int The number of triangles. If nothing has been loaded, then 0 is returned.

Definition at line 70 of file BulletDskShape.cpp.

◆ getNumVertices()

int Isis::BulletDskShape::getNumVertices ( ) const

Return the number of verticies in the shape.

Returns
int The number of verticies. If nothing has been loaded, then 0 is returned.

Definition at line 88 of file BulletDskShape.cpp.

◆ getTriangle()

btMatrix3x3 Isis::BulletDskShape::getTriangle ( const int  index,
const int  segment = 0 
) const
virtual

Get the vertices of a triangle in the mesh.

Parameters
indexThe index of the triangle in the mesh.
Returns
btMatrix3x3 Matrix with each row containing the coordinate of a vertex. The vertices are ordered counter-clockwise around the surface normal of the triangle.

Definition at line 130 of file BulletDskShape.cpp.

Referenced by getNormal().

◆ load()

BulletTargetShape * Isis::BulletTargetShape::load ( const QString &  dem,
const Pvl conf = 0 
)
staticinherited

Load a DEM file into the target shape.

Parameters
demThe DEM file to load.
confPVL config for the DEM load. Currently unused.
Returns
BulletTargetShape A target shape containing the DEM

Definition at line 84 of file BulletTargetShape.cpp.

References Isis::FileName::extension(), Isis::BulletTargetShape::loadCube(), Isis::BulletTargetShape::loadDSK(), and Isis::BulletTargetShape::loadPC().

Referenced by Isis::BulletShapeModel::BulletShapeModel().

◆ loadCube()

BulletTargetShape * Isis::BulletTargetShape::loadCube ( const QString &  dem,
const Pvl conf = 0 
)
staticinherited

Load an ISIS cube type DEM in Bullet.

Note
Currently not implemented
Parameters
demThe DEM file to load.
confPVL config for the DEM load. Currently unused.
Returns
BulletTargetShape A target shape containing the DEM

Definition at line 130 of file BulletTargetShape.cpp.

Referenced by Isis::BulletTargetShape::load().

◆ loadDSK()

BulletTargetShape * Isis::BulletTargetShape::loadDSK ( const QString &  dem,
const Pvl conf = 0 
)
staticinherited

Load a DSK in Bullet.

Parameters
demThe DEM file to load.
confPVL config for the DEM load. Currently unused.
Returns
BulletTargetShape A target shape containing the DEM

Definition at line 117 of file BulletTargetShape.cpp.

Referenced by Isis::BulletTargetShape::load().

◆ loadFromDsk()

void Isis::BulletDskShape::loadFromDsk ( const QString &  dskfile)
private

! Triangular mesh representation of the target shape.

Load the contents of a NAIF DSK and create a Bullet triangle mesh.

The vertex ordering is the same as in the DSK file, except the DSK uses 1-based indexing and this uses 0-based indexing.

Author
2017-03-28 Kris Becker
Parameters
dskfileThe DSK file to load.

NAIF DSK parameter setup

< The DAS file handle of the DSK file.

Definition at line 162 of file BulletDskShape.cpp.

References Isis::NaifStatus::CheckErrors(), Isis::FileName::expanded(), Isis::FileName::fileExists(), Isis::BulletTargetShape::setTargetBody(), and Isis::IException::User.

Referenced by BulletDskShape().

◆ loadPC()

BulletTargetShape * Isis::BulletTargetShape::loadPC ( const QString &  dem,
const Pvl conf = 0 
)
staticinherited

Load a point cloud type DEM in Bullet.

Note
Currently not implemented
Parameters
demThe DEM file to load.
confPVL config for the DEM load. Currently unused.
Returns
BulletTargetShape A target shape containing the DEM

Definition at line 105 of file BulletTargetShape.cpp.

Referenced by Isis::BulletTargetShape::load().

◆ name()

QString Isis::BulletTargetShape::name ( ) const
inherited

Return name of the target shape.

Returns
QString The target name

Definition at line 71 of file BulletTargetShape.cpp.

Referenced by Isis::BulletShapeModel::BulletShapeModel(), and Isis::BulletWorldManager::getTarget().

◆ setMaximumDistance()

void Isis::BulletTargetShape::setMaximumDistance ( )
protectedinherited

Calculate and save the maximum distance across the body.

This is calculated as the distance from the x, y, z minimum to x, y, z maximum.

Definition at line 54 of file BulletTargetShape.cpp.

References Isis::BulletTargetShape::m_btbody, and Isis::BulletTargetShape::m_maximumDistance.

Referenced by BulletDskShape(), Isis::BulletTargetShape::BulletTargetShape(), and Isis::BulletTargetShape::setTargetBody().

◆ setTargetBody()

void Isis::BulletTargetShape::setTargetBody ( btCollisionObject *  body)
protectedinherited

Set the Bullet shape object to this object instance

Definition at line 156 of file BulletTargetShape.cpp.

References Isis::BulletTargetShape::body(), Isis::BulletTargetShape::m_btbody, and Isis::BulletTargetShape::setMaximumDistance().

Referenced by loadFromDsk().

◆ writeBullet()

void Isis::BulletTargetShape::writeBullet ( const QString &  btName) const
inherited

Write a serialized version of the target shape to a Bullet file.

Parameters
btNameThe name of the file to write the target shape to.
Note
Currently not implemented

Definition at line 141 of file BulletTargetShape.cpp.

Member Data Documentation

◆ m_btbody

QSharedPointer<btCollisionObject> Isis::BulletTargetShape::m_btbody
privateinherited

◆ m_maximumDistance

btScalar Isis::BulletTargetShape::m_maximumDistance
privateinherited

! The Bullet collision object for the body

Definition at line 60 of file BulletTargetShape.h.

Referenced by Isis::BulletTargetShape::setMaximumDistance().


The documentation for this class was generated from the following files: