Class ModelArrows
A collection of arrows which are visible in 3D.
Examples
// Create some arrow locations.
var vectors = new List<(Vector3 location, Vector3 direction, double magnitude, Color? color)>();
var target = new Vector3(15, 20);
var squareSize = 25.0;
var maxDistance = Math.Sqrt(Math.Pow(squareSize, 2) + Math.Pow(squareSize, 2));
for (var x = 0.0; x < squareSize; x += 1.0)
{
for (var y = 0.0; y < squareSize; y += 1.0)
{
var l = new Vector3(x, y);
var d = (target - l).Unitized();
var distance = target.DistanceTo(l);
var r = distance / maxDistance;
var c = new Color(x / squareSize, y / squareSize, 0.0, 1.0);
vectors.Add((l, d, r, c));
}
}
// Create a model arrows object.
var modelArrows = new ModelArrows(vectors, false, true);
Implements
Inherited Members
Namespace: Elements
Assembly: Hypar.Elements.dll
Syntax
public class ModelArrows : GeometricElement, INotifyPropertyChanged
Constructors
ModelArrows(IList<(Vector3 location, Vector3 direction, Double magnitude, Nullable<Color> color)>, Boolean, Boolean, Double, Transform, Boolean, Guid, String)
Create a collection of points.
Declaration
[JsonConstructor]
public ModelArrows(IList<(Vector3 location, Vector3 direction, double magnitude, Color? color)> vectors = null, bool arrowAtStart = false, bool arrowAtEnd = true, double arrowAngle = 60, Transform transform = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<System.ValueTuple<Vector3, Vector3, System.Double, System.Nullable<Color>>> | vectors | A collection of tuples specifying the origin, direction, and the magnitude of the arrows. |
System.Boolean | arrowAtStart | Should an arrow head be drawn at the start? |
System.Boolean | arrowAtEnd | Should an arrow head be drawn at the end? |
System.Double | arrowAngle | The angle of the arrow head. |
Transform | transform | The model arrows' transform. |
System.Boolean | isElementDefinition | Is this an element definition? |
System.Guid | id | The id of the model arrows. |
System.String | name | The name of the model arrows. |
Properties
ArrowAngle
The angle of the arrow head.
Declaration
public double ArrowAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ArrowAtEnd
Should an arrow head be drawn at the end?
Declaration
public bool ArrowAtEnd { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ArrowAtStart
Should an arrow head be drawn at the start?
Declaration
public bool ArrowAtStart { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Vectors
A collection of tuples specifying the origin, magnitude, and color of the arrows.
Declaration
public IList<(Vector3 origin, Vector3 direction, double magnitude, Color? color)> Vectors { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.ValueTuple<Vector3, Vector3, System.Double, System.Nullable<Color>>> |
Methods
TryToGraphicsBuffers(out List<GraphicsBuffers>, out String, out Nullable<MeshPrimitive.ModeEnum>)
Get graphics buffers and other metadata required to modify a GLB.
Declaration
public override bool TryToGraphicsBuffers(out List<GraphicsBuffers> graphicsBuffers, out string id, out MeshPrimitive.ModeEnum? mode)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<GraphicsBuffers> | graphicsBuffers | |
System.String | id | |
System.Nullable<glTFLoader.Schema.MeshPrimitive.ModeEnum> | mode |
Returns
Type | Description |
---|---|
System.Boolean | True if there is graphicsbuffers data applicable to add, false otherwise. Out variables should be ignored if the return value is false. |