Height |
public class HeightMapVisual3D : BaseModelVisual3D
The HeightMapVisual3D type exposes the following members.
Name | Description | |
---|---|---|
HeightMapVisual3D | Constructor | |
HeightMapVisual3D(String) | Constructor |
Name | Description | |
---|---|---|
CenterPosition | Gets or sets the plane center position | |
GradientColorsCount | Gets or sets the number of individual colors that are created from the gradient. Default value is 256. This value need to be changed before the CreateHeightTextureFromGradient(LinearGradientBrush) method is called. | |
HeightData | Gets or sets a two dimensional array of double that defines the height of each point in height map. | |
IsSolidSurfaceShown | Gets or set a boolean that specifies if the HeightMapVisual3D shows solid surface for the height map. Default value is true. | |
IsWireframeShown | Gets or set a boolean that specifies if the HeightMapVisual3D shows wireframe for the height map. Default value is false. | |
MaxValue | Gets or sets the maximum value of the HeightData. When the value is not manually set, then the maximum value from the HeightData is get. When manually setting the value, this must be done before the geometry or the texture is created. | |
MinValue | Gets or sets the minimum value of the HeightData. When the value is not manually set, then the minimum value from the HeightData is get. When manually setting the value, this must be done before the geometry or the texture is created. | |
Size | Gets or sets the size of the HeightMap. Note that the Size.Y defines the scale that is used to multiply each height data value with. | |
UseHeightValuesAsTextureCoordinates | When UseHeightValuesAsTextureCoordinates is true, then height values are used for texture coordinates - texture coordinate (0, 0.5) is set the minimum height value and texture coordinate (1, 0.5) is set to the maximum height value. This requires a one dimensional gradient texture and usually produces more accurate results than when UseHeightValuesAsTextureCoordinates is false. When false (by default) then texture coordinates are generated as fraction of x and y position - texture coordinate (0, 0) is used for the first position and (1, 1) for the last position. This requires a two dimensional texture where each pixel in the texture represents the color for the point in the height map. Because pixels are actually squares this does not interpolate the colors as good as when UseHeightValuesAsTextureCoordinates is true. In another worlds: when true, then height values are interpolated between height map positions, when false colors from height values are interpolated between height map positions. When using a custom texture (for example a satellite image) then this property must be set to false. | |
WireframeColor | Gets or sets the color of the wireframe lines. | |
WireframeDistance | Gets or sets a double that specifies the distance between wireframe and solid model. Default value is 0.001. | |
WireframeThickness | Gets or sets the thickness of the wireframe lines. |
Name | Description | |
---|---|---|
CreateContourLinePositions | CreateContourLinePositions creates positions for all contour lines (also known as isolines) and returns them in one Point3DCollection. The line positions are scaled by the size of this HeightMapVisual3D. The lines can be offset on top of the solid geometry by setting the yOffset value. To generate positions for individual contour lines call CreateMultiContourLinePositions(Double, Double) method. | |
CreateHeightTextureFromGradient | This methods created a height texture from the height data and specified gradient and set it as the HeightMap Material property. When is true, then one dimensional gradient texture is created; when false then two dimensional texture with color for each data value is created. | |
CreateMultiContourLinePositions | CreateContourLinePositions creates positions for individual contour lines (also known as isolines) and returns them in an array of Point3DCollection (each element in the array represents positions for contour lines each value in contourLineValues). The line positions are scaled by the size of this HeightMapVisual3D. The lines can be offset on top of the solid geometry by setting the yOffset value. To generate all contour positions in one Point3DCollection use CreateContourLinePositions(Double, Double) method. | |
GetHeightTextureColor | Returns a color from the height texture for the specified value. The CreateHeightTextureFromGradient(LinearGradientBrush) method must be called before calling this method to crate the height colors array from the gradient. | |
GetPositionValues | GetPositionValues returns a List of double values (get from HeightData) that represents values for each position that is used for the MeshGeometry3D that shows this height map (position value at index 0 represents the value from HeightData that is used to show first position in MeshGeometry3D). | |
OnWireframeColorPropertyChanged | OnColorPropertyChanged | |
RefreshGeometry |
Recreates the Visual3D geometry
(Overrides BaseModelVisual3DRefreshGeometry) | |
RefreshMaterial |
Resets the Content's material
(Overrides BaseModelVisual3DRefreshMaterial) | |
UpdateContent | UpdateContent updates the height map 3D mesh. The method can be called after the data in the HeightData array are changed. | |
ValidateWireframeThicknessPropertyValue | Returns true if line thickness is valid double and bigger or equal to 0 |
Name | Description | |
---|---|---|
CenterPositionProperty | CenterPositionProperty | |
HeightDataProperty | HeightDataProperty | |
IsSolidSurfaceShownProperty | IsSolidSurfaceShownProperty | |
IsWireframeShownProperty | IsWireframeShownProperty | |
SizeProperty | SizeProperty | |
UseHeightValuesAsTextureCoordinatesProperty | UseHeightValuesAsTextureCoordinatesProperty | |
WireframeColorProperty | WireframeColorProperty | |
WireframeThicknessProperty | WireframeThicknessProperty |
Name | Description | |
---|---|---|
DumpHierarchy |
Display details about the hierarchy of Visual3D children to Debug console (for example to Visual Studio's Immediate window).
(Defined by Extensions) | |
ForEachGeometryModel3D |
Performs the specified action on each GeometryModel3D inside the rootModelVisual3D.
(Defined by Extensions) | |
ForEachVisual3D |
Performs the specified action on each ModelVisual3D inside the rootModelVisual3D.
(Defined by Extensions) | |
GetName |
Gets name of the Visual3D that was previously set by SetName extension method.
(Defined by Extensions) | |
SetName |
Sets Name property to Visual3D. Note that if name is not correct for WPF, it can be corrected (name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores).
In this case the SetName method will set the corrected name to the object and return false (in this case you can call GetName to get the corrected name). True is returned when the original name is set to the object.
(Defined by Extensions) |
HeightMapVisual3D class is used to create Visual3D that represents a 3D height map.
The height map is similar to 3D Plane. The difference is that each position in a height map can have its height defined - the distance from the plane. The position heights are defined with the HeightData property. The height data are defined as two dimensional array of double values. The dimensions of the array also define the number of position used for the height map - one position of one array element.
The position and the size of the height map can be set with CenterPosition and Size properties.
The y value (height) of each 3D position is calculated with the following: yPos = CenterPosition.Y + heightDataValue * Size.Y.
This means that CenterPosition.Y value defines the Y value of the 0 data value. Size.Y value defines the scale factor for all data values.
The color or texture used to display the height map can be set with Material and BackMaterial properties. When BackMaterial property is not set the height map will not be visible from below.
The CreateHeightTextureFromGradient(LinearGradientBrush) method can automatically create a texture for the height data from the specified LinearGradientBrush.
By default the height map is shown as solid surface. It is also possible to show wireframe for the height map. Wireframe is controlled by IsWireframeShown, WireframeThickness and WireframeColor properties. If only wireframe should be shown, than it is possible to set the IsSolidSurfaceShown properties to false.
NOTE:
Showing wireframe for bigger height maps (for example more than 100 x 100) can be very slow.
The reason for that is that WPF 3D does not support hardware accelerated 3D lines.
Therefore showing wireframe should be used only when using smaller array dimensions.