cee::ug::HitItem Class Reference

Small class containing the data for a hit of an intersection between a ray and a part in an UnstructGridModel. More...

Public Types

enum  ItemType { PART, CUTTING_PLANE, ISOSURFACE, ISOVOLUME }
 Item types for hit items. More...
 

Public Member Functions

 HitItem ()
 Constructs an empty hit item. More...
 
 HitItem (const HitItem &other)
 Constructs a copy of the given HitItem. More...
 
HitItemoperator= (const HitItem &other)
 Assignment operator. More...
 
ItemType itemType () const
 Returns the item type. More...
 
void setItemType (ItemType itemType)
 Sets the item type. More...
 
int itemId () const
 Returns the id/index of the hit item. More...
 
void setItemId (int itemId)
 Sets the part id for parts or index of item for cutting planes, isosurfaces and isovolumes. More...
 
size_t itemIndex () const
 Returns the index of the item. More...
 
void setItemIndex (size_t itemIndex)
 Sets the item index. This is the (local) index of the part, cutting plane, isosurface or isovolume. More...
 
int stateId () const
 Returns the state id of the hit item. More...
 
void setStateId (int stateId)
 Sets the state id. More...
 
size_t frameIndex () const
 Returns the frame index of the hit item. More...
 
void setFrameIndex (size_t frameIndex)
 Sets the geometry index. More...
 
size_t geometryIndex () const
 Returns the global geometry index, used to e.g. get the geometry from a DataState. More...
 
void setGeometryIndex (size_t geometryIndex)
 Sets the geometry index. More...
 
int partId () const
 Returns the part id, used to e.g. get the part from a DataGeometry. More...
 
void setPartId (int partId)
 Sets the id of the DataPart that was hit (or has the element hit in a cut/iso/particle trace) More...
 
size_t elementIndex () const
 Returns the zero based index of the selected element. More...
 
void setElementIndex (size_t elementIndex)
 Sets the zero based index of the hit element. More...
 
size_t nodeIndex () const
 Returns the zero based index of the closest node to the hit intersection point. More...
 
void setNodeIndex (size_t nodeIndex)
 Sets the zero based node index of the closest node. More...
 
size_t elementLocalNodeIndex () const
 Returns the local (within the element) node index that was hit. More...
 
void setElementLocalNodeIndex (size_t localNodeIndex)
 Sets the local (within the element) node index that was hit. More...
 
size_t elementLocalSurfaceIndex () const
 Returns the local (within the element) surface index that was hit. More...
 
void setElementLocalSurfaceIndex (size_t surfaceIndex)
 Sets the local (within the element) surface index that was hit. More...
 
size_t edgeNodeStartIndex () const
 Returns the zero based node index of first node of the closest edge. More...
 
void setEdgeNodeStartIndex (size_t nodeIndex)
 Sets the zero based node index of the closest node. More...
 
size_t edgeNodeEndIndex () const
 Returns the zero based node index of last node of the closest edge. More...
 
void setEdgeNodeEndIndex (size_t nodeIndex)
 Sets the zero based node index of the closest node. More...
 
Vec3d intersectionPoint () const
 Returns the intersection point. More...
 
void setIntersectionPoint (const Vec3d &intersectionPoint)
 Sets the intersection point. More...
 
Vec3d intersectionPointNormal () const
 Returns the normal to the intersection point. More...
 
void setIntersectionPointNormal (const Vec3d &intersectionPointNormal)
 Sets the intersection point's normal. More...
 
size_t triangleIndex () const
 Sets the triangle index of the hit item. More...
 
void setTriangleIndex (size_t triangleIndex)
 Sets the intersection point's normal. More...
 
double distanceAlongRay () const
 Returns the distance along the ray. More...
 
void setDistanceAlongRay (double distance)
 Sets the distance along the ray. More...
 

Detailed Description

Small class containing the data for a hit of an intersection between a ray and a part in an UnstructGridModel.

int winCoordX = 0, winCoordY = 0;
cee::Ray ray = m_viewer->view()->camera().rayFromWindowCoordinates(winCoordX, winCoordY);
bool hitSomething = ugModel->rayIntersect(ray, &hitItem);
See also
Ray
UnstructGridModel

Member Enumeration Documentation

Item types for hit items.

Enumerator
PART 

The hit item is a Part.

CUTTING_PLANE 

The hit item is a Cutting plane.

ISOSURFACE 

The hit item is an Isosurface.

ISOVOLUME 

The hit item is an Isovolume.

Constructor & Destructor Documentation

cee::ug::HitItem::HitItem ( )

Constructs an empty hit item.

cee::ug::HitItem::HitItem ( const HitItem other)

Constructs a copy of the given HitItem.

Member Function Documentation

double cee::ug::HitItem::distanceAlongRay ( ) const

Returns the distance along the ray.

size_t cee::ug::HitItem::edgeNodeEndIndex ( ) const

Returns the zero based node index of last node of the closest edge.

size_t cee::ug::HitItem::edgeNodeStartIndex ( ) const

Returns the zero based node index of first node of the closest edge.

size_t cee::ug::HitItem::elementIndex ( ) const

Returns the zero based index of the selected element.

The index refers to the DataElements of the DataPart with the id specified in partId().

size_t cee::ug::HitItem::elementLocalNodeIndex ( ) const

Returns the local (within the element) node index that was hit.

See Element for more info.

size_t cee::ug::HitItem::elementLocalSurfaceIndex ( ) const

Returns the local (within the element) surface index that was hit.

See Element for more info.

size_t cee::ug::HitItem::frameIndex ( ) const

Returns the frame index of the hit item.

size_t cee::ug::HitItem::geometryIndex ( ) const

Returns the global geometry index, used to e.g. get the geometry from a DataState.

cee::Vec3d cee::ug::HitItem::intersectionPoint ( ) const

Returns the intersection point.

cee::Vec3d cee::ug::HitItem::intersectionPointNormal ( ) const

Returns the normal to the intersection point.

int cee::ug::HitItem::itemId ( ) const

Returns the id/index of the hit item.

If the hit item is a part, the part id is returned. If the hit item was a cutting plane, isosurface or isovolume, -1 is returned. Use itemIndex() instead. Check itemType() for which item type that was hit.

size_t cee::ug::HitItem::itemIndex ( ) const

Returns the index of the item.

HitItem::ItemType cee::ug::HitItem::itemType ( ) const

Returns the item type.

Available item types are PART, CUTTING_PLANE, ISOSURFACE and ISOVOLUME.

See also
ItemType
size_t cee::ug::HitItem::nodeIndex ( ) const

Returns the zero based index of the closest node to the hit intersection point.

HitItem & cee::ug::HitItem::operator= ( const HitItem other)

Assignment operator.

int cee::ug::HitItem::partId ( ) const

Returns the part id, used to e.g. get the part from a DataGeometry.

If itemType is PART, this will be the same as itemId(). If itemType is CUTTING_PLANE, ISOSURFACE or ISOVOLUME, this is the id of the DataPart in which the intersected element is located in.

void cee::ug::HitItem::setDistanceAlongRay ( double  distance)

Sets the distance along the ray.

void cee::ug::HitItem::setEdgeNodeEndIndex ( size_t  nodeIndex)

Sets the zero based node index of the closest node.

void cee::ug::HitItem::setEdgeNodeStartIndex ( size_t  nodeIndex)

Sets the zero based node index of the closest node.

void cee::ug::HitItem::setElementIndex ( size_t  elementIndex)

Sets the zero based index of the hit element.

void cee::ug::HitItem::setElementLocalNodeIndex ( size_t  localNodeIndex)

Sets the local (within the element) node index that was hit.

See Element for more info.

void cee::ug::HitItem::setElementLocalSurfaceIndex ( size_t  surfaceIndex)

Sets the local (within the element) surface index that was hit.

See Element for more info.

void cee::ug::HitItem::setFrameIndex ( size_t  frameIndex)

Sets the geometry index.

void cee::ug::HitItem::setGeometryIndex ( size_t  geometryIndex)

Sets the geometry index.

void cee::ug::HitItem::setIntersectionPoint ( const Vec3d intersectionPoint)

Sets the intersection point.

void cee::ug::HitItem::setIntersectionPointNormal ( const Vec3d intersectionPointNormal)

Sets the intersection point's normal.

void cee::ug::HitItem::setItemId ( int  itemId)

Sets the part id for parts or index of item for cutting planes, isosurfaces and isovolumes.

void cee::ug::HitItem::setItemIndex ( size_t  itemIndex)

Sets the item index. This is the (local) index of the part, cutting plane, isosurface or isovolume.

void cee::ug::HitItem::setItemType ( ItemType  itemType)

Sets the item type.

Available item types are PART, CUTTING_PLANE, ISOSURFACE and ISOVOLUME.

See also
ItemType
void cee::ug::HitItem::setNodeIndex ( size_t  nodeIndex)

Sets the zero based node index of the closest node.

void cee::ug::HitItem::setPartId ( int  partId)

Sets the id of the DataPart that was hit (or has the element hit in a cut/iso/particle trace)

void cee::ug::HitItem::setStateId ( int  stateId)

Sets the state id.

void cee::ug::HitItem::setTriangleIndex ( size_t  triangleIndex)

Sets the intersection point's normal.

int cee::ug::HitItem::stateId ( ) const

Returns the state id of the hit item.

size_t cee::ug::HitItem::triangleIndex ( ) const

Sets the triangle index of the hit item.

The triangle index is the index in the display model of the object.

If this is a normal part (type == PART), this index corresponds to the output from the VisualizationPartQuery::visibleTriangles() method.

For cutting planes, isosurfaces and isovolumes, this index corresponds to the triangles in CuttingPlaneData, IsosurfaceData or IsovolumeData.