track stats
This commit is contained in:
parent
523d203712
commit
3b19c2d472
1 changed files with 25 additions and 6 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
#gyroid > div {
|
#gyroid > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -19,12 +20,19 @@
|
||||||
min-width: 3px;
|
min-width: 3px;
|
||||||
min-height: 3px;
|
min-height: 3px;
|
||||||
}
|
}
|
||||||
|
#stats {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#stats > input {
|
||||||
|
pointer-events: none;
|
||||||
|
outline: none;
|
||||||
|
width: 5em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
let PI2 = Math.PI * 2;
|
let PI2 = Math.PI * 2;
|
||||||
let rez = 150;
|
let rez = 150;
|
||||||
let inc = PI2/rez;
|
let inc = PI2/rez;
|
||||||
let epsilon = 0;
|
|
||||||
let zcache = {};
|
let zcache = {};
|
||||||
|
|
||||||
function $(id) {
|
function $(id) {
|
||||||
|
|
@ -77,7 +85,7 @@
|
||||||
let erow = edge[rowi];
|
let erow = edge[rowi];
|
||||||
let lval = vrow[vrow.length - 1];
|
let lval = vrow[vrow.length - 1];
|
||||||
vrow.forEach((val, vali) => {
|
vrow.forEach((val, vali) => {
|
||||||
if (lval <= epsilon && val >= epsilon) {
|
if (lval <= 0 && val >= 0) {
|
||||||
erow[vali] = 1;
|
erow[vali] = 1;
|
||||||
points++;
|
points++;
|
||||||
points_lr++;
|
points_lr++;
|
||||||
|
|
@ -91,7 +99,7 @@
|
||||||
let lval = vals[vals.length-1][x];
|
let lval = vals[vals.length-1][x];
|
||||||
for (let y=0; y<rez; y++) {
|
for (let y=0; y<rez; y++) {
|
||||||
let val = vals[y][x];
|
let val = vals[y][x];
|
||||||
if (lval <= epsilon && val >= epsilon) {
|
if (lval <= 0 && val >= 0) {
|
||||||
if (edge[y][x]) {
|
if (edge[y][x]) {
|
||||||
edge[y][x] = 3;
|
edge[y][x] = 3;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -108,13 +116,17 @@
|
||||||
|
|
||||||
// top-down poly create
|
// top-down poly create
|
||||||
|
|
||||||
console.log({zkey, points, points_lr, points_td});
|
return zcache[zkey] = {edge, points, points_lr, points_td};
|
||||||
return (zcache[zkey] = edge);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function render(z) {
|
function render(z) {
|
||||||
let edge = generate(z);
|
|
||||||
let html = [];
|
let html = [];
|
||||||
|
let { edge, points, points_lr, points_td } = generate(z);
|
||||||
|
console.log({z, points, points_lr, points_td});
|
||||||
|
$('points').value = points;
|
||||||
|
$('points_lr').value = points_lr;
|
||||||
|
$('points_td').value = points_td;
|
||||||
|
$('direction').value = points_td > points_lr ? 'lr' : 'td';
|
||||||
edge.forEach(row => {
|
edge.forEach(row => {
|
||||||
html.push('<div>');
|
html.push('<div>');
|
||||||
row.forEach(val => {
|
row.forEach(val => {
|
||||||
|
|
@ -136,6 +148,13 @@
|
||||||
<div id="test">
|
<div id="test">
|
||||||
<div id="gyroid"></div>
|
<div id="gyroid"></div>
|
||||||
<input id="zval" type="range" min="0" max="200" value="0" oninput="update()"/>
|
<input id="zval" type="range" min="0" max="200" value="0" oninput="update()"/>
|
||||||
|
<div id="stats">
|
||||||
|
<input id="points"></input>
|
||||||
|
<input id="points_lr"></input>
|
||||||
|
<input id="points_td"></input>
|
||||||
|
<input id="direction"></input>
|
||||||
|
<input id="polys"></input>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue