Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HSV.cs
1using System;
2using System.Collections.Generic;
3using SkiaSharp;
8
10{
15 {
27 {
28 }
29
33 public override string[] DefaultArgumentNames
34 {
35 get
36 {
37 return new string[] { "H", "S", "V" };
38 }
39 }
40
44 public override string FunctionName
45 {
46 get
47 {
48 return "HSV";
49 }
50 }
51
59 {
60 double H = Expression.ToDouble(Arguments[0].AssociatedObjectValue);
61 double S = Expression.ToDouble(Arguments[1].AssociatedObjectValue);
62 double V = Expression.ToDouble(Arguments[2].AssociatedObjectValue);
63
64 H = Math.IEEERemainder(H, 360);
65 if (H < 0)
66 H += 360;
67
68 if (S < 0)
69 S = 0;
70 else if (S > 1)
71 S = 1;
72
73 if (V < 0)
74 V = 0;
75 else if (V > 1)
76 V = 1;
77
78 return new ObjectValue(Graph.ToColorHSV(H, S, V));
79 }
80 }
81}
Class managing a script expression.
Definition: Expression.cs:39
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
Returns a color value using HSV coordinates.
Definition: HSV.cs:15
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: HSV.cs:58
HSV(ScriptNode H, ScriptNode S, ScriptNode V, int Start, int Length, Expression Expression)
Returns a color value using HSV coordinates.
Definition: HSV.cs:25
override string FunctionName
Name of the function
Definition: HSV.cs:45
override string[] DefaultArgumentNames
Default Argument names
Definition: HSV.cs:34
Base class for graphs.
Definition: Graph.cs:79
static SKColor ToColorHSV(double H, double S, double V)
Creates a Color from its HSV representation.
Definition: Graph.cs:877
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes3Scalar
Three scalar parameters.
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