cee::ug::Isosurface Class Reference

Configuration of an isosurface. More...

Public Types

enum  DrawStyle {
  SURFACE, SURFACE_MESH, SURFACE_OUTLINE_MESH, LINE,
  OUTLINE
}
 Isosurface surface draw styles. More...
 

Public Member Functions

 Isosurface ()
 Constructs an empty isosurface object. More...
 
bool visible () const
 Returns true if the isosurface (and optional mapped vectors) is drawn. More...
 
void setVisible (bool visible)
 Specifies if the isosurface (and optional mapped vectors) should be drawn or not. More...
 
bool highlight () const
 Returns true if current isosurface is highlighted. More...
 
void setHighlight (bool showHighlighted)
 Toggles isosurface highlighting. More...
 
bool surfaceGeometryVisible () const
 Returns true if the isosurface itself should be drawn. More...
 
void setSurfaceGeometryVisible (bool show)
 Specifies if the geometry of the isosurface should be drawn or not. More...
 
DrawStyle drawStyle () const
 Returns the current draw style of the isosurface. More...
 
void setDrawStyle (DrawStyle drawStyle)
 Sets the draw style of the isosurface (surface, mesh, outline, lines) More...
 
Color3f surfaceColor () const
 Returns the surface color. More...
 
void setSurfaceColor (const Color3f &color)
 Sets the surface color. More...
 
float opacity () const
 Returns the opacity of the isosurface. More...
 
void setOpacity (float opacity)
 Sets the opacity of the isosurface. More...
 
float specularIntensity () const
 Returns the specular intensity set for this isosurface. More...
 
void setSpecularIntensity (float intensity)
 Sets the specular intensity to use for this isosurface. More...
 
double isoValue () const
 Returns the iso scalar value. More...
 
void setIsoValue (double value)
 Sets the iso scalar value. More...
 
int isoScalarResultId () const
 Returns the id of the current iso scalar result. More...
 
void setIsoScalarResultId (int resultId)
 Sets the result defining the isosurface. More...
 
bool computeFromVisibleParts () const
 Returns true if isosurface should only be computed for visible parts. More...
 
void setComputeFromVisibleParts (bool visiblePartsOnly)
 Sets if isosurface should only be computed from visible parts. More...
 
int mapScalarResultId () const
 Returns the id of the scalar result currently mapped on the surface. More...
 
void setMapScalarResultId (int resultId)
 Sets the scalar result to be mapped on the surface. More...
 
int mapVectorResultId () const
 Returns the id of the vector result currently mapped on the surface. More...
 
void setMapVectorResultId (int resultId)
 Sets the vector result to be mapped on the surface. More...
 
int mapContourLinesResultId () const
 Returns the id of the contour lines result currently mapped on the surface. More...
 
void setMapContourLinesResultId (int resultId)
 Sets the contour lines result to be mapped on the surface. More...
 
bool isPrecomputed () const
 Returns true if the isosurface is precomputed. More...
 
double sampleScalarValue (int stateId, const Vec3d &samplePosition, size_t triangleIndex=cee::UNDEFINED_SIZE_T) const
 Returns the sampled scalar value at the given sample position for a specified state. More...
 
Vec3d sampleVector (int stateId, const Vec3d &samplePosition, size_t triangleIndex=cee::UNDEFINED_SIZE_T) const
 Returns the sampled vector value at the given sample position for a specified state. More...
 
void data (int stateId, IsosurfaceData *data) const
 Gets the isosurface data for the given state. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 
Inheritance diagram for cee::ug::Isosurface:
cee::RefCountedObject

Detailed Description

Configuration of an isosurface.

An isosurface is defined of an area with a constant value (e.g. pressure, temperature, velocity, density) within a volume of space. It is the 3D equivalent of a contour line.

See the topic: Isosurface

See the tutorial: UnstructGrid: Create an isosurface

