Class AnalysisImage
A visualization of computed values at locations in space. Use this instead of AnalysisMesh to create a lightweight mesh with an image texture, rather than mesh faces for each pixel.
Examples
var origin = new Vector3(0, 0);
var size = 900;
var shape = Polygon.Rectangle(900, 900);
Func<Vector3, double> analyze = (v) =>
{
return Math.Min(v.DistanceTo(origin) / size * 2, 1);
};
var colorScale = new ColorScale(new List<Elements.Geometry.Color>() { Colors.Magenta, Colors.Yellow, Colors.Lime, Colors.Teal });
var analysisImage = new AnalysisImage(shape, 10, 10, colorScale, analyze);
analysisImage.Analyze();
this.Model.AddElement(analysisImage);
Inherited Members
Namespace: Elements.Analysis
Assembly: Hypar.Elements.dll
Syntax
public class AnalysisImage : AnalysisMesh, INotifyPropertyChanged, ITessellate
Constructors
AnalysisImage(Polygon, Double, Double, ColorScale, Func<Vector3, Double>, Guid, String)
An AnalysisImage is similar to an AnalysisMesh in that it renders a mesh with analysis colors. However, it uses a mapped image texture rather than mesh vertex colors to lighten the resulting geometry.
Declaration
public AnalysisImage(Polygon perimeter, double uLength, double vLength, ColorScale colorScale, Func<Vector3, double> analyze, Guid id = default(Guid), string name = null)
Parameters
Type | Name | Description |
---|---|---|
Polygon | perimeter | The perimeter of the mesh image. |
System.Double | uLength | The number of divisions in the u direction. |
System.Double | vLength | The number of divisions in the v direction. |
ColorScale | colorScale | The color scale to be used in the visualization. |
System.Func<Vector3, System.Double> | analyze | A function which takes a location and computes a value. |
System.Guid | id | The id of the analysis image. |
System.String | name | The name of the analysis image. |
Properties
InterpolateTexture
Should the texture be interpolated? False by default.
Declaration
public bool InterpolateTexture { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If false, renders hard pixels in the texture rather than fading between adjacent pixels. |
Methods
Analyze()
Compute a value for each grid cell, and create the required material.
Declaration
public override void Analyze()
Overrides
Tessellate(ref Mesh, Transform, Color)
Gives an element with a mapped texture.
Declaration
public override void Tessellate(ref Mesh mesh, Transform transform = null, Color color = default(Color))
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | |
Transform | transform | |
Color | color |