Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mbanquiero committed Mar 11, 2016
0 parents commit 500a5b0
Show file tree
Hide file tree
Showing 57 changed files with 41,545 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Compiled Object files

*.slo

*.lo

*.o

*.obj

*.exe


# Compiled Dynamic libraries

*.so

*.dylib


# Compiled Static libraries

*.lai

*.la

*.a

*/Debug*

*Release*

ipch
*.sdf
*.sln
*.vcxproj
/TGCViewer/*.filters
*.user
*.filters
*.ncb
*.opt
*.plg
*.suo
*.vcproj
Debug
Binary file added Clase 1 - Proyeccion.ppt
Binary file not shown.
Binary file added Clase 1 - Proyeccion.pptx
Binary file not shown.
Binary file added Clase 2 - Colisiones.ppt
Binary file not shown.
Binary file added Clase 2 - Colisiones.pptx
Binary file not shown.
Binary file added Dibujo2.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 Dibujo2.vsd
Binary file not shown.
Binary file added Ejercicios de Proyecciones.doc
Binary file not shown.
Binary file added algebra_y_videojuegos.ppt
Binary file not shown.
Binary file added algebra_y_videojuegos2014.ppt
Binary file not shown.
Binary file added algebra_y_videojuegos2014.zip
Binary file not shown.
Binary file added ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions bilinear.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">

var canvas;
var ctx;

//
// Ejemplo de bilinear sampling
//


var diff_map = [];

function CreateTexture()
{
for(var i=0;i<4;++i)
for(var j=0;j<4;++j)
diff_map[i+4*j] = {r:128 , g:128, b:128};

diff_map[1+4*1] = {r:255 , g:0, b:0};
diff_map[2+4*1] = {r:0 , g:255, b:0};
diff_map[1+4*2] = {r:0 , g:0, b:255};
diff_map[2+4*2] = {r:255 , g:255, b:255};
}

function tex2d(u, v)
{
var du = 4;
var dv = 4;

u -= 0.5/du;
v -= 0.5/dv;
var r = u*du;
var s = v*dv;
var i = r<0 ? du-1 : r|0
var j = s<0 ? dv-1 : s|0
var ri = r-i;
var rj = s-j;
var i1 = i<du-1?i+1:0;
var j1 = j<dv-1?j+1:0;
if(ri<0)
ri+=du;
if(rj<0)
rj+=dv;

var c00 = diff_map[i+dv*j];
var c01 = diff_map[i+dv*j1];
var c11 = diff_map[i1+dv*j1];
var c10 = diff_map[i1+dv*j];

var red = (c00.r * (1-ri)*(1-rj) + c10.r*ri*(1-rj) + c11.r*ri*rj + c01.r*(1-ri)*rj) | 0;
var green = (c00.g * (1-ri)*(1-rj) + c10.g*ri*(1-rj) + c11.g*ri*rj + c01.g*(1-ri)*rj) | 0;
var blue = (c00.b * (1-ri)*(1-rj) + c10.b*ri*(1-rj) + c11.b*ri*rj + c01.b*(1-ri)*rj) | 0;

return 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ',255)';

}



function draw()
{
if (canvas.getContext)
{
ctx.fillStyle = 'rgba(240,240,240,255)';
ctx.fillRect(0,0,1000,800);

var k = 5;
for(var i=0;i<=125;++i)
for(var j=0;j<=125;++j)
{
ctx.fillStyle = tex2d(i/125,j/125);
ctx.fillRect(10+i*k,10+j*k,k,k);
}
}
}

function animate()
{
canvas = document.getElementById('mycanvas');
ctx = canvas.getContext('2d');
CreateTexture();
draw();
}




</script>
</head>
<body onload="animate();">
<canvas id="mycanvas" width="1000" height="700"></canvas>

</body>
</html>

103 changes: 103 additions & 0 deletions bilinear2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">

var canvas;
var ctx;

//
// Ejemplo de bilinear sampling
//


var diff_map = [];

function CreateTexture()
{
var dt = 32;
for(var i=0;i<dt;++i)
for(var j=0;j<dt;++j)
{
var x = i-16;
var y = j-16;
var fx = Math.sqrt(x*x + y*y);
if( Math.abs(fx - 6)<1)
diff_map[i+dt*j] = {r:255 , g:255, b:255};
else
diff_map[i+dt*j] = {r:(i/dt*255)|0 , g:(j/dt*255)|0, b:0};
}
}

function tex2d(u, v)
{
var du = 32;
var dv = 32;

u -= 0.5/du;
v -= 0.5/dv;
var r = u*du;
var s = v*dv;
var i = (r<0 ? du-1 : r)|0
var j = (s<0 ? dv-1 : s)|0
var ri = r-i;
var rj = s-j;
var i1 = i<du-1?i+1:0;
var j1 = j<dv-1?j+1:0;
if(ri<0)
ri+=du;
if(rj<0)
rj+=dv;

var c00 = diff_map[i+dv*j];
var c01 = diff_map[i+dv*j1];
var c11 = diff_map[i1+dv*j1];
var c10 = diff_map[i1+dv*j];

var red = (c00.r * (1-ri)*(1-rj) + c10.r*ri*(1-rj) + c11.r*ri*rj + c01.r*(1-ri)*rj) | 0;
var green = (c00.g * (1-ri)*(1-rj) + c10.g*ri*(1-rj) + c11.g*ri*rj + c01.g*(1-ri)*rj) | 0;
var blue = (c00.b * (1-ri)*(1-rj) + c10.b*ri*(1-rj) + c11.b*ri*rj + c01.b*(1-ri)*rj) | 0;

return 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ',255)';

}



function draw()
{
if (canvas.getContext)
{
ctx.fillStyle = 'rgba(240,240,240,255)';
ctx.fillRect(0,0,1000,800);

var dt = 42;
var k = 5;
for(var i=0;i<=dt;++i)
for(var j=0;j<=dt;++j)
{
ctx.fillStyle = tex2d(i/dt,j/dt);
ctx.fillRect(10+i*k,10+j*k,k,k);
}
}
}

function animate()
{
canvas = document.getElementById('mycanvas');
ctx = canvas.getContext('2d');
CreateTexture();
draw();
}




</script>
</head>
<body onload="animate();">
<canvas id="mycanvas" width="1000" height="700"></canvas>

</body>
</html>

31 changes: 31 additions & 0 deletions canvas_1.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<head>

<script type="text/javascript">

//---------------------------------------------------------------------------------------------

function draw()
{
var canvas = document.getElementById('canvas');
if(canvas.getContext)
{
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.moveTo(75,50);
ctx.lineTo(100,75);
ctx.lineTo(100,25);
ctx.fill();
}
}



</script>
</head>
<body onload="draw();">
<canvas id="canvas" width="1000" height="700"></canvas>
</body>
</html>

33 changes: 33 additions & 0 deletions canvas_2.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>

<script type="text/javascript">

//---------------------------------------------------------------------------------------------

function draw() {
var canvas = document.getElementById('canvas');
if (canvas.getContext){
var ctx = canvas.getContext('2d');

ctx.beginPath();
ctx.arc(75,75,50,0,Math.PI*2,true);
ctx.moveTo(110,75);
ctx.arc(75,75,35,0,Math.PI,false);
ctx.moveTo(65,65);
ctx.arc(60,65,5,0,Math.PI*2,true);
ctx.moveTo(95,65);
ctx.arc(90,65,5,0,Math.PI*2,true);
ctx.stroke();
}
}


</script>
</head>
<body onload="draw();">
<canvas id="canvas" width="1000" height="700"></canvas>
</body>
</html>

Loading

0 comments on commit 500a5b0

Please sign in to comment.