Skip to content

Commit

Permalink
Add SandwichNet to git page
Browse files Browse the repository at this point in the history
  • Loading branch information
fsewing committed Jan 31, 2024
1 parent 1399142 commit b3d8766
Show file tree
Hide file tree
Showing 22 changed files with 112,378 additions and 0 deletions.
Binary file added SandwichNet/.DS_Store
Binary file not shown.
37 changes: 37 additions & 0 deletions SandwichNet/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Button
{
constructor(w,h)
{
this.buttonWidth = w;
this.buttonHeight = h;
this.buttonPos = createVector();
}
isPressed(position)
{
if(mouseIsPressed === true)
{
this.buttonPos = position;
if( (translatedMouseX >= this.buttonPos.x) &&
(translatedMouseX <= this.buttonPos.x + this.buttonWidth) &&
(translatedMouseY >= this.buttonPos.y) &&
(translatedMouseY <= this.buttonPos.y + this.buttonHeight)
)
{
return true;
}else{
return false;
}
}
}
render(position)
{
this.buttonPos = position;
push();
translate(this.buttonPos.x,this.buttonPos.y);
rectMode(CORNER);
fill(255);
stroke(2);
rect(0,0,this.buttonWidth,this.buttonWidth)
pop();
}
}
49 changes: 49 additions & 0 deletions SandwichNet/errorGraph.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class ErrorGraph
{
constructor(w,h)
{
this.numPoints = [1,0.5,0.2];
this.h = h;
this.w = w;
}

update(newNumber)
{
this.numPoints.push(newNumber);
}

render()
{
stroke(0);
strokeWeight(2);
// draw ellipses
line(0,1,this.w,1);
line(0,this.h,this.w,this.h);
if(this.numPoints.length != 0)
{
for(let i = 0; i < this.numPoints.length; i++)
{
let x = i * (this.w / (this.numPoints.length-1));
let y = map(this.numPoints[i],0,1,0,this.w);
fill(0);
ellipse(x, y, 7);
}
stroke(0);
// draw lines
let px = 0;
let py = randomY[0];
for(let i =0; i < this.numPoints.length; i++)
{
let x = i * (width / (this.numPoints.length-1));
let y = randomY[i];
line(px, py, x, y);

//store the last position
px = x;
py = y;
}
}

}

}
90 changes: 90 additions & 0 deletions SandwichNet/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
let debugging = false;

function debug(v)
{
if(debugging == true)
{
console.log(v);
}
}

function getRandomInt(max)
{
return Math.round((Math.random() * 2 * max) - max);
}
function getRandomTestInput()
{
return Math.round((Math.random()));
}

function create_1d_array(rows)
{
let array_1d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_1d[i] = 0;
}
return array_1d;
}

function create_1d_classArray(rows, Val)
{
let array_1d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_1d[i] = new Val();
}
return array_1d;
}

function create_2d_array(rows, columns)
{
let array_2d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_2d[i] = new Array(columns);
for(let j = 0; j < columns; j++)
{
array_2d[i][j] = getRandomInt(3)+0.5;
}
}
return array_2d;
}

function create_2d_boolArray(rows, columns)
{
let array_2d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_2d[i] = new Array(columns);
for(let j = 0; j < columns; j++)
{
array_2d[i][j] = false;
}
}
return array_2d;
}

function create_1d_vectorArray(rows)
{
let array_1d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_1d[i] = createVector(0,0);
}
return array_1d;
}

function create_2d_vectorArray(rows, columns)
{
let array_2d = new Array(rows);
for(let i = 0; i < rows; i++)
{
array_2d[i] = new Array(columns);
for(let j = 0; j < columns; j++)
{
array_2d[i][j] = createVector(0,0);
}
}
return array_2d;
}
Binary file added SandwichNet/img/.DS_Store
Binary file not shown.
1,808 changes: 1,808 additions & 0 deletions SandwichNet/img/arrow.ai

Large diffs are not rendered by default.

Binary file added SandwichNet/img/ingrediensArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SandwichNet/img/sandwich-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SandwichNet/img/sandwich-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SandwichNet/img/tastometer_03_anzeige.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SandwichNet/img/tastometer_03_meter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions SandwichNet/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />

</head>
<body>
<main>
</main>
<script src="quicksettings.js"></script>
<script src="p5.gui.js"></script>
<script src="helper.js"></script>
<script src="sandwich.js"></script>
<script src="button.js"></script>
<script src="tasteOMeter.js"></script>
<!--<script src="errorGraph.js"></script>-->
<script src="sigmoidGraph.js"></script>
<script src="simpleNeuralNet.js"></script>
<script src="sketch.js"></script>
</body>
</html>
Loading

0 comments on commit b3d8766

Please sign in to comment.