@ejfdelgado/ejflab-common 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +2 -0
- package/package.json +29 -0
- package/src/CollisionsEngine.js +252 -0
- package/src/CsvFormatter.js +54 -0
- package/src/CsvFormatter.test.js +119 -0
- package/src/CsvFormatterFilters.js +79 -0
- package/src/CsvParser.js +51 -0
- package/src/CsvParser.test.js +41 -0
- package/src/CsvWithFilters.js +114 -0
- package/src/FaceEncoder.js +64 -0
- package/src/FlowChartDiagram.js +503 -0
- package/src/IdGen.js +211 -0
- package/src/ModuloDatoSeguro.js +142 -0
- package/src/ModuloDatoSeguro.test.js +29 -0
- package/src/ModuloDatoSeguro.test.mjs +45 -0
- package/src/ModuloDatoSeguroBack.mjs +55 -0
- package/src/ModuloDatoSeguroFront.js +73 -0
- package/src/ModuloSonido.js +83 -0
- package/src/ModuloVideos.js +51 -0
- package/src/MyColor.js +136 -0
- package/src/MyColor.test.js +37 -0
- package/src/MyConstants.js +147 -0
- package/src/MyCookies.js +34 -0
- package/src/MyDates.js +412 -0
- package/src/MyDates.test.js +26 -0
- package/src/MyDatesBack.mjs +21 -0
- package/src/MyDatesFront.js +41 -0
- package/src/MyJsPdf.js +52 -0
- package/src/MyRoutes.js +29 -0
- package/src/MyTemplate.js +272 -0
- package/src/MyTemplate.test.js +90 -0
- package/src/MyTensorflow.js +248 -0
- package/src/MyTensorflow.test.js +19 -0
- package/src/MyTensorflowBack.mjs +33 -0
- package/src/MyThrottle.js +80 -0
- package/src/MyTuples.js +445 -0
- package/src/MyTuples.test.js +330 -0
- package/src/MyUtilities.js +137 -0
- package/src/SimpleObj.js +153 -0
- package/src/SimpleObj.test.js +58 -0
- package/src/TriangulacionGeometric.js +335 -0
- package/src/changePath.js +38 -0
- package/src/data/case0.csv +3 -0
- package/src/data/case0.json +24 -0
- package/src/data/case1.csv +2 -0
- package/src/data/case1.json +24 -0
- package/src/data/case2.csv +3 -0
- package/src/data/case2.json +24 -0
- package/src/data/case3.csv +3 -0
- package/src/data/case3.json +24 -0
- package/src/data/format0.json +0 -0
- package/src/data/format0.txt +1 -0
- package/src/data/tensordata.csv +10 -0
- package/src/data/tensordata.json +37 -0
- package/src/data/tensordata.test.csv +10 -0
- package/src/data/tensormodel.json +113 -0
- package/src/fft.js +224 -0
- package/src/flowchart/FlowChartExec.js +763 -0
- package/src/flowchart/steps/CommandBasic.js +32 -0
- package/src/flowchart/steps/CommandInc.js +19 -0
- package/src/flowchart/steps/CommandMilvus.js +47 -0
- package/src/flowchart/steps/CommandMinio.js +28 -0
- package/src/flowchart/steps/CommandMongo.js +59 -0
- package/src/flowchart/steps/CommandPrint.js +12 -0
- package/src/flowchart/steps/CommandSet.js +14 -0
- package/src/flowchart/steps/CommandTimeline.js +21 -0
- package/src/flowchart/steps/CommandTimelineNext.js +28 -0
- package/src/flowchart/steps/StepBasic.js +184 -0
- package/src/flowchart/steps/StepCheckProcessor.js +26 -0
- package/src/flowchart/steps/StepCheckSrc.js +42 -0
- package/src/flowchart/steps/StepIsTrue.js +12 -0
- package/src/flowchart/steps/StepOneTime.js +21 -0
- package/src/flowchart/steps/StepProcess.js +163 -0
- package/src/flowchart/steps/StepReadSrc.js +66 -0
- package/src/flowchart/steps/StepSleep.js +22 -0
- package/src/flowchart/steps/StepTimeLineEnds.js +21 -0
- package/src/flowchart/steps/StepTimeLineHasMore.js +16 -0
- package/src/gif/index.d.ts +20 -0
- package/src/gif/index.mjs +85 -0
- package/src/gif/utils/checkTypes.d.ts +2 -0
- package/src/gif/utils/checkTypes.mjs +11 -0
- package/src/js-colormaps.js +19484 -0
- package/src/sortify.js +75 -0
- package/src/sqlmodelparser/SqlModelParser.js +22 -0
- package/src/test/csv/test_1000_20230429204538700.csv +1001 -0
- package/src/test/csv/test_5_20230429204525930.csv +6 -0
- package/src/test/svg/test.html +5 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
// clear && node TriangulacionGeometric.js
|
|
4
|
+
|
|
5
|
+
class TriangulacionGeometric {
|
|
6
|
+
static TO_RADIANS = Math.PI / 180;
|
|
7
|
+
static TO_DEGRES = 180 / Math.PI;
|
|
8
|
+
static ANGLE_STEP = 10;
|
|
9
|
+
static computeAngle(x, y) {
|
|
10
|
+
let valor = Math.atan2(y, x) * TriangulacionGeometric.TO_DEGRES;
|
|
11
|
+
if (valor < 0) {
|
|
12
|
+
valor += 360;
|
|
13
|
+
}
|
|
14
|
+
return valor;
|
|
15
|
+
}
|
|
16
|
+
static generateUnaryVector(angle) {
|
|
17
|
+
return {
|
|
18
|
+
x: Math.cos(angle * TriangulacionGeometric.TO_RADIANS),
|
|
19
|
+
y: Math.sin(angle * TriangulacionGeometric.TO_RADIANS),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
static computePolygonCoordinates(config, center, globales) {
|
|
23
|
+
//200, 10, 250, 190, 150, 190
|
|
24
|
+
const coordinates = [];
|
|
25
|
+
|
|
26
|
+
// All angles in degrees
|
|
27
|
+
// 1. compute angle of current look at
|
|
28
|
+
const lookAt = config.lookAt;
|
|
29
|
+
const angleLookAt = TriangulacionGeometric.computeAngle(lookAt.x, lookAt.y);
|
|
30
|
+
//console.log(`angleLookAt = ${angleLookAt}`);
|
|
31
|
+
// 2. compute min/max angle
|
|
32
|
+
const angleMin = angleLookAt + config.angles.min;
|
|
33
|
+
const angleMax = angleLookAt - config.angles.max;
|
|
34
|
+
//console.log(`angleMin = ${angleMin}`);
|
|
35
|
+
//console.log(`angleMax = ${angleMax}`);
|
|
36
|
+
// Generate vectors from angles
|
|
37
|
+
const vectorMin = TriangulacionGeometric.generateUnaryVector(angleMin);
|
|
38
|
+
const vectorMax = TriangulacionGeometric.generateUnaryVector(angleMax);
|
|
39
|
+
|
|
40
|
+
const centerLocal = {
|
|
41
|
+
x: (config.position.x - center.x) * globales.canvas.scale + globales.canvas.xCenter,
|
|
42
|
+
y: -1 * (config.position.y - center.y) * globales.canvas.scale + globales.canvas.yCenter
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Agrego de min angle, la distancia más corta
|
|
46
|
+
coordinates.push(centerLocal.x + vectorMin.x * config.distance.min * globales.canvas.scale);
|
|
47
|
+
coordinates.push(centerLocal.y + -1 * vectorMin.y * config.distance.min * globales.canvas.scale);
|
|
48
|
+
// Agrego de min angle, la distancia más larga
|
|
49
|
+
coordinates.push(centerLocal.x + vectorMin.x * config.distance.max * globales.canvas.scale);
|
|
50
|
+
coordinates.push(centerLocal.y + -1 * vectorMin.y * config.distance.max * globales.canvas.scale);
|
|
51
|
+
|
|
52
|
+
// Se crean los arcos
|
|
53
|
+
const arcoPequenio = [];
|
|
54
|
+
let currentAngle = angleMin;
|
|
55
|
+
let stepAngle = TriangulacionGeometric.ANGLE_STEP;
|
|
56
|
+
if (angleMax < angleMin) {
|
|
57
|
+
stepAngle *= -1;
|
|
58
|
+
}
|
|
59
|
+
const iterations = Math.floor(Math.abs((angleMax - angleMin) / stepAngle));
|
|
60
|
+
//console.log(`stepAngle = ${stepAngle} iterations = ${iterations}`);
|
|
61
|
+
|
|
62
|
+
for (let i = 0; i < iterations; i++) {
|
|
63
|
+
const vectorStep = TriangulacionGeometric.generateUnaryVector(currentAngle + i * stepAngle);
|
|
64
|
+
// Agrego de min angle, la distancia más larga
|
|
65
|
+
coordinates.push(centerLocal.x + vectorStep.x * config.distance.max * globales.canvas.scale);
|
|
66
|
+
coordinates.push(centerLocal.y + -1 * vectorStep.y * config.distance.max * globales.canvas.scale);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Agrego de max angle, la distancia más larga
|
|
70
|
+
coordinates.push(centerLocal.x + vectorMax.x * config.distance.max * globales.canvas.scale);
|
|
71
|
+
coordinates.push(centerLocal.y + -1 * vectorMax.y * config.distance.max * globales.canvas.scale);
|
|
72
|
+
// Agrego de max angle, la distancia más corta
|
|
73
|
+
coordinates.push(centerLocal.x + vectorMax.x * config.distance.min * globales.canvas.scale);
|
|
74
|
+
coordinates.push(centerLocal.y + -1 * vectorMax.y * config.distance.min * globales.canvas.scale);
|
|
75
|
+
|
|
76
|
+
if (config.distance.min > 0) {
|
|
77
|
+
currentAngle = angleMax;
|
|
78
|
+
for (let i = 0; i < iterations; i++) {
|
|
79
|
+
const vectorStep = TriangulacionGeometric.generateUnaryVector(currentAngle - i * stepAngle);
|
|
80
|
+
// Agrego de min angle, la distancia más larga
|
|
81
|
+
coordinates.push(centerLocal.x + vectorStep.x * config.distance.min * globales.canvas.scale);
|
|
82
|
+
coordinates.push(centerLocal.y + -1 * vectorStep.y * config.distance.min * globales.canvas.scale);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { centerLocal, coordinates };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static checkPointInside(config, prove) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static createPolygon(config, center, globales, style) {
|
|
94
|
+
//console.log(JSON.stringify(config, null, 4));
|
|
95
|
+
const { centerLocal, coordinates } = TriangulacionGeometric.computePolygonCoordinates(config, center, globales);
|
|
96
|
+
let textPoints = "";
|
|
97
|
+
if (coordinates.length > 0) {
|
|
98
|
+
textPoints = "" + coordinates[0];
|
|
99
|
+
for (let i = 1; i < coordinates.length; i++) {
|
|
100
|
+
const actual = coordinates[i];
|
|
101
|
+
if (i % 2 == 0) {
|
|
102
|
+
textPoints += ",";
|
|
103
|
+
} else {
|
|
104
|
+
textPoints += " ";
|
|
105
|
+
}
|
|
106
|
+
textPoints += actual;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const polygonText = `<polygon points="${textPoints}" style="opacity:${style.opacity};fill:${style.fill};stroke:${style.fill};stroke-width:1" />`;
|
|
110
|
+
return { centerLocal, coordinates, polygonText };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static writePolygonsToFile(text, globales) {
|
|
114
|
+
const svgText = `<!doctype html><html><body>\n<svg style="background-color:#F8F8F8" height="${globales.canvas.yCenter * 2}" width="${globales.canvas.xCenter * 2}" xmlns="http://www.w3.org/2000/svg">\n\t${text}\n</svg>\n</body></html>`;
|
|
115
|
+
fs.writeFileSync(`./test/svg/test.html`, svgText, { encoding: "utf8" });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static crearBusqueda(person, origin, globales) {
|
|
119
|
+
const configLocal = {
|
|
120
|
+
green: {
|
|
121
|
+
angles: parseInt(globales.canvas.green.fov / 2),
|
|
122
|
+
min: globales.canvas.green.min,
|
|
123
|
+
max: globales.canvas.green.max,
|
|
124
|
+
style: {
|
|
125
|
+
fill: "#00FF00",
|
|
126
|
+
opacity: 0.5,
|
|
127
|
+
stroke: "black"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
yellow: {
|
|
131
|
+
angles: parseInt(globales.canvas.yellow.fov / 2),
|
|
132
|
+
min: globales.canvas.yellow.min,
|
|
133
|
+
max: globales.canvas.yellow.max,
|
|
134
|
+
style: {
|
|
135
|
+
fill: "#99FF99",
|
|
136
|
+
opacity: 0.35,
|
|
137
|
+
stroke: "black"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const angleOffset = 90;
|
|
142
|
+
let center;
|
|
143
|
+
// --------------
|
|
144
|
+
let viewGreen1;
|
|
145
|
+
{
|
|
146
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
147
|
+
position: { x: person.position.x, y: person.position.y },
|
|
148
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
149
|
+
angles: {
|
|
150
|
+
min: configLocal.green.angles - angleOffset,
|
|
151
|
+
max: configLocal.green.angles + angleOffset
|
|
152
|
+
},
|
|
153
|
+
distance: { min: configLocal.green.min, max: configLocal.green.max }
|
|
154
|
+
}, origin, globales, configLocal.green.style);
|
|
155
|
+
viewGreen1 = polygonText;
|
|
156
|
+
center = centerLocal;
|
|
157
|
+
}
|
|
158
|
+
let viewYellow1;
|
|
159
|
+
{
|
|
160
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
161
|
+
position: { x: person.position.x, y: person.position.y },
|
|
162
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
163
|
+
angles: {
|
|
164
|
+
min: configLocal.yellow.angles - angleOffset,
|
|
165
|
+
max: configLocal.yellow.angles + angleOffset
|
|
166
|
+
},
|
|
167
|
+
distance: { min: configLocal.yellow.min, max: configLocal.yellow.max }
|
|
168
|
+
}, origin, globales, configLocal.yellow.style);
|
|
169
|
+
viewYellow1 = polygonText;
|
|
170
|
+
}
|
|
171
|
+
let viewGreen2;
|
|
172
|
+
{
|
|
173
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
174
|
+
position: { x: person.position.x, y: person.position.y },
|
|
175
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
176
|
+
angles: {
|
|
177
|
+
min: configLocal.green.angles + angleOffset,
|
|
178
|
+
max: configLocal.green.angles - angleOffset
|
|
179
|
+
},
|
|
180
|
+
distance: { min: configLocal.green.min, max: configLocal.green.max }
|
|
181
|
+
}, origin, globales, configLocal.green.style);
|
|
182
|
+
viewGreen2 = polygonText;
|
|
183
|
+
center = centerLocal;
|
|
184
|
+
}
|
|
185
|
+
let viewYellow2;
|
|
186
|
+
{
|
|
187
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
188
|
+
position: { x: person.position.x, y: person.position.y },
|
|
189
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
190
|
+
angles: {
|
|
191
|
+
min: configLocal.yellow.angles + angleOffset,
|
|
192
|
+
max: configLocal.yellow.angles - angleOffset
|
|
193
|
+
},
|
|
194
|
+
distance: { min: configLocal.yellow.min, max: configLocal.yellow.max }
|
|
195
|
+
}, origin, globales, configLocal.yellow.style);
|
|
196
|
+
viewYellow2 = polygonText;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const circlePoint = `<circle cx="${center.x}" cy="${center.y}" r="5" stroke="#00FF00" stroke-width="5" fill="none" />`;
|
|
200
|
+
|
|
201
|
+
return viewGreen1 + viewYellow1 + viewGreen2 + viewYellow2 + circlePoint;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static crearSeguridad(person, origin, globales) {
|
|
205
|
+
const configLocal = {
|
|
206
|
+
green: {
|
|
207
|
+
angles: parseInt(globales.canvas.green.fov / 2),
|
|
208
|
+
min: globales.canvas.green.min,
|
|
209
|
+
max: globales.canvas.green.max,
|
|
210
|
+
style: {
|
|
211
|
+
fill: "#0000FF",
|
|
212
|
+
opacity: 0.5,
|
|
213
|
+
stroke: "black"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
yellow: {
|
|
217
|
+
angles: parseInt(globales.canvas.yellow.fov / 2),
|
|
218
|
+
min: globales.canvas.yellow.min,
|
|
219
|
+
max: globales.canvas.yellow.max,
|
|
220
|
+
style: {
|
|
221
|
+
fill: "#9999FF",
|
|
222
|
+
opacity: 0.35,
|
|
223
|
+
stroke: "black"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
let center;
|
|
228
|
+
let viewGreen;
|
|
229
|
+
{
|
|
230
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
231
|
+
position: { x: person.position.x, y: person.position.y },
|
|
232
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
233
|
+
angles: { min: configLocal.green.angles, max: configLocal.green.angles },
|
|
234
|
+
distance: { min: configLocal.green.min, max: configLocal.green.max }
|
|
235
|
+
}, origin, globales, configLocal.green.style);
|
|
236
|
+
viewGreen = polygonText;
|
|
237
|
+
center = centerLocal;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
let viewYellow;
|
|
241
|
+
|
|
242
|
+
{
|
|
243
|
+
let { centerLocal, coordinates, polygonText } = TriangulacionGeometric.createPolygon({
|
|
244
|
+
position: { x: person.position.x, y: person.position.y },
|
|
245
|
+
lookAt: { x: person.lookAt.x, y: person.lookAt.y },
|
|
246
|
+
angles: { min: configLocal.yellow.angles, max: configLocal.yellow.angles },
|
|
247
|
+
distance: { min: configLocal.yellow.min, max: configLocal.yellow.max }
|
|
248
|
+
}, origin, globales, configLocal.yellow.style);
|
|
249
|
+
viewYellow = polygonText;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const circlePoint = `<circle cx="${center.x}" cy="${center.y}" r="5" stroke="blue" stroke-width="5" fill="none" />`;
|
|
253
|
+
|
|
254
|
+
return viewGreen + viewYellow + circlePoint;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
static testComputePolygon() {
|
|
258
|
+
const globales = {
|
|
259
|
+
canvas: {
|
|
260
|
+
xCenter: 400,
|
|
261
|
+
yCenter: 400,
|
|
262
|
+
maxDistance: 800,
|
|
263
|
+
yellow: {
|
|
264
|
+
fov: 120,
|
|
265
|
+
max: 350,
|
|
266
|
+
min: 0,
|
|
267
|
+
},
|
|
268
|
+
green: {
|
|
269
|
+
fov: 60,
|
|
270
|
+
max: 300,
|
|
271
|
+
min: 50,
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
busqueda: {
|
|
275
|
+
position: { x: 0, y: 0 }, lookAt: { x: 0, y: 1 }
|
|
276
|
+
},
|
|
277
|
+
seguridad: {
|
|
278
|
+
position: { x: 0, y: 0 }, lookAt: { x: 0, y: 1 }
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
globales.canvas.scale = globales.canvas.xCenter / globales.canvas.maxDistance;
|
|
282
|
+
|
|
283
|
+
let completeText = "";
|
|
284
|
+
const seguridadPolygons = TriangulacionGeometric.crearSeguridad(globales.seguridad, globales.busqueda.position, globales);
|
|
285
|
+
const busquedaPolygons = TriangulacionGeometric.crearBusqueda(globales.busqueda, globales.busqueda.position, globales);
|
|
286
|
+
completeText += seguridadPolygons + busquedaPolygons;
|
|
287
|
+
/*
|
|
288
|
+
const tests = [
|
|
289
|
+
{
|
|
290
|
+
prove: { x: 40, y: 33 },
|
|
291
|
+
style: {
|
|
292
|
+
fill: "green",
|
|
293
|
+
opacity: 0.5,
|
|
294
|
+
stroke: "black"
|
|
295
|
+
},
|
|
296
|
+
config: {
|
|
297
|
+
position: { x: 0, y: 30 }, lookAt: { x: 0, y: 1 },
|
|
298
|
+
angles: { min: 45, max: 45 }, distance: { min: 125, max: 250 }
|
|
299
|
+
},
|
|
300
|
+
expectedIsInside: true,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
prove: { x: 40, y: 33 },
|
|
304
|
+
style: {
|
|
305
|
+
fill: "blue",
|
|
306
|
+
opacity: 0.2,
|
|
307
|
+
stroke: "black"
|
|
308
|
+
},
|
|
309
|
+
config: {
|
|
310
|
+
position: { x: 250, y: 30 }, lookAt: { x: -1, y: 0 },
|
|
311
|
+
angles: { min: 45, max: 45 }, distance: { min: 125, max: 250 }
|
|
312
|
+
},
|
|
313
|
+
expectedIsInside: true,
|
|
314
|
+
}
|
|
315
|
+
];
|
|
316
|
+
|
|
317
|
+
const origin = tests[0].config.position;
|
|
318
|
+
for (let i = 0; i < tests.length; i++) {
|
|
319
|
+
const test = tests[i];
|
|
320
|
+
const svgPolygon = TriangulacionGeometric.createPolygon(test.config, origin, globales, test.style);
|
|
321
|
+
|
|
322
|
+
const currentIsInside = TriangulacionGeometric.checkPointInside(test.config, test.prove);
|
|
323
|
+
if (currentIsInside != test.expectedIsInside) {
|
|
324
|
+
throw new Error(`Test ${i + 1} failed`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
TriangulacionGeometric.writePolygonsToFile(completeText, globales);
|
|
330
|
+
|
|
331
|
+
console.log("Celebrate party!");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
TriangulacionGeometric.testComputePolygon();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* export NODE_SERVER_PATH=/app1/
|
|
5
|
+
* node ./srcJs/changePath.js
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const NODE_SERVER_PATH = process.env.NODE_SERVER_PATH;
|
|
9
|
+
|
|
10
|
+
if (!NODE_SERVER_PATH) {
|
|
11
|
+
console.log("Error: NODE_SERVER_PATH env variable is not set!");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const DIST_DIR = "./dist/bundle";
|
|
15
|
+
const FILE_PATHS = ["./srcJs/MyConstants.js"];
|
|
16
|
+
|
|
17
|
+
// Search bundle reference
|
|
18
|
+
const fileList = fs.readdirSync(DIST_DIR).filter((fileName) => {
|
|
19
|
+
return /^main\./.exec(fileName) != null;
|
|
20
|
+
});
|
|
21
|
+
if (fileList.length > 0) {
|
|
22
|
+
FILE_PATHS.push(`${DIST_DIR}/${fileList[0]}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function changeSimpleFile(filePath) {
|
|
26
|
+
console.log(`Modifiying ${filePath}...`);
|
|
27
|
+
// Read content
|
|
28
|
+
let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
29
|
+
// Change content
|
|
30
|
+
myConstantsContent = myConstantsContent.replaceAll(/(static\s*SRV_ROOT\s*=\s*)[^;]+;/ig, `$1"${NODE_SERVER_PATH}";`);
|
|
31
|
+
// Write content
|
|
32
|
+
fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
|
|
33
|
+
//console.log(myConstantsContent);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (let i = 0; i < FILE_PATHS.length; i++) {
|
|
37
|
+
changeSimpleFile(FILE_PATHS[i]);
|
|
38
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Esto es una prueba ${name|fasdfa:asdfasdf}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"in": [
|
|
3
|
+
{
|
|
4
|
+
"column": "pink",
|
|
5
|
+
"min": 0,
|
|
6
|
+
"max": 1
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"column": "small",
|
|
10
|
+
"min": 0,
|
|
11
|
+
"max": 1
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"out": {
|
|
15
|
+
"column": "quality",
|
|
16
|
+
"min": 0,
|
|
17
|
+
"max": 1,
|
|
18
|
+
"ngroups": 2
|
|
19
|
+
},
|
|
20
|
+
"layers": [
|
|
21
|
+
{
|
|
22
|
+
"units": 3,
|
|
23
|
+
"activation": "relu"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"compile": {
|
|
27
|
+
"loss": "binaryCrossentropy",
|
|
28
|
+
"metrics": [
|
|
29
|
+
"accuracy"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"fit": {
|
|
33
|
+
"shuffle": true,
|
|
34
|
+
"epochs": 20,
|
|
35
|
+
"validationSplit": 0.1
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modelTopology": {
|
|
3
|
+
"class_name": "Sequential",
|
|
4
|
+
"config": {
|
|
5
|
+
"name": "sequential_1",
|
|
6
|
+
"layers": [
|
|
7
|
+
{
|
|
8
|
+
"class_name": "Dense",
|
|
9
|
+
"config": {
|
|
10
|
+
"units": 3,
|
|
11
|
+
"activation": "relu",
|
|
12
|
+
"use_bias": true,
|
|
13
|
+
"kernel_initializer": {
|
|
14
|
+
"class_name": "VarianceScaling",
|
|
15
|
+
"config": {
|
|
16
|
+
"scale": 1,
|
|
17
|
+
"mode": "fan_avg",
|
|
18
|
+
"distribution": "normal",
|
|
19
|
+
"seed": null
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"bias_initializer": {
|
|
23
|
+
"class_name": "Zeros",
|
|
24
|
+
"config": {}
|
|
25
|
+
},
|
|
26
|
+
"kernel_regularizer": null,
|
|
27
|
+
"bias_regularizer": null,
|
|
28
|
+
"activity_regularizer": null,
|
|
29
|
+
"kernel_constraint": null,
|
|
30
|
+
"bias_constraint": null,
|
|
31
|
+
"name": "hidden-layer-1",
|
|
32
|
+
"trainable": true,
|
|
33
|
+
"batch_input_shape": [
|
|
34
|
+
null,
|
|
35
|
+
2
|
|
36
|
+
],
|
|
37
|
+
"dtype": "float32"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"class_name": "Dense",
|
|
42
|
+
"config": {
|
|
43
|
+
"units": 2,
|
|
44
|
+
"activation": "softmax",
|
|
45
|
+
"use_bias": true,
|
|
46
|
+
"kernel_initializer": {
|
|
47
|
+
"class_name": "VarianceScaling",
|
|
48
|
+
"config": {
|
|
49
|
+
"scale": 1,
|
|
50
|
+
"mode": "fan_avg",
|
|
51
|
+
"distribution": "normal",
|
|
52
|
+
"seed": null
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"bias_initializer": {
|
|
56
|
+
"class_name": "Zeros",
|
|
57
|
+
"config": {}
|
|
58
|
+
},
|
|
59
|
+
"kernel_regularizer": null,
|
|
60
|
+
"bias_regularizer": null,
|
|
61
|
+
"activity_regularizer": null,
|
|
62
|
+
"kernel_constraint": null,
|
|
63
|
+
"bias_constraint": null,
|
|
64
|
+
"name": "dense_Dense1",
|
|
65
|
+
"trainable": true
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"keras_version": "tfjs-layers 4.4.0",
|
|
71
|
+
"backend": "tensor_flow.js"
|
|
72
|
+
},
|
|
73
|
+
"weightsManifest": [
|
|
74
|
+
{
|
|
75
|
+
"binary": "FlNpPja1nT/flym9bqK9P9AqrL9s7Q9Ag7DevkYASz/ZT6q+4jJFvz5jlD/+UpM/IQDfv2ULLsCmaKk/NiSJPzQkib8=",
|
|
76
|
+
"weights": [
|
|
77
|
+
{
|
|
78
|
+
"name": "hidden-layer-1/kernel",
|
|
79
|
+
"shape": [
|
|
80
|
+
2,
|
|
81
|
+
3
|
|
82
|
+
],
|
|
83
|
+
"dtype": "float32"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "hidden-layer-1/bias",
|
|
87
|
+
"shape": [
|
|
88
|
+
3
|
|
89
|
+
],
|
|
90
|
+
"dtype": "float32"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "dense_Dense1/kernel",
|
|
94
|
+
"shape": [
|
|
95
|
+
3,
|
|
96
|
+
2
|
|
97
|
+
],
|
|
98
|
+
"dtype": "float32"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "dense_Dense1/bias",
|
|
102
|
+
"shape": [
|
|
103
|
+
2
|
|
104
|
+
],
|
|
105
|
+
"dtype": "float32"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"format": "layers-model",
|
|
111
|
+
"generatedBy": "TensorFlow.js tfjs-layers v4.4.0",
|
|
112
|
+
"convertedBy": null
|
|
113
|
+
}
|