cee::ug::Isosurface

class Isosurface : public RefCountedObject

Configuration of an isosurface.

../_images/isosurface.png

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: Isosurfaces

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.

    • Fringes

      Show scalar fringes on an isosurface using

      setMapScalarResultId() with the requested scalar result id.

    • Contour lines

      Show scalar contour lines on an isosurface using

      setMapContourLinesResultId() with the requested scalar result id.

    • Vectors

      Show a vector result mapped on the isosurface using

      setMapVectorResultId() with the requested vector result id.

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

cee::PtrRef<cee::ug::Isosurface> isoSurface = new cee::ug::Isosurface();
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.

cee::ug::PartSettingsIterator it(ugModel.get());
while (it.hasNext())
{
    cee::ug::PartSettings* partSettings = it.next();
    partSettings->setDrawStyle(cee::ug::PartSettings::OUTLINE);
}

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

Tutorials UnstructGrid: Create an Isosurface

Public Types

enum DrawStyle

Isosurface surface draw styles.

Values:

enumerator SURFACE

Draw as surface.

enumerator SURFACE_MESH

Draw as surface mesh.

enumerator SURFACE_OUTLINE_MESH

Draw as outline mesh

enumerator LINE

Draw as lines.

enumerator OUTLINE

Draw as outline.

Public Functions

Isosurface()

Constructs an empty isosurface object.

bool visible() const

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

void setVisible(bool visible)

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

bool highlight() const

Returns true if current isosurface is highlighted.

void setHighlight(bool showHighlighted)

Toggles isosurface highlighting.

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

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

DrawStyle drawStyle() const

Returns the current draw style of the isosurface.

void setDrawStyle(DrawStyle drawStyle)

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

Color3f surfaceColor() const

Returns the surface color.

void setSurfaceColor(const Color3f &color)

Sets the surface color.

float opacity() const

Returns the opacity of the isosurface.

1.0 is opaque and 0.0 is fully transparent (invisible)

void setOpacity(float opacity)

Sets the opacity of the isosurface.

1.0 is opaque and 0.0 is fully transparent (invisible)

float specularIntensity() const

Returns the specular intensity set for this isosurface.

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

double isoValue() const

Returns the iso scalar value.

void setIsoValue(double value)

Sets the iso scalar value.

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

int isoScalarResultId() const

Returns the id of the current iso scalar result.

void setIsoScalarResultId(int resultId)

Sets the result defining the isosurface.

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

See also

setIsoValue()

bool computeFromVisibleParts() const

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

void setComputeFromVisibleParts(bool visiblePartsOnly)

Sets if isosurface should only be computed from visible parts.

int mapScalarResultId() const

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

Returns -1 if none.

void setMapScalarResultId(int resultId)

Sets the scalar result to be mapped on the surface.

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

int mapVectorResultId() const

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

Returns -1 if none.

void setMapVectorResultId(int resultId)

Sets the vector result to be mapped on the surface.

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

int mapContourLinesResultId() const

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

Returns -1 if none.

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

bool isPrecomputed() const

Returns true if the isosurface is precomputed.

Precomputed isosurfaces cannot be altered or moved.

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.

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.

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.

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