es6-fuzz 6.0.3 → 6.0.9
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/Readme.md +65 -70
- package/lib/render-examples.d.ts +3 -0
- package/lib/render-examples.d.ts.map +1 -0
- package/lib/render-examples.js +285 -0
- package/lib/render-examples.js.map +1 -0
- package/lib/svg-renderer.d.ts +51 -0
- package/lib/svg-renderer.d.ts.map +1 -0
- package/lib/svg-renderer.js +269 -0
- package/lib/svg-renderer.js.map +1 -0
- package/package.json +3 -2
- package/.claude/settings.local.json +0 -26
- package/.gitattributes +0 -1
- package/.jscsrc +0 -36
- package/example.js +0 -11
- package/example2.js +0 -13
- package/typedoc.json +0 -20
package/Readme.md
CHANGED
|
@@ -1,107 +1,96 @@
|
|
|
1
|
-
# es6-fuzz
|
|
1
|
+
# es6-fuzz
|
|
2
2
|
|
|
3
|
-
> Fuzzy Logic in
|
|
3
|
+
> Fuzzy Logic in JavaScript
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/es6-fuzz)
|
|
6
6
|
[](https://github.com/sebs/es6-fuzz/blob/master/LICENSE.md)
|
|
7
7
|
[](https://github.com/sebs/es6-fuzz)
|
|
8
8
|
[](https://github.com/sebs/es6-fuzz/issues)
|
|
9
9
|
|
|
10
|
-
## Supported
|
|
10
|
+
## Supported Fuzzifiers
|
|
11
11
|
|
|
12
|
-
* Constant
|
|
13
|
-
* Grade
|
|
14
|
-
* Reverse Grade
|
|
15
|
-
* Sigmoid
|
|
16
|
-
* Trapezoid
|
|
17
|
-
* Triangle
|
|
12
|
+
* **Constant** - Fixed membership value
|
|
13
|
+
* **Grade** - Linear membership function
|
|
14
|
+
* **Reverse Grade** - Inverted linear membership
|
|
15
|
+
* **Sigmoid** - S-shaped membership curve
|
|
16
|
+
* **Trapezoid** - Trapezoidal membership function
|
|
17
|
+
* **Triangle** - Triangular membership function
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
* [changelog](https://github.com/sebs/es6-fuzz/blob/master/docs/CHANGELOG.md)
|
|
19
|
+
## Documentation
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
* [API Documentation](http://sebs.github.io/es6-fuzz)
|
|
22
|
+
* [Changelog](https://github.com/sebs/es6-fuzz/blob/master/docs/CHANGELOG.md)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Installation
|
|
25
25
|
|
|
26
|
-
```
|
|
26
|
+
```bash
|
|
27
27
|
npm install es6-fuzz
|
|
28
28
|
```
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
30
31
|
|
|
31
32
|
```javascript
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const { Logic, Triangle, Trapezoid, Grade } = require('es6-fuzz');
|
|
34
|
+
|
|
35
|
+
const logic = new Logic();
|
|
36
|
+
const result = logic
|
|
34
37
|
.init('noAttack', new Triangle(0, 20, 40))
|
|
35
38
|
.or('normalAttack', new Trapezoid(20, 30, 90, 100))
|
|
36
39
|
.or('enragedAttack', new Grade(90, 100))
|
|
37
|
-
|
|
40
|
+
.defuzzify(40);
|
|
41
|
+
|
|
42
|
+
console.log(result); // 'enragedAttack'
|
|
38
43
|
```
|
|
39
|
-
* enraged attack
|
|
40
44
|
|
|
41
|
-
## Example
|
|
45
|
+
## Temperature Example
|
|
42
46
|
|
|
43
47
|
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/Fuzzy_logic_temperature_en.svg/300px-Fuzzy_logic_temperature_en.svg.png" />
|
|
44
48
|
|
|
45
49
|
```javascript
|
|
46
|
-
|
|
50
|
+
const { Logic, Trapezoid } = require('es6-fuzz');
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
const logic = new Logic();
|
|
53
|
+
const result = logic
|
|
50
54
|
.init('cold', new Trapezoid(0, 12, 18, 20))
|
|
51
55
|
.or('hot', new Trapezoid(12, 14, 16, 100))
|
|
52
56
|
.defuzzify(20);
|
|
53
57
|
|
|
58
|
+
console.log(result); // 'hot'
|
|
54
59
|
```
|
|
55
60
|
|
|
56
|
-
* hot
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Usage with boon-js
|
|
60
|
-
|
|
61
|
-
In order to combine 2 fuzzy functions with boolean logic, there is a compat layer for boon-js which allows the sauge of 'boolean expression language'.
|
|
62
|
-
|
|
63
|
-
Example of a monster biting when its cold and you are close to it:
|
|
64
|
-
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
## Advanced Usage with boon-js
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
var logicHeat = new Logic();
|
|
70
|
-
const optimalTemperature = new Triangle(10, 20, 30);
|
|
71
|
-
const toColdTemperature = new Triangle(0, 10, 15);
|
|
72
|
-
const toHotTemperature = new Triangle(25, 40, 60);
|
|
64
|
+
Combine multiple fuzzy functions with boolean logic using the boon-js compatibility layer.
|
|
73
65
|
|
|
74
|
-
|
|
75
|
-
logicHeat.or('optimal', optimalTemperature)
|
|
76
|
-
logicHeat.or('hot', toHotTemperature);
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Distance Part
|
|
66
|
+
### Example: Monster AI
|
|
80
67
|
|
|
81
|
-
|
|
68
|
+
A monster that bites when it's cold AND you're close to it:
|
|
82
69
|
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
const
|
|
70
|
+
```javascript
|
|
71
|
+
const { Logic, Triangle } = require('es6-fuzz');
|
|
72
|
+
const { getEvaluator } = require('boon-js');
|
|
86
73
|
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
// Temperature logic
|
|
75
|
+
const logicHeat = new Logic();
|
|
76
|
+
logicHeat.init('cold', new Triangle(0, 10, 15))
|
|
77
|
+
.or('optimal', new Triangle(10, 20, 30))
|
|
78
|
+
.or('hot', new Triangle(25, 40, 60));
|
|
89
79
|
|
|
90
|
-
|
|
80
|
+
// Distance logic
|
|
81
|
+
const logicDistance = new Logic();
|
|
82
|
+
logicDistance.init('close', new Triangle(0, 10, 20))
|
|
83
|
+
.or('far', new Triangle(5, 50, 100));
|
|
91
84
|
|
|
92
|
-
|
|
85
|
+
// Combine with boolean logic
|
|
86
|
+
const monsterBiteTest = getEvaluator('heat.cold AND distance.close');
|
|
93
87
|
|
|
94
|
-
```js
|
|
95
|
-
const monsterBiteTest = getEvaluator(
|
|
96
|
-
'heat.cold AND distance.close',
|
|
97
|
-
);
|
|
98
88
|
const resHeat = logicHeat.defuzzify(2, 'heat');
|
|
99
89
|
const resClose = logicDistance.defuzzify(2, 'distance');
|
|
100
90
|
|
|
101
|
-
const jsBoonInput = { ...resHeat.boonJsInputs, ...resClose.boonJsInputs }
|
|
91
|
+
const jsBoonInput = { ...resHeat.boonJsInputs, ...resClose.boonJsInputs };
|
|
102
92
|
|
|
103
|
-
monsterBiteTest(jsBoonInput)
|
|
104
|
-
// returns true
|
|
93
|
+
console.log(monsterBiteTest(jsBoonInput)); // true
|
|
105
94
|
```
|
|
106
95
|
|
|
107
96
|
|
|
@@ -110,24 +99,30 @@ monsterBiteTest(jsBoonInput)
|
|
|
110
99
|
|
|
111
100
|
|
|
112
101
|
|
|
113
|
-
##
|
|
102
|
+
## Development
|
|
114
103
|
|
|
115
|
-
|
|
104
|
+
### Running Tests
|
|
116
105
|
|
|
117
|
-
```
|
|
106
|
+
```bash
|
|
118
107
|
npm test
|
|
119
108
|
```
|
|
120
109
|
|
|
121
|
-
|
|
110
|
+
### Building Documentation
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm run docs # Generate API docs
|
|
114
|
+
npm run docs:site # Build documentation site
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Requirements
|
|
122
118
|
|
|
123
|
-
|
|
124
|
-
* http://de.slideshare.net/BCSLeicester/fuzzy-logic-in-the-real-world-2326817
|
|
125
|
-
* http://computing.dcu.ie/~humphrys/Notes/Neural/sigmoid.html
|
|
119
|
+
* Node.js 20+
|
|
126
120
|
|
|
127
|
-
##
|
|
121
|
+
## Resources
|
|
128
122
|
|
|
129
|
-
|
|
123
|
+
* [Fuzzy Logic in the Real World](http://de.slideshare.net/BCSLeicester/fuzzy-logic-in-the-real-world-2326817)
|
|
124
|
+
* [Understanding Sigmoid Functions](http://computing.dcu.ie/~humphrys/Notes/Neural/sigmoid.html)
|
|
130
125
|
|
|
131
|
-
## Related
|
|
126
|
+
## Related Projects
|
|
132
127
|
|
|
133
|
-
* https://www.npmjs.com/package/gaussian
|
|
128
|
+
* [gaussian](https://www.npmjs.com/package/gaussian) - Gaussian distribution functions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-examples.d.ts","sourceRoot":"","sources":["../src/render-examples.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const logic_1 = require("./logic");
|
|
38
|
+
const svg_renderer_1 = require("./svg-renderer");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
// Ensure output directory exists
|
|
42
|
+
const outDir = './examples';
|
|
43
|
+
if (!fs.existsSync(outDir)) {
|
|
44
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
console.log('Rendering fuzzy logic curve examples to ./examples directory...\n');
|
|
47
|
+
// Initialize logic system
|
|
48
|
+
const logic = new logic_1.Logic();
|
|
49
|
+
// Define example curves with descriptive names
|
|
50
|
+
const examples = [
|
|
51
|
+
{
|
|
52
|
+
name: 'grade-cold',
|
|
53
|
+
shape: new logic.c.Grade(10, 25, 25, 25),
|
|
54
|
+
description: 'Grade: Cold temperature (increases from 10°C to 25°C)'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'reverse-grade-hot',
|
|
58
|
+
shape: new logic.c.ReverseGrade(25, 40, 40, 40),
|
|
59
|
+
description: 'ReverseGrade: Hot temperature (decreases from 25°C to 40°C)'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'triangle-comfortable',
|
|
63
|
+
shape: new logic.c.Triangle(18, 23, 23, 28),
|
|
64
|
+
description: 'Triangle: Comfortable temperature (peak at 23°C)'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'trapezoid-optimal',
|
|
68
|
+
shape: new logic.c.Trapezoid(20, 22, 26, 28),
|
|
69
|
+
description: 'Trapezoid: Optimal temperature range (22°C to 26°C)'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'sigmoid-transition',
|
|
73
|
+
shape: new logic.c.Sigmoid(25, 2),
|
|
74
|
+
description: 'Sigmoid: Smooth transition (centered at 25, slope 2)'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'sigmoid-steep',
|
|
78
|
+
shape: new logic.c.Sigmoid(30, 0.5),
|
|
79
|
+
description: 'Sigmoid: Steep transition (centered at 30, slope 0.5)'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'constant-medium',
|
|
83
|
+
shape: new logic.c.Constant(0.5),
|
|
84
|
+
description: 'Constant: Fixed membership value (0.5)'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'function-sine-wave',
|
|
88
|
+
shape: new logic.c.FuzzyFunction((x) => {
|
|
89
|
+
return Math.sin(x * Math.PI / 25) * 0.4 + 0.5;
|
|
90
|
+
}),
|
|
91
|
+
description: 'FuzzyFunction: Sine wave pattern'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'function-gaussian',
|
|
95
|
+
shape: new logic.c.FuzzyFunction((x) => {
|
|
96
|
+
const mean = 25;
|
|
97
|
+
const stdDev = 5;
|
|
98
|
+
return Math.exp(-Math.pow(x - mean, 2) / (2 * stdDev * stdDev));
|
|
99
|
+
}),
|
|
100
|
+
description: 'FuzzyFunction: Gaussian distribution (mean=25, σ=5)'
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
// Create renderer with nice defaults
|
|
104
|
+
const renderer = new svg_renderer_1.SVGRenderer({
|
|
105
|
+
width: 600,
|
|
106
|
+
height: 400,
|
|
107
|
+
xMin: 0,
|
|
108
|
+
xMax: 50,
|
|
109
|
+
yMin: 0,
|
|
110
|
+
yMax: 1,
|
|
111
|
+
padding: 50,
|
|
112
|
+
gridLines: true,
|
|
113
|
+
showLabels: true,
|
|
114
|
+
backgroundColor: '#ffffff',
|
|
115
|
+
gridColor: '#e5e7eb',
|
|
116
|
+
axisColor: '#374151',
|
|
117
|
+
labelColor: '#374151',
|
|
118
|
+
strokeWidth: 3,
|
|
119
|
+
strokeColor: '#2563eb',
|
|
120
|
+
fillOpacity: 0.15
|
|
121
|
+
});
|
|
122
|
+
// Render individual examples
|
|
123
|
+
examples.forEach(({ name, shape, description }) => {
|
|
124
|
+
const svg = renderer.render(shape);
|
|
125
|
+
const filePath = path.join(outDir, `${name}.svg`);
|
|
126
|
+
fs.writeFileSync(filePath, svg);
|
|
127
|
+
console.log(`✓ ${description}`);
|
|
128
|
+
console.log(` → ${filePath}`);
|
|
129
|
+
});
|
|
130
|
+
// Create composite examples
|
|
131
|
+
console.log('\nCreating composite visualizations...');
|
|
132
|
+
// Temperature controller system
|
|
133
|
+
const tempSystem = renderer.renderMultiple([
|
|
134
|
+
{ shape: new logic.c.ReverseGrade(0, 15, 15, 15), options: { strokeColor: '#1e40af', fillOpacity: 0.15 } },
|
|
135
|
+
{ shape: new logic.c.Trapezoid(10, 15, 20, 25), options: { strokeColor: '#3b82f6', fillOpacity: 0.15 } },
|
|
136
|
+
{ shape: new logic.c.Triangle(20, 25, 25, 30), options: { strokeColor: '#06b6d4', fillOpacity: 0.15 } },
|
|
137
|
+
{ shape: new logic.c.Triangle(25, 30, 30, 35), options: { strokeColor: '#f59e0b', fillOpacity: 0.15 } },
|
|
138
|
+
{ shape: new logic.c.Trapezoid(30, 35, 40, 45), options: { strokeColor: '#f97316', fillOpacity: 0.15 } },
|
|
139
|
+
{ shape: new logic.c.Grade(40, 50, 50, 50), options: { strokeColor: '#dc2626', fillOpacity: 0.15 } }
|
|
140
|
+
]);
|
|
141
|
+
fs.writeFileSync(path.join(outDir, 'temperature-system.svg'), tempSystem);
|
|
142
|
+
console.log('✓ Temperature control system (6 membership functions)');
|
|
143
|
+
console.log(` → ${path.join(outDir, 'temperature-system.svg')}`);
|
|
144
|
+
// Temperature controller system with legend
|
|
145
|
+
const tempRendererWithLegend = new svg_renderer_1.SVGRenderer({
|
|
146
|
+
...renderer['options'],
|
|
147
|
+
showLegend: true,
|
|
148
|
+
legendPosition: 'top-right'
|
|
149
|
+
});
|
|
150
|
+
const tempSystemWithLegend = tempRendererWithLegend.renderMultiple([
|
|
151
|
+
{ shape: new logic.c.ReverseGrade(0, 15, 15, 15), options: { strokeColor: '#1e40af', fillOpacity: 0.15 }, label: 'Freezing' },
|
|
152
|
+
{ shape: new logic.c.Trapezoid(10, 15, 20, 25), options: { strokeColor: '#3b82f6', fillOpacity: 0.15 }, label: 'Cold' },
|
|
153
|
+
{ shape: new logic.c.Triangle(20, 25, 25, 30), options: { strokeColor: '#06b6d4', fillOpacity: 0.15 }, label: 'Cool' },
|
|
154
|
+
{ shape: new logic.c.Triangle(25, 30, 30, 35), options: { strokeColor: '#f59e0b', fillOpacity: 0.15 }, label: 'Warm' },
|
|
155
|
+
{ shape: new logic.c.Trapezoid(30, 35, 40, 45), options: { strokeColor: '#f97316', fillOpacity: 0.15 }, label: 'Hot' },
|
|
156
|
+
{ shape: new logic.c.Grade(40, 50, 50, 50), options: { strokeColor: '#dc2626', fillOpacity: 0.15 }, label: 'Scorching' }
|
|
157
|
+
]);
|
|
158
|
+
fs.writeFileSync(path.join(outDir, 'temperature-system-with-legend.svg'), tempSystemWithLegend);
|
|
159
|
+
console.log('✓ Temperature control system with legend');
|
|
160
|
+
console.log(` → ${path.join(outDir, 'temperature-system-with-legend.svg')}`);
|
|
161
|
+
// Speed controller system
|
|
162
|
+
const speedRenderer = new svg_renderer_1.SVGRenderer({
|
|
163
|
+
...renderer['options'],
|
|
164
|
+
xMin: 0,
|
|
165
|
+
xMax: 120,
|
|
166
|
+
showLabels: true
|
|
167
|
+
});
|
|
168
|
+
const speedSystem = speedRenderer.renderMultiple([
|
|
169
|
+
{ shape: new logic.c.ReverseGrade(0, 30, 30, 30), options: { strokeColor: '#10b981', fillOpacity: 0.15 } },
|
|
170
|
+
{ shape: new logic.c.Triangle(20, 40, 40, 60), options: { strokeColor: '#3b82f6', fillOpacity: 0.15 } },
|
|
171
|
+
{ shape: new logic.c.Triangle(50, 70, 70, 90), options: { strokeColor: '#f59e0b', fillOpacity: 0.15 } },
|
|
172
|
+
{ shape: new logic.c.Grade(80, 110, 110, 110), options: { strokeColor: '#ef4444', fillOpacity: 0.15 } }
|
|
173
|
+
]);
|
|
174
|
+
fs.writeFileSync(path.join(outDir, 'speed-controller.svg'), speedSystem);
|
|
175
|
+
console.log('✓ Speed controller (slow, medium, fast, very-fast)');
|
|
176
|
+
console.log(` → ${path.join(outDir, 'speed-controller.svg')}`);
|
|
177
|
+
// Comparison of different sigmoid slopes
|
|
178
|
+
const sigmoidComparison = renderer.renderMultiple([
|
|
179
|
+
{ shape: new logic.c.Sigmoid(25, 0.5), options: { strokeColor: '#dc2626', strokeWidth: 2 } },
|
|
180
|
+
{ shape: new logic.c.Sigmoid(25, 1), options: { strokeColor: '#f97316', strokeWidth: 2 } },
|
|
181
|
+
{ shape: new logic.c.Sigmoid(25, 2), options: { strokeColor: '#f59e0b', strokeWidth: 2 } },
|
|
182
|
+
{ shape: new logic.c.Sigmoid(25, 4), options: { strokeColor: '#10b981', strokeWidth: 2 } },
|
|
183
|
+
{ shape: new logic.c.Sigmoid(25, 8), options: { strokeColor: '#3b82f6', strokeWidth: 2 } }
|
|
184
|
+
]);
|
|
185
|
+
fs.writeFileSync(path.join(outDir, 'sigmoid-slopes.svg'), sigmoidComparison);
|
|
186
|
+
console.log('✓ Sigmoid slope comparison (slopes: 0.5, 1, 2, 4, 8)');
|
|
187
|
+
console.log(` → ${path.join(outDir, 'sigmoid-slopes.svg')}`);
|
|
188
|
+
// Create an index HTML file
|
|
189
|
+
const indexHtml = `<!DOCTYPE html>
|
|
190
|
+
<html lang="en">
|
|
191
|
+
<head>
|
|
192
|
+
<meta charset="UTF-8">
|
|
193
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
194
|
+
<title>ES6-Fuzz Curve Examples</title>
|
|
195
|
+
<style>
|
|
196
|
+
body {
|
|
197
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
198
|
+
max-width: 1200px;
|
|
199
|
+
margin: 0 auto;
|
|
200
|
+
padding: 20px;
|
|
201
|
+
background-color: #f9fafb;
|
|
202
|
+
line-height: 1.6;
|
|
203
|
+
}
|
|
204
|
+
h1 { color: #111827; margin-bottom: 30px; }
|
|
205
|
+
h2 { color: #374151; margin-top: 40px; }
|
|
206
|
+
.grid {
|
|
207
|
+
display: grid;
|
|
208
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
209
|
+
gap: 20px;
|
|
210
|
+
margin-bottom: 40px;
|
|
211
|
+
}
|
|
212
|
+
.card {
|
|
213
|
+
background: white;
|
|
214
|
+
border-radius: 8px;
|
|
215
|
+
padding: 20px;
|
|
216
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
217
|
+
}
|
|
218
|
+
.card h3 {
|
|
219
|
+
margin: 0 0 10px 0;
|
|
220
|
+
color: #1f2937;
|
|
221
|
+
font-size: 18px;
|
|
222
|
+
}
|
|
223
|
+
.card p {
|
|
224
|
+
margin: 0 0 15px 0;
|
|
225
|
+
color: #6b7280;
|
|
226
|
+
font-size: 14px;
|
|
227
|
+
}
|
|
228
|
+
.card img {
|
|
229
|
+
width: 100%;
|
|
230
|
+
height: auto;
|
|
231
|
+
border: 1px solid #e5e7eb;
|
|
232
|
+
border-radius: 4px;
|
|
233
|
+
}
|
|
234
|
+
.full-width {
|
|
235
|
+
grid-column: 1 / -1;
|
|
236
|
+
}
|
|
237
|
+
</style>
|
|
238
|
+
</head>
|
|
239
|
+
<body>
|
|
240
|
+
<h1>ES6-Fuzz SVG Curve Rendering Examples</h1>
|
|
241
|
+
|
|
242
|
+
<h2>Individual Curve Types</h2>
|
|
243
|
+
<div class="grid">
|
|
244
|
+
${examples.map(({ name, description }) => `
|
|
245
|
+
<div class="card">
|
|
246
|
+
<h3>${description.split(':')[0]}</h3>
|
|
247
|
+
<p>${description.split(':')[1]}</p>
|
|
248
|
+
<img src="${name}.svg" alt="${description}">
|
|
249
|
+
</div>`).join('')}
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<h2>Composite Systems</h2>
|
|
253
|
+
<div class="grid">
|
|
254
|
+
<div class="card full-width">
|
|
255
|
+
<h3>Temperature Control System</h3>
|
|
256
|
+
<p>Complete temperature classification with six overlapping membership functions: freezing, cold, cool, warm, hot, and scorching.</p>
|
|
257
|
+
<img src="temperature-system.svg" alt="Temperature control system">
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div class="card full-width">
|
|
261
|
+
<h3>Temperature Control System with Legend</h3>
|
|
262
|
+
<p>Same temperature classification system with an integrated legend showing all membership function labels.</p>
|
|
263
|
+
<img src="temperature-system-with-legend.svg" alt="Temperature control system with legend">
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
<div class="card full-width">
|
|
267
|
+
<h3>Speed Controller</h3>
|
|
268
|
+
<p>Vehicle speed classification with four membership functions: slow, medium, fast, and very fast (0-120 km/h range).</p>
|
|
269
|
+
<img src="speed-controller.svg" alt="Speed controller">
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<div class="card full-width">
|
|
273
|
+
<h3>Sigmoid Slope Comparison</h3>
|
|
274
|
+
<p>Comparison of sigmoid curves with different slope parameters (0.5, 1, 2, 4, 8), all centered at x=25. Steeper slopes create sharper transitions.</p>
|
|
275
|
+
<img src="sigmoid-slopes.svg" alt="Sigmoid slope comparison">
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
</body>
|
|
279
|
+
</html>`;
|
|
280
|
+
fs.writeFileSync(path.join(outDir, 'index.html'), indexHtml);
|
|
281
|
+
console.log('\n✓ Created index.html viewer');
|
|
282
|
+
console.log(` → ${path.join(outDir, 'index.html')}`);
|
|
283
|
+
console.log(`\n✅ All examples rendered successfully to ${outDir}/`);
|
|
284
|
+
console.log(' Open examples/index.html in a browser to view all examples.');
|
|
285
|
+
//# sourceMappingURL=render-examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-examples.js","sourceRoot":"","sources":["../src/render-examples.ts"],"names":[],"mappings":";AACA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACZ,mCAAgC;AAChC,iDAA6C;AAC7C,uCAAyB;AACzB,2CAA6B;AAE7B,iCAAiC;AACjC,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;AAEjF,0BAA0B;AAC1B,MAAM,KAAK,GAAG,IAAI,aAAK,EAAE,CAAC;AAE1B,+CAA+C;AAC/C,MAAM,QAAQ,GAAG;IACf;QACE,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QACxC,WAAW,EAAE,uDAAuD;KACrE;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAC/C,WAAW,EAAE,6DAA6D;KAC3E;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,E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,EAAE,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC;AAC7D,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;AAEtD,OAAO,CAAC,GAAG,CAAC,6CAA6C,MAAM,GAAG,CAAC,CAAC;AACpE,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Shape } from './curve/shape';
|
|
2
|
+
import { Constant } from './curve/constant';
|
|
3
|
+
import { FuzzyFunction } from './curve/fuzzy-function';
|
|
4
|
+
import { Sigmoid } from './curve/sigmoid';
|
|
5
|
+
export interface SVGOptions {
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
padding?: number;
|
|
9
|
+
xMin?: number;
|
|
10
|
+
xMax?: number;
|
|
11
|
+
yMin?: number;
|
|
12
|
+
yMax?: number;
|
|
13
|
+
gridLines?: boolean;
|
|
14
|
+
strokeWidth?: number;
|
|
15
|
+
strokeColor?: string;
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
gridColor?: string;
|
|
19
|
+
axisColor?: string;
|
|
20
|
+
labelColor?: string;
|
|
21
|
+
fontSize?: number;
|
|
22
|
+
showLabels?: boolean;
|
|
23
|
+
showLegend?: boolean;
|
|
24
|
+
legendPosition?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
25
|
+
legendPadding?: number;
|
|
26
|
+
legendBackgroundColor?: string;
|
|
27
|
+
legendBorderColor?: string;
|
|
28
|
+
legendTextColor?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class SVGRenderer {
|
|
31
|
+
private options;
|
|
32
|
+
private readonly defaultOptions;
|
|
33
|
+
constructor(options?: SVGOptions);
|
|
34
|
+
private scaleX;
|
|
35
|
+
private scaleY;
|
|
36
|
+
private generatePath;
|
|
37
|
+
private renderGrid;
|
|
38
|
+
private renderLegend;
|
|
39
|
+
private getShapePoints;
|
|
40
|
+
render(shape: Shape | Constant | FuzzyFunction | Sigmoid): string;
|
|
41
|
+
renderMultiple(shapes: Array<{
|
|
42
|
+
shape: Shape | Constant | FuzzyFunction | Sigmoid;
|
|
43
|
+
options?: Partial<{
|
|
44
|
+
strokeColor: string;
|
|
45
|
+
fillOpacity: number;
|
|
46
|
+
strokeWidth: number;
|
|
47
|
+
}>;
|
|
48
|
+
label?: string;
|
|
49
|
+
}>): string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=svg-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-renderer.d.ts","sourceRoot":"","sources":["../src/svg-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAKtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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("./curve/grade");
|
|
5
|
+
const reverse_grade_1 = require("./curve/reverse-grade");
|
|
6
|
+
const triangle_1 = require("./curve/triangle");
|
|
7
|
+
const trapezoid_1 = require("./curve/trapezoid");
|
|
8
|
+
const constant_1 = require("./curve/constant");
|
|
9
|
+
const fuzzy_function_1 = require("./curve/fuzzy-function");
|
|
10
|
+
const sigmoid_1 = require("./curve/sigmoid");
|
|
11
|
+
class SVGRenderer {
|
|
12
|
+
options;
|
|
13
|
+
defaultOptions = {
|
|
14
|
+
width: 500,
|
|
15
|
+
height: 300,
|
|
16
|
+
padding: 40,
|
|
17
|
+
xMin: 0,
|
|
18
|
+
xMax: 100,
|
|
19
|
+
yMin: 0,
|
|
20
|
+
yMax: 1,
|
|
21
|
+
gridLines: true,
|
|
22
|
+
strokeWidth: 2,
|
|
23
|
+
strokeColor: '#2563eb',
|
|
24
|
+
fillOpacity: 0.1,
|
|
25
|
+
backgroundColor: '#ffffff',
|
|
26
|
+
gridColor: '#e5e5e5',
|
|
27
|
+
axisColor: '#525252',
|
|
28
|
+
labelColor: '#525252',
|
|
29
|
+
fontSize: 12,
|
|
30
|
+
showLabels: true,
|
|
31
|
+
showLegend: false,
|
|
32
|
+
legendPosition: 'top-right',
|
|
33
|
+
legendPadding: 10,
|
|
34
|
+
legendBackgroundColor: '#ffffff',
|
|
35
|
+
legendBorderColor: '#e5e5e5',
|
|
36
|
+
legendTextColor: '#525252'
|
|
37
|
+
};
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.options = options;
|
|
40
|
+
this.options = { ...this.defaultOptions, ...options };
|
|
41
|
+
}
|
|
42
|
+
scaleX(x) {
|
|
43
|
+
const { xMin, xMax, width, padding } = this.options;
|
|
44
|
+
return padding + ((x - xMin) / (xMax - xMin)) * (width - 2 * padding);
|
|
45
|
+
}
|
|
46
|
+
scaleY(y) {
|
|
47
|
+
const { yMin, yMax, height, padding } = this.options;
|
|
48
|
+
return height - padding - ((y - yMin) / (yMax - yMin)) * (height - 2 * padding);
|
|
49
|
+
}
|
|
50
|
+
generatePath(points) {
|
|
51
|
+
if (points.length === 0)
|
|
52
|
+
return '';
|
|
53
|
+
let path = `M ${this.scaleX(points[0][0])} ${this.scaleY(points[0][1])}`;
|
|
54
|
+
for (let i = 1; i < points.length; i++) {
|
|
55
|
+
path += ` L ${this.scaleX(points[i][0])} ${this.scaleY(points[i][1])}`;
|
|
56
|
+
}
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
renderGrid() {
|
|
60
|
+
const { xMin, xMax, yMin, yMax, width, height, padding, gridColor, axisColor, labelColor, fontSize, showLabels } = this.options;
|
|
61
|
+
let svg = '';
|
|
62
|
+
// Grid lines
|
|
63
|
+
const xStep = (xMax - xMin) / 10;
|
|
64
|
+
const yStep = (yMax - yMin) / 5;
|
|
65
|
+
// Vertical grid lines
|
|
66
|
+
for (let x = xMin; x <= xMax; x += xStep) {
|
|
67
|
+
const xPos = this.scaleX(x);
|
|
68
|
+
svg += `<line x1="${xPos}" y1="${padding}" x2="${xPos}" y2="${height - padding}" stroke="${gridColor}" stroke-width="1" />`;
|
|
69
|
+
}
|
|
70
|
+
// Horizontal grid lines
|
|
71
|
+
for (let y = yMin; y <= yMax; y += yStep) {
|
|
72
|
+
const yPos = this.scaleY(y);
|
|
73
|
+
svg += `<line x1="${padding}" y1="${yPos}" x2="${width - padding}" y2="${yPos}" stroke="${gridColor}" stroke-width="1" />`;
|
|
74
|
+
}
|
|
75
|
+
// Axes
|
|
76
|
+
svg += `<line x1="${padding}" y1="${height - padding}" x2="${width - padding}" y2="${height - padding}" stroke="${axisColor}" stroke-width="2" />`;
|
|
77
|
+
svg += `<line x1="${padding}" y1="${padding}" x2="${padding}" y2="${height - padding}" stroke="${axisColor}" stroke-width="2" />`;
|
|
78
|
+
// Labels
|
|
79
|
+
if (showLabels) {
|
|
80
|
+
// X-axis labels
|
|
81
|
+
for (let x = xMin; x <= xMax; x += xStep * 2) {
|
|
82
|
+
const xPos = this.scaleX(x);
|
|
83
|
+
svg += `<text x="${xPos}" y="${height - padding + 20}" text-anchor="middle" font-size="${fontSize}" fill="${labelColor}">${x}</text>`;
|
|
84
|
+
}
|
|
85
|
+
// Y-axis labels
|
|
86
|
+
for (let y = yMin; y <= yMax; y += yStep) {
|
|
87
|
+
const yPos = this.scaleY(y);
|
|
88
|
+
svg += `<text x="${padding - 10}" y="${yPos + 4}" text-anchor="end" font-size="${fontSize}" fill="${labelColor}">${y.toFixed(1)}</text>`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return svg;
|
|
92
|
+
}
|
|
93
|
+
renderLegend(items) {
|
|
94
|
+
const { width, height, padding, legendPosition, legendPadding, legendBackgroundColor, legendBorderColor, legendTextColor, fontSize } = this.options;
|
|
95
|
+
if (items.length === 0)
|
|
96
|
+
return '';
|
|
97
|
+
// Calculate legend dimensions
|
|
98
|
+
const lineHeight = fontSize + 6;
|
|
99
|
+
const legendItemHeight = lineHeight;
|
|
100
|
+
const legendHeight = legendPadding * 2 + items.length * legendItemHeight;
|
|
101
|
+
const maxLabelLength = Math.max(...items.map(item => item.label.length));
|
|
102
|
+
const legendWidth = legendPadding * 2 + 20 + maxLabelLength * fontSize * 0.6; // 20 for color box + gap
|
|
103
|
+
// Calculate legend position
|
|
104
|
+
let legendX;
|
|
105
|
+
let legendY;
|
|
106
|
+
switch (legendPosition) {
|
|
107
|
+
case 'top-left':
|
|
108
|
+
legendX = padding + 10;
|
|
109
|
+
legendY = padding + 10;
|
|
110
|
+
break;
|
|
111
|
+
case 'top-right':
|
|
112
|
+
legendX = width - padding - legendWidth - 10;
|
|
113
|
+
legendY = padding + 10;
|
|
114
|
+
break;
|
|
115
|
+
case 'bottom-left':
|
|
116
|
+
legendX = padding + 10;
|
|
117
|
+
legendY = height - padding - legendHeight - 10;
|
|
118
|
+
break;
|
|
119
|
+
case 'bottom-right':
|
|
120
|
+
legendX = width - padding - legendWidth - 10;
|
|
121
|
+
legendY = height - padding - legendHeight - 10;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
let svg = '';
|
|
125
|
+
// Legend background
|
|
126
|
+
svg += `<rect x="${legendX}" y="${legendY}" width="${legendWidth}" height="${legendHeight}" fill="${legendBackgroundColor}" stroke="${legendBorderColor}" stroke-width="1" rx="4" />`;
|
|
127
|
+
// Legend items
|
|
128
|
+
items.forEach((item, index) => {
|
|
129
|
+
const itemY = legendY + legendPadding + index * legendItemHeight;
|
|
130
|
+
// Color box
|
|
131
|
+
svg += `<rect x="${legendX + legendPadding}" y="${itemY}" width="${fontSize}" height="${fontSize}" fill="${item.color}" />`;
|
|
132
|
+
// Label
|
|
133
|
+
svg += `<text x="${legendX + legendPadding + fontSize + 5}" y="${itemY + fontSize - 2}" font-size="${fontSize}" fill="${legendTextColor}">${item.label}</text>`;
|
|
134
|
+
});
|
|
135
|
+
return svg;
|
|
136
|
+
}
|
|
137
|
+
getShapePoints(shape) {
|
|
138
|
+
const { xMin, xMax } = this.options;
|
|
139
|
+
const points = [];
|
|
140
|
+
if (shape instanceof grade_1.Grade || shape instanceof reverse_grade_1.ReverseGrade) {
|
|
141
|
+
// For Grade and ReverseGrade, we need key points and some intermediate points
|
|
142
|
+
const x0 = shape.x0;
|
|
143
|
+
const x1 = shape.x1;
|
|
144
|
+
points.push([Math.max(xMin, x0 - (x1 - x0) * 0.2), shape.fuzzify(Math.max(xMin, x0 - (x1 - x0) * 0.2))]);
|
|
145
|
+
points.push([x0, shape.fuzzify(x0)]);
|
|
146
|
+
if (x0 !== x1) {
|
|
147
|
+
points.push([(x0 + x1) / 2, shape.fuzzify((x0 + x1) / 2)]);
|
|
148
|
+
}
|
|
149
|
+
points.push([x1, shape.fuzzify(x1)]);
|
|
150
|
+
points.push([Math.min(xMax, x1 + (x1 - x0) * 0.2), shape.fuzzify(Math.min(xMax, x1 + (x1 - x0) * 0.2))]);
|
|
151
|
+
}
|
|
152
|
+
else if (shape instanceof triangle_1.Triangle) {
|
|
153
|
+
const x0 = shape.x0;
|
|
154
|
+
const x1 = shape.x1;
|
|
155
|
+
const x2 = shape.x2;
|
|
156
|
+
points.push([Math.max(xMin, x0 - (x2 - x0) * 0.1), 0]);
|
|
157
|
+
points.push([x0, 0]);
|
|
158
|
+
if (x0 !== x1) {
|
|
159
|
+
points.push([(x0 + x1) / 2, shape.fuzzify((x0 + x1) / 2)]);
|
|
160
|
+
}
|
|
161
|
+
points.push([x1, 1]);
|
|
162
|
+
if (x1 !== x2) {
|
|
163
|
+
points.push([(x1 + x2) / 2, shape.fuzzify((x1 + x2) / 2)]);
|
|
164
|
+
}
|
|
165
|
+
points.push([x2, 0]);
|
|
166
|
+
points.push([Math.min(xMax, x2 + (x2 - x0) * 0.1), 0]);
|
|
167
|
+
}
|
|
168
|
+
else if (shape instanceof trapezoid_1.Trapezoid) {
|
|
169
|
+
const x0 = shape.x0;
|
|
170
|
+
const x1 = shape.x1;
|
|
171
|
+
const x2 = shape.x2;
|
|
172
|
+
const x3 = shape.x3;
|
|
173
|
+
points.push([Math.max(xMin, x0 - (x3 - x0) * 0.1), 0]);
|
|
174
|
+
points.push([x0, 0]);
|
|
175
|
+
if (x0 !== x1) {
|
|
176
|
+
points.push([(x0 + x1) / 2, shape.fuzzify((x0 + x1) / 2)]);
|
|
177
|
+
}
|
|
178
|
+
points.push([x1, 1]);
|
|
179
|
+
points.push([x2, 1]);
|
|
180
|
+
if (x2 !== x3) {
|
|
181
|
+
points.push([(x2 + x3) / 2, shape.fuzzify((x2 + x3) / 2)]);
|
|
182
|
+
}
|
|
183
|
+
points.push([x3, 0]);
|
|
184
|
+
points.push([Math.min(xMax, x3 + (x3 - x0) * 0.1), 0]);
|
|
185
|
+
}
|
|
186
|
+
else if (shape instanceof sigmoid_1.Sigmoid) {
|
|
187
|
+
// Sample sigmoid at many points for smooth curve
|
|
188
|
+
const numSamples = 50;
|
|
189
|
+
const step = (xMax - xMin) / numSamples;
|
|
190
|
+
for (let x = xMin; x <= xMax; x += step) {
|
|
191
|
+
points.push([x, shape.fuzzify(x)]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (shape instanceof constant_1.Constant) {
|
|
195
|
+
// Constant is a horizontal line
|
|
196
|
+
const y = shape.fuzzify();
|
|
197
|
+
points.push([xMin, y]);
|
|
198
|
+
points.push([xMax, y]);
|
|
199
|
+
}
|
|
200
|
+
else if (shape instanceof fuzzy_function_1.FuzzyFunction) {
|
|
201
|
+
// Sample function at many points
|
|
202
|
+
const numSamples = 50;
|
|
203
|
+
const step = (xMax - xMin) / numSamples;
|
|
204
|
+
for (let x = xMin; x <= xMax; x += step) {
|
|
205
|
+
try {
|
|
206
|
+
points.push([x, shape.fuzzify(x)]);
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
// Skip invalid points
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return points;
|
|
214
|
+
}
|
|
215
|
+
render(shape) {
|
|
216
|
+
const { width, height, backgroundColor, strokeColor, strokeWidth, fillOpacity, gridLines } = this.options;
|
|
217
|
+
let svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">`;
|
|
218
|
+
svg += `<rect width="${width}" height="${height}" fill="${backgroundColor}" />`;
|
|
219
|
+
if (gridLines) {
|
|
220
|
+
svg += this.renderGrid();
|
|
221
|
+
}
|
|
222
|
+
const points = this.getShapePoints(shape);
|
|
223
|
+
const path = this.generatePath(points);
|
|
224
|
+
// Add fill area
|
|
225
|
+
if (fillOpacity > 0 && points.length > 0) {
|
|
226
|
+
const fillPath = path + ` L ${this.scaleX(points[points.length - 1][0])} ${this.scaleY(0)} L ${this.scaleX(points[0][0])} ${this.scaleY(0)} Z`;
|
|
227
|
+
svg += `<path d="${fillPath}" fill="${strokeColor}" fill-opacity="${fillOpacity}" />`;
|
|
228
|
+
}
|
|
229
|
+
// Add stroke
|
|
230
|
+
svg += `<path d="${path}" fill="none" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
231
|
+
svg += '</svg>';
|
|
232
|
+
return svg;
|
|
233
|
+
}
|
|
234
|
+
renderMultiple(shapes) {
|
|
235
|
+
const { width, height, backgroundColor, gridLines, showLegend } = this.options;
|
|
236
|
+
let svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">`;
|
|
237
|
+
svg += `<rect width="${width}" height="${height}" fill="${backgroundColor}" />`;
|
|
238
|
+
if (gridLines) {
|
|
239
|
+
svg += this.renderGrid();
|
|
240
|
+
}
|
|
241
|
+
const legendItems = [];
|
|
242
|
+
shapes.forEach(({ shape, options = {}, label }) => {
|
|
243
|
+
const strokeColor = options.strokeColor || this.options.strokeColor;
|
|
244
|
+
const fillOpacity = options.fillOpacity !== undefined ? options.fillOpacity : this.options.fillOpacity;
|
|
245
|
+
const strokeWidth = options.strokeWidth || this.options.strokeWidth;
|
|
246
|
+
// Collect legend items if label is provided
|
|
247
|
+
if (label && showLegend) {
|
|
248
|
+
legendItems.push({ label, color: strokeColor });
|
|
249
|
+
}
|
|
250
|
+
const points = this.getShapePoints(shape);
|
|
251
|
+
const path = this.generatePath(points);
|
|
252
|
+
// Add fill area
|
|
253
|
+
if (fillOpacity > 0 && points.length > 0) {
|
|
254
|
+
const fillPath = path + ` L ${this.scaleX(points[points.length - 1][0])} ${this.scaleY(0)} L ${this.scaleX(points[0][0])} ${this.scaleY(0)} Z`;
|
|
255
|
+
svg += `<path d="${fillPath}" fill="${strokeColor}" fill-opacity="${fillOpacity}" />`;
|
|
256
|
+
}
|
|
257
|
+
// Add stroke
|
|
258
|
+
svg += `<path d="${path}" fill="none" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
259
|
+
});
|
|
260
|
+
// Add legend if enabled
|
|
261
|
+
if (showLegend && legendItems.length > 0) {
|
|
262
|
+
svg += this.renderLegend(legendItems);
|
|
263
|
+
}
|
|
264
|
+
svg += '</svg>';
|
|
265
|
+
return svg;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.SVGRenderer = SVGRenderer;
|
|
269
|
+
//# sourceMappingURL=svg-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-renderer.js","sourceRoot":"","sources":["../src/svg-renderer.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;AAEZ,yCAAsC;AACtC,yDAAqD;AACrD,+CAA4C;AAC5C,iDAA8C;AAC9C,+CAA4C;AAC5C,2DAAuD;AACvD,6CAA0C;AA4B1C,MAAa,WAAW;IA2BF;IA1BH,cAAc,GAAyB;QACtD,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE,GAAG;QAChB,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,KAAK;QACjB,cAAc,EAAE,WAAW;QAC3B,aAAa,EAAE,EAAE;QACjB,qBAAqB,EAAE,SAAS;QAChC,iBAAiB,EAAE,SAAS;QAC5B,eAAe,EAAE,SAAS;KAC3B,CAAC;IAEF,YAAoB,UAAsB,EAAE;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC1C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IACxD,CAAC;IAEO,MAAM,CAAC,CAAS;QACtB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAA+B,CAAC;QAC5E,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,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I,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAEvC,gBAAgB;YAChB,IAAI,WAAW,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzC,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC/I,GAAG,IAAI,YAAY,QAAQ,WAAW,WAAW,mBAAmB,WAAW,MAAM,CAAC;YACxF,CAAC;YAED,aAAa;YACb,GAAG,IAAI,YAAY,IAAI,yBAAyB,WAAW,mBAAmB,WAAW,MAAM,CAAC;QAClG,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,IAAI,UAAU,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzC,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC;QAED,GAAG,IAAI,QAAQ,CAAC;QAEhB,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAzSD,kCAySC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es6-fuzz",
|
|
3
3
|
"description": "fuzzy logic with and for es6",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.9",
|
|
5
5
|
"main": "lib/logic.js",
|
|
6
6
|
"repository": "git@github.com:sebs/es6-fuzz.git",
|
|
7
7
|
"homepage": "https://github.com/sebs/es6-fuzz",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"pages": "node ./scripts/publish-gh.js",
|
|
18
18
|
"docs": "typedoc",
|
|
19
19
|
"preversion": "rm -f package-lock.json",
|
|
20
|
-
"postversion": "git push && git push --tags && npm run changelog && npm run docs && npm run pages"
|
|
20
|
+
"postversion": "git push && git push --tags && npm run changelog && npm run docs && npm run pages",
|
|
21
|
+
"render-examples": "node lib/render-examples.js"
|
|
21
22
|
},
|
|
22
23
|
"keywords": [
|
|
23
24
|
"fuzzylogic",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"WebFetch(domain:github.com)",
|
|
5
|
-
"Bash(npm test:*)",
|
|
6
|
-
"Bash(for:*)",
|
|
7
|
-
"Bash(do echo \"=== $file ===\")",
|
|
8
|
-
"Bash(awk:*)",
|
|
9
|
-
"Bash(done)",
|
|
10
|
-
"Bash(do [ \"$file%.test.js\" = \"$file\" ])",
|
|
11
|
-
"Bash(mv:*)",
|
|
12
|
-
"Bash(mkdir:*)",
|
|
13
|
-
"Bash(cp:*)",
|
|
14
|
-
"Bash(rm:*)",
|
|
15
|
-
"Bash(npx tsc:*)",
|
|
16
|
-
"Bash(node:*)",
|
|
17
|
-
"Bash(npm run build:*)",
|
|
18
|
-
"Bash(npx typedoc:*)",
|
|
19
|
-
"Bash(grep:*)",
|
|
20
|
-
"Bash(chmod:*)",
|
|
21
|
-
"Bash(/Users/sebastian.schuermann/private/es6-fuzz/fix-imports.sh:*)",
|
|
22
|
-
"Bash(npm run docs:*)"
|
|
23
|
-
],
|
|
24
|
-
"deny": []
|
|
25
|
-
}
|
|
26
|
-
}
|
package/.gitattributes
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* text=auto
|
package/.jscsrc
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"requireSpaceAfterKeywords": [
|
|
3
|
-
"if",
|
|
4
|
-
"else",
|
|
5
|
-
"for",
|
|
6
|
-
"while",
|
|
7
|
-
"do",
|
|
8
|
-
"switch",
|
|
9
|
-
"return",
|
|
10
|
-
"try",
|
|
11
|
-
"catch"
|
|
12
|
-
],
|
|
13
|
-
"disallowMultipleVarDecl": true,
|
|
14
|
-
"disallowEmptyBlocks": true,
|
|
15
|
-
"disallowSpacesInsideParentheses": true,
|
|
16
|
-
"disallowSpaceAfterObjectKeys": true,
|
|
17
|
-
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
|
18
|
-
"requireSpaceBeforeBinaryOperators": [
|
|
19
|
-
"=",
|
|
20
|
-
"==",
|
|
21
|
-
"===",
|
|
22
|
-
"!=",
|
|
23
|
-
"!=="
|
|
24
|
-
],
|
|
25
|
-
"requireSpaceAfterBinaryOperators": [
|
|
26
|
-
"=",
|
|
27
|
-
"==",
|
|
28
|
-
"===",
|
|
29
|
-
"!=",
|
|
30
|
-
"!=="
|
|
31
|
-
],
|
|
32
|
-
"disallowMultipleLineBreaks": true,
|
|
33
|
-
"validateLineBreaks": "LF",
|
|
34
|
-
"disallowKeywordsOnNewLine": ["else"],
|
|
35
|
-
"requireCapitalizedConstructors": true
|
|
36
|
-
}
|
package/example.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var Logic = require('./lib/logic')
|
|
3
|
-
var Trapezoid = require('./lib/curve/trapezoid');
|
|
4
|
-
|
|
5
|
-
var logic = new Logic();
|
|
6
|
-
var res = logic
|
|
7
|
-
.init('cold', new Trapezoid(0, 12, 18, 20)) // until 12-18 around warm
|
|
8
|
-
.or('warm', new Trapezoid(12, 14, 16, 100)) // until 12-18 around warm
|
|
9
|
-
.defuzzify(20);
|
|
10
|
-
|
|
11
|
-
console.log(res);
|
package/example2.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var Logic = require('./lib/logic')
|
|
2
|
-
var Trapezoid = require('./lib/curve/trapezoid');
|
|
3
|
-
var Triangle = require('./lib/curve/triangle');
|
|
4
|
-
var Grade = require('./lib/curve/grade');
|
|
5
|
-
|
|
6
|
-
var logic = new Logic();
|
|
7
|
-
var res = logic
|
|
8
|
-
.init('noAttack', new Triangle(0, 20, 40))
|
|
9
|
-
.or('normalAttack', new Trapezoid(20, 30, 90, 100))
|
|
10
|
-
.or('enragedAttack', new Grade(90, 100))
|
|
11
|
-
.defuzzify(40);
|
|
12
|
-
|
|
13
|
-
console.log(res);
|
package/typedoc.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://typedoc.org/schema.json",
|
|
3
|
-
"entryPoints": ["./src"],
|
|
4
|
-
"entryPointStrategy": "expand",
|
|
5
|
-
"out": "./out",
|
|
6
|
-
"name": "es6-fuzz",
|
|
7
|
-
"readme": "./Readme.md",
|
|
8
|
-
"includeVersion": true,
|
|
9
|
-
"excludePrivate": true,
|
|
10
|
-
"excludeProtected": false,
|
|
11
|
-
"excludeInternal": true,
|
|
12
|
-
"excludeExternals": false,
|
|
13
|
-
"hideGenerator": false,
|
|
14
|
-
"navigationLinks": {
|
|
15
|
-
"GitHub": "https://github.com/sebs/es6-fuzz"
|
|
16
|
-
},
|
|
17
|
-
"categorizeByGroup": true,
|
|
18
|
-
"categoryOrder": ["Logic", "Curves", "Types", "*"],
|
|
19
|
-
"sort": ["source-order"]
|
|
20
|
-
}
|