Skip to content

Instantly share code, notes, and snippets.

@MinSomai
Created February 22, 2020 18:00
Show Gist options
  • Save MinSomai/21110a0802817cefb9b4321f176c50aa to your computer and use it in GitHub Desktop.
Save MinSomai/21110a0802817cefb9b4321f176c50aa to your computer and use it in GitHub Desktop.
package hw;
import java.awt.*;
import java.applet.*;
public class ScalingArbitrary13 extends Applet {
@Override
public void paint(Graphics g) {
g.drawLine(100,150,100,250);
g.drawLine(100,150,250,250);
g.drawLine(100,250,250,250);
int a[][]=new int[3][3];
int b[][]=new int[3][3];
int c[][]=new int[3][3];
int i,j,k;
a[0][0]=2;
a[0][1]=0;
a[0][2]=0;
a[1][0]=0;
a[1][1]=2;
a[1][2]=0;
a[2][0]=0;
a[2][1]=0;
a[2][2]=1;
b[0][0]=100;
b[0][1]=100;
b[0][2]=250;
b[1][0]=150;
b[1][1]=250;
b[1][2]=250;
b[2][0]=1;
b[2][1]=1;
b[2][2]=1;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=(c[i][j]+(a[i][k]*b[k][j]));
}
System.out.println();
}
g.drawLine(c[0][0], c[1][0], c[0][1], c[1][1]);
g.drawLine(c[0][1], c[1][1], c[0][2], c[1][2]);
g.drawLine(c[0][0], c[1][0], c[0][2], c[1][2]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment