Class AnalysisMesh
A visualization of computed values at locations in space. A maximum of 65,535 analytical values is allowed. For an unlimited number of analytical values, use AnalysisImage.
Examples
var perimeter1 = Polygon.L(10, 10, 3);
var perimeter2 = Polygon.Ngon(5, 5);
var move = new Transform(3, 7, 0);
var perimeter = perimeter1.Union((Polygon)perimeter2.Transformed(move));
var mc = new ModelCurve(perimeter);
this.Model.AddElement(mc);
// Construct a mass from which we will measure
// distance to the analysis mesh's cells.
var center = perimeter.Centroid();
var mass = new Mass(Polygon.Rectangle(1, 1));
mass.Transform.Move(center);
this.Model.AddElement(mass);
// The analyze function computes the distance
// to the attractor.
var analyze = new Func<Vector3, double>((v) =>
{
return center.DistanceTo(v);
});
// Construct a color scale from a small number
// of colors.
var colorScale = new ColorScale(new List<Color>() { Colors.Cyan, Colors.Purple, Colors.Orange }, 10);
var analysisMesh = new AnalysisMesh(perimeter, 0.2, 0.2, colorScale, analyze);
analysisMesh.Analyze();
Inherited Members
Namespace: Elements.Analysis
Assembly: Hypar.Elements.dll
Syntax
public class AnalysisMesh : GeometricElement, INotifyPropertyChanged, ITessellate
Constructors
AnalysisMesh(Polygon, Double, Double, ColorScale, Func<Vector3, Double>, Guid, String)
Construct an analysis mesh.
Declaration
public AnalysisMesh(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. |
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 mesh. |
System.String | name | The name of the analysis mesh. |
Fields
_analyze
A function that returns a numerical analysis result, given a point in space.
Declaration
protected Func<Vector3, double> _analyze
Field Value
Type | Description |
---|---|
System.Func<Vector3, System.Double> |
_max
A computed maximum result value.
Declaration
protected double _max
Field Value
Type | Description |
---|---|
System.Double |
_min
A computed minimum result value.
Declaration
protected double _min
Field Value
Type | Description |
---|---|
System.Double |
_results
A list of all the created cells and their resultant value via the _analyze function.
Declaration
protected List<(BBox3 cell, double value)> _results
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.ValueTuple<BBox3, System.Double>> |
Properties
ColorScale
The color scale used to represent this analysis mesh.
Declaration
public ColorScale ColorScale { get; set; }
Property Value
Type | Description |
---|---|
ColorScale |
Perimeter
The perimeter of the analysis mesh.
Declaration
public Polygon Perimeter { get; set; }
Property Value
Type | Description |
---|---|
Polygon |
TotalAnalysisLocations
The total number of analysis locations.
Declaration
[JsonIgnore]
public double TotalAnalysisLocations { get; }
Property Value
Type | Description |
---|---|
System.Double |
ULength
The length of the cells in the u direction.
Declaration
public double ULength { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
VLength
The length of the cells in the v direction.
Declaration
public double VLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
Analyze()
Compute a value for each grid cell.
Declaration
public virtual void Analyze()
Tessellate(ref Mesh, Transform, Color)
Tessellate the analysis mesh.
Declaration
public virtual void Tessellate(ref Mesh mesh, Transform transform = null, Color color = default(Color))
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | |
Transform | transform | |
Color | color |