Configuration of a cutting plane. More...
Public Types | |
enum | DrawStyle { SURFACE, SURFACE_MESH, SURFACE_OUTLINE_MESH, LINE, OUTLINE } |
Cutting plane surface draw styles. More... | |
enum | SpacingMode { ABSOLUTE_SPACING, RELATIVE_SPACING } |
Vector grid spacing mode. More... | |
Public Member Functions | |
CuttingPlane () | |
Constructs an empty cutting plane. More... | |
bool | visible () const |
Returns true if the cutting plane is visible. More... | |
void | setVisible (bool visible) |
Toggles cutting plane visibility. More... | |
bool | highlight () const |
Returns true if the cutting plane is highlighted. More... | |
void | setHighlight (bool showHighlighted) |
Specifies if the cutting plane is shown highlighted or not. More... | |
bool | planeSurfaceVisible () const |
Returns true if cutting plane surface is visible. More... | |
void | setPlaneSurfaceVisible (bool show) |
Specifies if the cutting plane surface is visible or not. More... | |
DrawStyle | drawStyle () const |
Returns the current draw style of the cutting plane. More... | |
void | setDrawStyle (DrawStyle drawStyle) |
Sets the draw style of the cutting plane. More... | |
Color3f | surfaceColor () const |
Returns the surface color for the cutting plane. More... | |
void | setSurfaceColor (const Color3f &color) |
Sets the surface color for the cutting plane. More... | |
float | opacity () const |
Returns the opacity of the cutting plane. More... | |
void | setOpacity (float opacity) |
Sets the opacity of the cutting plane. More... | |
float | specularIntensity () const |
Returns the specular intensity set for this cutting plane. More... | |
void | setSpecularIntensity (float intensity) |
Sets the specular intensity to use for this cutting plane. More... | |
bool | useSourcePartColor () const |
Returns true if the color of the source part of the cutting plane will be used as the plan color (if no results are shown). More... | |
void | setUseSourcePartColor (bool useSourcePartColor) |
Specifies to use the color of the source part or a fixed color for the cutting plane. More... | |
bool | crinkleCutSurface () const |
Returns true if the cutting plane is showing a crinkle cut surface. More... | |
void | setCrinkleCutSurface (bool useCrinkleCutSurface) |
Specifies if the cutting plane should show a crinkle cut surface. More... | |
bool | clipping () const |
Returns true if clipping of the model by the cutting plane is enabled. More... | |
void | setClipping (bool enableClipping) |
Enables clipping of the model by the cutting plane. More... | |
Vec3d | point () const |
Returns point in cutting plane. More... | |
void | setPoint (Vec3d pointInPlane) |
Sets a point that the cutting plane passes through. More... | |
Vec3d | normal () const |
Returns the cutting plane's normal. More... | |
void | setNormal (Vec3d normal) |
Sets the cutting plane's normal vector. More... | |
bool | computeFromVisibleParts () const |
Returns true if cutting plane applies to visible parts only. More... | |
void | setComputeFromVisibleParts (bool visiblePartsOnly) |
Sets the cutting plane to only cut visible parts. More... | |
bool | alsoComputeFromUndeformedModel () const |
Returns true if cutting plane applies to visible parts only. More... | |
void | setAlsoComputeFromUndeformedModel (bool alsoShowForUndeformedModel) |
Sets the cutting plane to only cut visible parts. More... | |
int | mapScalarResultId () const |
Returns the id for the current scalar result mapped on the cutting plane. More... | |
void | setMapScalarResultId (int resultId) |
Sets scalar result to map onto the cutting plane surface. More... | |
int | mapVectorResultId () const |
Returns the id of the current vector result shown on the cutting plane. More... | |
void | setMapVectorResultId (int resultId) |
Sets vector result to show on the cutting plane surface. More... | |
int | mapContourLinesResultId () const |
Returns the id of the contour lines result currently mapped on the cutting plane. More... | |
void | setMapContourLinesResultId (int resultId) |
Sets the contour lines result to be mapped on the cutting plane. More... | |
double | vectorGridSpacing () const |
Returns the grid spacing to use for the vectors on the cutting plane. More... | |
SpacingMode | vectorGridSpacingMode () const |
Returns the current spacing mode used when mapping vectors onto the cutting plane. More... | |
void | setVectorGridSpacing (SpacingMode mode, double spacing) |
Sets the grid spacing used for drawing vectors on cutting planes. More... | |
bool | gridLinesVisible () const |
Returns true if grid lines are set visible on cutting plane. More... | |
void | setGridLinesVisible (bool visible) |
Sets grid line visibility. More... | |
bool | projectVectorsOnPlane () const |
Returns true if the vectors are projected onto the cutting plane. More... | |
void | setProjectVectorsOnPlane (bool project) |
Sets if the vectors should be projected onto the cutting plane or not. More... | |
bool | isPrecomputed () const |
Returns true if the cutting plane 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, CuttingPlaneData *cuttingPlaneData) |
Gets the cutting plane data for the given state. More... | |
void | partData (int stateId, size_t globalGeometryIndex, int partId, CuttingPlaneData *cuttingPlaneData) |
Gets the cutting plane data for the given state and part. More... | |
void | setPerFrameTransformationMatrices (const std::vector< Mat4d > &matrices) |
Sets per frame transformation matrices for the cutting plane. More... | |
size_t | transformationMatrixFrameCount () const |
Returns the number of frames there are transformation matrices defined for. More... | |
Mat4d | frameTransformationMatrix (size_t frameIndex) const |
Returns the transformation matrix of the cutting plane for the given frame. More... | |
![]() | |
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... | |
Configuration of a cutting plane.
Cutting planes are slices through the structure onto which scalar and vector fields can be visualized. By dynamically changing the position and orientation of the cutting plane, you can quickly analyze the results inside the system.
Cutting planes are available for unstructured grid models.
See the topic: Cutting planes
See tutorial: UnstructGrid: Create a cutting plane with a scalar result as fringes.
A cutting plane is defined by a point and a normal vector. Any number of cutting planes can be defined and displayed, and various display attributes can be set separately for each cutting plane.
As for normal parts, cutting planes can also toggle visibility and be highlighted.
Cutting planes has some simple part settings for the visualized cutting plane surface, for example:
Onto each cutting plane, a mapped scalar, contour lines and a vector result can be visualized.
Cutting planes can also be used to clip the model in the same plane as the cutting plane. In the image to the right two cutting planes are defined with clipping enabled on both planes. Only the part of the model on the correct side of both cutting planes will be visible. Vectors and the cutting plane itself are clipped accordingly.
Model settings has a setting setMustBeBehindAllCuttingPlanesToClip where you can control how clipping against cutting planes will be done if more than one plane is specified.
Useful for creating "bounded clipping planes" where you define multiple planes in a way that only fragments rejected by all (e.g. inside a box) will be rejected. This allows for "cutting into" a model without removing everything one one side of a plane.
The default value is 1, which is normal clipping and a fragment is clipped if clipped by one (or more) clipping planes (as seen in the example above).
To the right there is an example of a Model with 4 clipping plane defining the bottom, right, back, and left cutting plane with clipping enabled. setMustBeBehindAllCuttingPlanesToClip(true) is used to create bounded clipping planes.
cee::ug::CuttingPlane::CuttingPlane | ( | ) |
Constructs an empty cutting plane.
bool cee::ug::CuttingPlane::alsoComputeFromUndeformedModel | ( | ) | const |
Returns true if cutting plane applies to visible parts only.
bool cee::ug::CuttingPlane::clipping | ( | ) | const |
Returns true if clipping of the model by the cutting plane is enabled.
bool cee::ug::CuttingPlane::computeFromVisibleParts | ( | ) | const |
Returns true if cutting plane applies to visible parts only.
bool cee::ug::CuttingPlane::crinkleCutSurface | ( | ) | const |
Returns true if the cutting plane is showing a crinkle cut surface.
void cee::ug::CuttingPlane::data | ( | int | stateId, |
CuttingPlaneData * | cuttingPlaneData | ||
) |
Gets the cutting plane data for the given state.
The cutting plane data contains raw triangle data and result values.
CuttingPlane::DrawStyle cee::ug::CuttingPlane::drawStyle | ( | ) | const |
Returns the current draw style of the cutting plane.
cee::Mat4d cee::ug::CuttingPlane::frameTransformationMatrix | ( | size_t | frameIndex | ) | const |
Returns the transformation matrix of the cutting plane for the given frame.
bool cee::ug::CuttingPlane::gridLinesVisible | ( | ) | const |
Returns true if grid lines are set visible on cutting plane.
bool cee::ug::CuttingPlane::highlight | ( | ) | const |
Returns true if the cutting plane is highlighted.
bool cee::ug::CuttingPlane::isPrecomputed | ( | ) | const |
Returns true if the cutting plane is precomputed.
Precomputed cutting plane cannot be altered or moved.
int cee::ug::CuttingPlane::mapContourLinesResultId | ( | ) | const |
Returns the id of the contour lines result currently mapped on the cutting plane.
Returns -1 if none.
int cee::ug::CuttingPlane::mapScalarResultId | ( | ) | const |
Returns the id for the current scalar result mapped on the cutting plane.
Returns -1 if none.
int cee::ug::CuttingPlane::mapVectorResultId | ( | ) | const |
Returns the id of the current vector result shown on the cutting plane.
Returns -1 if none.
cee::Vec3d cee::ug::CuttingPlane::normal | ( | ) | const |
Returns the cutting plane's normal.
float cee::ug::CuttingPlane::opacity | ( | ) | const |
Returns the opacity of the cutting plane.
1.0 is opaque and 0.0 is fully transparent (invisible)
void cee::ug::CuttingPlane::partData | ( | int | stateId, |
size_t | globalGeometryIndex, | ||
int | partId, | ||
CuttingPlaneData * | cuttingPlaneData | ||
) |
Gets the cutting plane data for the given state and part.
The cutting plane data contains raw triangle data and result values.
bool cee::ug::CuttingPlane::planeSurfaceVisible | ( | ) | const |
Returns true if cutting plane surface is visible.
cee::Vec3d cee::ug::CuttingPlane::point | ( | ) | const |
Returns point in cutting plane.
bool cee::ug::CuttingPlane::projectVectorsOnPlane | ( | ) | const |
Returns true if the vectors are projected onto the cutting plane.
double cee::ug::CuttingPlane::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::CuttingPlane::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::CuttingPlane::setAlsoComputeFromUndeformedModel | ( | bool | alsoShowForUndeformedModel | ) |
Sets the cutting plane to only cut visible parts.
void cee::ug::CuttingPlane::setClipping | ( | bool | enableClipping | ) |
Enables clipping of the model by the cutting plane.
This will create a clipping plane in the same position as the cutting plane with will clip the model (and any other clipping planes or isosurfaces).
void cee::ug::CuttingPlane::setComputeFromVisibleParts | ( | bool | visiblePartsOnly | ) |
Sets the cutting plane to only cut visible parts.
void cee::ug::CuttingPlane::setCrinkleCutSurface | ( | bool | useCrinkleCutSurface | ) |
Specifies if the cutting plane should show a crinkle cut surface.
If enabled, the cutting plane surface will be the combined surface of all elements intersected by the cutting plane. So the cutting plane will show the tessellation of all intersected elements.
This is useful for inspecting and visualizing the mesh of a volume element model.
void cee::ug::CuttingPlane::setDrawStyle | ( | DrawStyle | drawStyle | ) |
Sets the draw style of the cutting plane.
void cee::ug::CuttingPlane::setGridLinesVisible | ( | bool | visible | ) |
Sets grid line visibility.
void cee::ug::CuttingPlane::setHighlight | ( | bool | showHighlighted | ) |
Specifies if the cutting plane is shown highlighted or not.
void cee::ug::CuttingPlane::setMapContourLinesResultId | ( | int | resultId | ) |
Sets the contour lines result to be mapped on the cutting plane.
Set resultId to -1 to clear the mapped contour lines result.
void cee::ug::CuttingPlane::setMapScalarResultId | ( | int | resultId | ) |
Sets scalar result to map onto the cutting plane surface.
The selected scalar result is shown as fringes. Set resultId to -1 to clear the mapped scalar result.
void cee::ug::CuttingPlane::setMapVectorResultId | ( | int | resultId | ) |
Sets vector result to show on the cutting plane surface.
Vector arrows are shown along computed grid lines. To change the default grid spacing with setVectorGridSpacing() Set resultId to -1 to clear the mapped vector result.
void cee::ug::CuttingPlane::setNormal | ( | Vec3d | normal | ) |
Sets the cutting plane's normal vector.
A cutting plane is defined by a point and a normal vector.
void cee::ug::CuttingPlane::setOpacity | ( | float | opacity | ) |
Sets the opacity of the cutting plane.
1.0 is opaque and 0.0 is fully transparent (invisible)
void cee::ug::CuttingPlane::setPerFrameTransformationMatrices | ( | const std::vector< Mat4d > & | matrices | ) |
Sets per frame transformation matrices for the cutting plane.
This is useful to a have a cutting plane that moves during an animation. E.g. slicing through the model or following an object in your model.
void cee::ug::CuttingPlane::setPlaneSurfaceVisible | ( | bool | show | ) |
Specifies if the cutting plane surface is visible or not.
void cee::ug::CuttingPlane::setPoint | ( | Vec3d | pointInPlane | ) |
Sets a point that the cutting plane passes through.
A cutting plane is defined by a point and a normal vector.
void cee::ug::CuttingPlane::setProjectVectorsOnPlane | ( | bool | project | ) |
Sets if the vectors should be projected onto the cutting plane or not.
void cee::ug::CuttingPlane::setSpecularIntensity | ( | float | intensity | ) |
Sets the specular intensity to use for this cutting plane.
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::CuttingPlane::setSurfaceColor | ( | const Color3f & | color | ) |
Sets the surface color for the cutting plane.
void cee::ug::CuttingPlane::setUseSourcePartColor | ( | bool | useSourcePartColor | ) |
Specifies to use the color of the source part or a fixed color for the cutting plane.
void cee::ug::CuttingPlane::setVectorGridSpacing | ( | SpacingMode | mode, |
double | spacing | ||
) |
Sets the grid spacing used for drawing vectors on cutting planes.
If mode is RELATIVE_SPACING, the value spacing is is interpreted as a fraction of the model extent. If mode is ABSOLUTE_SPACING, the specified spacing will be used regardless of the model extent. The default is a relative spacing of 0.025.
void cee::ug::CuttingPlane::setVisible | ( | bool | visible | ) |
Toggles cutting plane visibility.
float cee::ug::CuttingPlane::specularIntensity | ( | ) | const |
Returns the specular intensity set for this cutting plane.
cee::Color3f cee::ug::CuttingPlane::surfaceColor | ( | ) | const |
Returns the surface color for the cutting plane.
size_t cee::ug::CuttingPlane::transformationMatrixFrameCount | ( | ) | const |
Returns the number of frames there are transformation matrices defined for.
bool cee::ug::CuttingPlane::useSourcePartColor | ( | ) | const |
Returns true if the color of the source part of the cutting plane will be used as the plan color (if no results are shown).
double cee::ug::CuttingPlane::vectorGridSpacing | ( | ) | const |
Returns the grid spacing to use for the vectors on the cutting plane.
CuttingPlane::SpacingMode cee::ug::CuttingPlane::vectorGridSpacingMode | ( | ) | const |
Returns the current spacing mode used when mapping vectors onto the cutting plane.
bool cee::ug::CuttingPlane::visible | ( | ) | const |
Returns true if the cutting plane is visible.