cee::ug::HitItem

class HitItem

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);
cee::ug::HitItem hitItem;
bool hitSomething = ugModel->rayIntersect(ray, &hitItem);

See also

Ray and UnstructGridModel

Public Types

enum ItemType

Item types for hit items.

Values:

enumerator PART

The hit item is a Part.

enumerator CUTTING_PLANE

The hit item is a Cutting plane.

enumerator ISOSURFACE

The hit item is an Isosurface.

enumerator ISOVOLUME

The hit item is an Isovolume.

Public Functions

HitItem()

Constructs an empty hit item.

HitItem(const HitItem &other)

Constructs a copy of the given HitItem.

HitItem &operator=(const HitItem &other)

Assignment operator.

ItemType itemType() const

Returns the item type.

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

void setItemType(ItemType itemType)

Sets the item type.

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

int 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.

void setItemId(int itemId)

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

size_t itemIndex() const

Returns the index of the item.

void setItemIndex(size_t itemIndex)

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

int stateId() const

Returns the state id of the hit item.

void setStateId(int stateId)

Sets the state id.

size_t frameIndex() const

Returns the frame index of the hit item.

void setFrameIndex(size_t frameIndex)

Sets the geometry index.

size_t geometryIndex() const

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

void setGeometryIndex(size_t geometryIndex)

Sets the geometry index.

int 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 setPartId(int partId)

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

size_t 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().

void setElementIndex(size_t elementIndex)

Sets the zero based index of the hit element.

size_t nodeIndex() const

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

void setNodeIndex(size_t nodeIndex)

Sets the zero based node index of the closest node.

size_t elementLocalNodeIndex() const

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

See Element for more info.

void setElementLocalNodeIndex(size_t localNodeIndex)

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

See Element for more info.

size_t elementLocalSurfaceIndex() const

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

See Element for more info.

void setElementLocalSurfaceIndex(size_t surfaceIndex)

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

See Element for more info.

size_t edgeNodeStartIndex() const

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

void setEdgeNodeStartIndex(size_t nodeIndex)

Sets the zero based node index of the closest node.

size_t edgeNodeEndIndex() const

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

void setEdgeNodeEndIndex(size_t nodeIndex)

Sets the zero based node index of the closest node.

Vec3d intersectionPoint() const

Returns the intersection point.

void setIntersectionPoint(const Vec3d &intersectionPoint)

Sets the intersection point.

Vec3d intersectionPointNormal() const

Returns the normal to the intersection point.

void setIntersectionPointNormal(const Vec3d &intersectionPointNormal)

Sets the intersection point’s normal.

size_t 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.

void setTriangleIndex(size_t triangleIndex)

Sets the intersection point’s normal.

double distanceAlongRay() const

Returns the distance along the ray.

void setDistanceAlongRay(double distance)

Sets the distance along the ray.