-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConstants.cs
148 lines (146 loc) · 3.03 KB
/
Constants.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using System;
using System.Collections.Generic;
namespace ObjLoader
{
public class Polygon
{
public List<int> indexes;
public Polygon()
{
indexes = new List<int>();
}
public void AddIndex(int v)
{
indexes.Add(v);
}
}
public struct Color
{
public Color(byte R, byte G, byte B)
{
this.R = R;
this.G = G;
this.B = B;
}
public override string ToString()
{
return R + "," + G + "," + B;
}
public byte R;
public byte G;
public byte B;
}
public struct Point3D
{
public Point3D(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
public void Sum(double val)
{
x += val;
y += val;
z += val;
}
public void Sum(Point3D p)
{
x += p.x;
y += p.y;
z += p.z;
}
public void Mult(double val)
{
x *= val;
y *= val;
z *= val;
}
public double x;
public double y;
public double z;
}
public struct Point
{
public Point(double x, double y)
{
this.x = x;
this.y = y;
}
public double x;
public double y;
}
public class Triple<T>
{
public T first, second, third;
public Triple(T first, T second, T third)
{
this.first = first;
this.second = second;
this.third = third;
}
}
public class Pair<T, V>
{
public T first;
public V second;
public Pair(T first, V second)
{
this.first = first;
this.second = second;
}
}
public enum Rotation
{
NONE = 0,
ROTATION_90 = 1,
ROTATION_180 = 2,
ROTATION_270 = 3
}
public enum OperatorType
{
ROTATION_2D,
ROTATION_3D_X,
ROTATION_3D_Y,
ROTATION_3D_Z,
GAUSS_2D,
GAUSS_1D_X,
GAUSS_1D_Y,
SOBEL_X,
SOBEL_Y,
SHAR_X,
SHAR_Y
}
public enum ColorType
{
RED,
GREEN,
BLUE,
GRAY
}
public enum PaddingFill
{
BY_ZEROES,
BY_MEDIAN
}
public enum LogType
{
INFO,
WARNING,
ERROR
}
static class Constants
{
public static double eps = 1e-10;
public static Color defaultColor = new Color(128, 128, 128);
public static double modelMaxWidth = 100;
public static double Gauss(int x, int y, double k)
{
return 1.0 / (2 * Math.PI * k*k) * Math.Exp(-(x*x + y*y) / (2*k*k));
}
public static double Gauss1D(int i, double k)
{
return 1.0 / (Math.Sqrt(2 * Math.PI) * k) * Math.Exp(-(i*i) / (2 * k * k));
}
}
}