Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PolygonMesh3D.cs
1using System;
6
8{
13 {
24 : base(new ScriptNode[] { X, Y, Z },
25 new ArgumentType[] { ArgumentType.Matrix, ArgumentType.Matrix, ArgumentType.Matrix },
27 {
28 }
29
41 : base(new ScriptNode[] { X, Y, Z, Shader },
42 new ArgumentType[] { ArgumentType.Matrix, ArgumentType.Matrix, ArgumentType.Matrix, ArgumentType.Scalar },
44 {
45 }
46
59 : base(new ScriptNode[] { X, Y, Z, Shader, TwoSided },
60 new ArgumentType[] { ArgumentType.Matrix, ArgumentType.Matrix, ArgumentType.Matrix, ArgumentType.Scalar, ArgumentType.Scalar },
62 {
63 }
64
68 public override string FunctionName => nameof(PolygonMesh3D);
69
73 public override string[] DefaultArgumentNames
74 {
75 get { return new string[] { "x", "y", "z", "shader", "twoSided" }; }
76 }
77
85 {
86 if (!(Arguments[0] is IMatrix X))
87 throw new ScriptRuntimeException("Expected matrix for X argument.", this);
88
89 if (!(Arguments[1] is IMatrix Y))
90 throw new ScriptRuntimeException("Expected matrix for Y argument.", this);
91
92 if (!(Arguments[2] is IMatrix Z))
93 throw new ScriptRuntimeException("Expected matrix for Z argument.", this);
94
95 int Rows = X.Rows;
96 int Columns = X.Columns;
97 if (Y.Rows != Rows || Y.Columns != Columns || Z.Rows != Rows || Z.Columns != Columns)
98 throw new ScriptRuntimeException("Matrix dimension mismatch.", this);
99
100 IElement Shader = Arguments.Length <= 3 ? null : Arguments[3];
101 IElement TwoSided = Arguments.Length <= 4 ? null : Arguments[4];
102
103 return new Graph3D(Variables, X, Y, Z, null, new PolygonMesh3DPainter(), false, false, false, this,
104 Shader?.AssociatedObjectValue ?? Graph.DefaultColor, TwoSided?.AssociatedObjectValue ?? true);
105 }
106 }
107}
Class managing a script expression.
Definition: Expression.cs:39
Plots a three-dimensional surface mesh.
override string[] DefaultArgumentNames
Default Argument names
PolygonMesh3D(ScriptNode X, ScriptNode Y, ScriptNode Z, int Start, int Length, Expression Expression)
Plots a three-dimensional surface mesh.
PolygonMesh3D(ScriptNode X, ScriptNode Y, ScriptNode Z, ScriptNode Shader, int Start, int Length, Expression Expression)
Plots a three-dimensional surface mesh.
PolygonMesh3D(ScriptNode X, ScriptNode Y, ScriptNode Z, ScriptNode Shader, ScriptNode TwoSided, int Start, int Length, Expression Expression)
Plots a three-dimensional surface mesh.
override string FunctionName
Name of the function
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Handles three-dimensional graphs.
Definition: Graph3D.cs:28
Base class for graphs.
Definition: Graph.cs:79
static readonly SKColor DefaultColor
Default color: Red
Definition: Graph.cs:118
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:33
Basic interface for matrices.
Definition: IMatrix.cs:9
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9