Isosurfaces may be derived based on any scalar result. In addition, another scalar result can be mapped as fringes onto the isosurface, showing for instance the variation of temperature over a surface of Constant pressure.

Any number of isosurfaces can be defined and displayed, and various display attributes can be set separately for each one.

  • Surface definition
    An isosurface is defined by a scalar result id (setIsoScalarResultId()) and an iso scalar value (setIsoValue()).
  • Modes
    As for normal parts, isosurfaces can also be set visible/invisible, be highlighted, apply draw styles, opacity and color.
  • Result mapping
    An additional scalar and vector result can be mapped on the isosurface.
Example

This example shown how to create an isosurface with scalar result mapped on the surface.

Set the fourth state as current in the model specification. (The displacement is zero in the first state.)

std::vector<cee::ug::StateInfo> stateInfos = source->directory()->stateInfos();
int stateId = stateInfos[3].id();
ugModel->modelSpec().setStateId(stateId);

Create the isosurface

Create the isosurface object. Remember that the object is reference counted and should not be created on the stack.

The isosurface is defined by a scalar result id and an iso scalar value.

Specify the result id and the result value to use for defining the isosurface. Use the scalar result with id = 7 (All displacements) and the iso scalar value = 6,5.

int scalarId = resultInfos[0].id();
isoSurface->setIsoScalarResultId(scalarId);
isoSurface->setIsoValue(6.5);

Set the scalar result to be shown as mapped fringes on the isosurface surface.

isoSurface->setMapScalarResultId(scalarId);

Add the isosurface to the model.

ugModel->addIsosurface(isoSurface.get());

To get a better view of the cutting plane inside the model, set all normal parts draw style to LINES.

while (it.hasNext())
{
cee::ug::PartSettings* partSettings = it.next();
}

See the complete source code at: UnstructGrid: Create an isosurface

See also
UnstructGridModel
Tutorials
UnstructGrid: Create an isosurface

Member Enumeration Documentation

Isosurface surface draw styles.

Enumerator
SURFACE 

Draw as surface.

SURFACE_MESH 

Draw as surface mesh.

SURFACE_OUTLINE_MESH 

Draw as outline mesh.

LINE 

Draw as lines.

OUTLINE 

Draw as outline.

Constructor & Destructor Documentation

cee::ug::Isosurface::Isosurface ( )

Constructs an empty isosurface object.

Member Function Documentation

bool cee::ug::Isosurface::computeFromVisibleParts ( ) const

Returns true if isosurface should only be computed for visible parts.

void cee::ug::Isosurface::data ( int  stateId,
IsosurfaceData data 
) const

Gets the isosurface data for the given state.

The isosurface data contains raw triangle data and result values.

See also
IsosurfaceData
Isosurface::DrawStyle cee::ug::Isosurface::drawStyle ( ) const

Returns the current draw style of the isosurface.

bool cee::ug::Isosurface::highlight ( ) const

Returns true if current isosurface is highlighted.

int cee::ug::Isosurface::isoScalarResultId ( ) const

Returns the id of the current iso scalar result.

double cee::ug::Isosurface::isoValue ( ) const

Returns the iso scalar value.

bool cee::ug::Isosurface::isPrecomputed ( ) const

Returns true if the isosurface is precomputed.

Precomputed isosurfaces cannot be altered or moved.

int cee::ug::Isosurface::mapContourLinesResultId ( ) const

Returns the id of the contour lines result currently mapped on the surface.

Returns -1 if none.

int cee::ug::Isosurface::mapScalarResultId ( ) const

Returns the id of the scalar result currently mapped on the surface.

Returns -1 if none.

int cee::ug::Isosurface::mapVectorResultId ( ) const

Returns the id of the vector result currently mapped on the surface.

Returns -1 if none.

float cee::ug::Isosurface::opacity ( ) const

Returns the opacity of the isosurface.

1.0 is opaque and 0.0 is fully transparent (invisible)

double cee::ug::Isosurface::sampleScalarValue ( int  stateId,
const Vec3d samplePosition,
size_t  triangleIndex = cee::UNDEFINED_SIZE_T 
) const

Returns the sampled scalar value at the given sample position for a specified state.

triangleIndex is optional and will speed up the lookup if provided. This corresponds to the cee::ug::HitItem::triangleIndex() value.

Returns cee::UNDEFINED_DOUBLE if no value was found.

cee::Vec3d cee::ug::Isosurface::sampleVector ( int  stateId,
const Vec3d samplePosition,
size_t  triangleIndex = cee::UNDEFINED_SIZE_T 
) const

Returns the sampled vector value at the given sample position for a specified state.

triangleIndex is optional and will speed up the lookup if provided. This corresponds to the cee::ug::HitItem::triangleIndex() value.

Returns a Vec3d with x, y, and z set to cee::UNDEFINED_DOUBLE if no vector values was found.

void cee::ug::Isosurface::setComputeFromVisibleParts ( bool  visiblePartsOnly)

Sets if isosurface should only be computed from visible parts.

void cee::ug::Isosurface::setDrawStyle ( DrawStyle  drawStyle)

Sets the draw style of the isosurface (surface, mesh, outline, lines)

void cee::ug::Isosurface::setHighlight ( bool  showHighlighted)

Toggles isosurface highlighting.

void cee::ug::Isosurface::setIsoScalarResultId ( int  resultId)

Sets the result defining the isosurface.

An isosurface is defined by a scalar result and an iso value.

See also
setIsoValue()
void cee::ug::Isosurface::setIsoValue ( double  value)

Sets the iso scalar value.

An isosurface is defined by a scalar result and an iso value.

See also
setIsoScalarResultId()
void cee::ug::Isosurface::setMapContourLinesResultId ( int  resultId)

Sets the contour lines result to be mapped on the surface.

Set resultId to -1 to clear the mapped contour lines result.

void cee::ug::Isosurface::setMapScalarResultId ( int  resultId)

Sets the scalar result to be mapped on the surface.

Set resultId to -1 to clear the mapped scalar result.

void cee::ug::Isosurface::setMapVectorResultId ( int  resultId)

Sets the vector result to be mapped on the surface.

Set resultId to -1 to clear the mapped vector result.

void cee::ug::Isosurface::setOpacity ( float  opacity)

Sets the opacity of the isosurface.

1.0 is opaque and 0.0 is fully transparent (invisible)

void cee::ug::Isosurface::setSpecularIntensity ( float  intensity)

Sets the specular intensity to use for this isosurface.

The specular intensity control the highlight and reflection of the light onto the part. The light is white, so this will cause the color of the part to get more white in the parts that reflect the light source.

Default is 0.5. Legal range is 0.0 -> 1.0, where 0.0 turns off the specular highlight.

void cee::ug::Isosurface::setSurfaceColor ( const Color3f color)

Sets the surface color.

void cee::ug::Isosurface::setSurfaceGeometryVisible ( bool  show)

Specifies if the geometry of the isosurface should be drawn or not.

Even if this is set to false, the mapped vectors will still be drawn. To hide the isosurface and the vectors, use the setVisible() method.

void cee::ug::Isosurface::setVisible ( bool  visible)

Specifies if the isosurface (and optional mapped vectors) should be drawn or not.

float cee::ug::Isosurface::specularIntensity ( ) const

Returns the specular intensity set for this isosurface.

cee::Color3f cee::ug::Isosurface::surfaceColor ( ) const

Returns the surface color.

bool cee::ug::Isosurface::surfaceGeometryVisible ( ) const

Returns true if the isosurface itself should be drawn.

Even if this returns false, the mapped vectors will still be drawn. To hide the isosurface and the vectors, use the setVisible() method.

bool cee::ug::Isosurface::visible ( ) const

Returns true if the isosurface (and optional mapped vectors) is drawn.