/
H1.cs
78 lines (63 loc) · 1.77 KB
/
H1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright Lamont Granquist, Sebastien Gaggini and the MechJeb contributors
* SPDX-License-Identifier: LicenseRef-PD-hp OR Unlicense OR CC0-1.0 OR 0BSD OR MIT-0 OR MIT OR LGPL-2.1+
*/
#nullable enable
using MechJebLib.Core.Functions;
using MechJebLib.Utils;
namespace MechJebLib.Primitives
{
public class H1 : HBase<double>
{
private static readonly ObjectPool<H1> _pool = new ObjectPool<H1>(New, Clear);
private H1()
{
}
private static H1 New()
{
return new H1();
}
public static H1 Get()
{
H1 h = _pool.Borrow();
return h;
}
public override void Dispose()
{
base.Dispose();
_pool.Release(this);
}
protected override double Allocate()
{
return 0.0;
}
protected override double Allocate(double value)
{
return value;
}
protected override void Subtract(double a, double b, ref double result)
{
result = a - b;
}
protected override void Divide(double a, double b, ref double result)
{
result = a / b;
}
protected override void Multiply(double a, double b, ref double result)
{
result = a * b;
}
protected override void Addition(double a, double b, ref double result)
{
result = a + b;
}
protected override double Interpolant(double x1, double y1, double yp1, double x2, double y2, double yp2, double x)
{
return Interpolants.CubicHermiteInterpolant(x1, y1, yp1, x2, y2, yp2, x);
}
private static void Clear(H1 h)
{
h.Clear();
}
}
}