first commit

This commit is contained in:
William Cardoso Simas committed 2026-11-18 10:40:33 -03:00
commit e7bd585b28
40 files changed
+1233

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
package grafico;
import java.awt.Color;
import java.awt.Graphics;
public class ClsEixos
{
public ClsEixos(int eixoXX[], int eixoXY[], int eixoYX[], int eixoYY[], Graphics g, Color cor)
{
//EIXO X
g.setColor(cor);
g.drawPolyline(eixoXX, eixoXY, 2);
//EIXO Y
g.setColor(cor);
g.drawPolyline(eixoYX, eixoYY, 2);
}
}
+90
View File
@@ -0,0 +1,90 @@
package grafico;
import java.awt.Color;
import java.text.DecimalFormat;
public class ClsOnda
{
private int xValues[];
private int yValues[];
private double orgY[];
private Color cor;
private int largura;
private int amplitude;
private double periodo;
public ClsOnda(int X[], double Y[], Color cor, int largura, int inicio, double zoom)
{
this.amplitude = 0;
this.periodo = 0;
this.largura = largura;
this.cor = cor;
xValues = X;
orgY = Y;
yValues = new int[Y.length];
for (int x = 0; x < Y.length; x++)
{
xValues[x] /= zoom;
yValues[x] = Math.round(inicio + (int)((orgY[x]) * zoom));
}
}
public ClsOnda(int amplitude, double periodo, int largura, int altura, int inicio, Color cor, double zoom)
{
this.amplitude = amplitude;
this.periodo = periodo;
this.cor = cor;
this.largura = largura;
xValues = new int[largura];
yValues = new int[largura];
orgY = new double[largura];
for(int x = 0; x < largura/2; x++)
{
xValues[largura/2 - x] = (int) ((largura/2 - x));
yValues[largura/2 - x] = (int) (amplitude * Math.sin(((x * Math.pow((2 *Math.PI),2))/((largura/2) * periodo * zoom)))*zoom + inicio);
orgY[largura/2 - x] = (int) (amplitude * Math.sin(((x * Math.pow((2 *Math.PI),2))/((largura/2) * periodo))));
xValues[x + largura/2] = (int) ((largura/2 + x));
yValues[x + largura/2] = (int) (-amplitude * Math.sin(((x * Math.pow((2 *Math.PI),2))/((largura/2) * periodo * zoom)))*zoom + inicio);
orgY[x + largura/2] = (int) (-amplitude * Math.sin(((x * Math.pow((2 *Math.PI),2))/((largura/2) * periodo))));
}
}
public Color getCor()
{
return cor;
}
public int[] obterX()
{
return xValues;
}
public int[] obterY()
{
return yValues;
}
public double[] obterOrgY()
{
return orgY;
}
public int getLargura()
{
return largura;
}
public int obterAmplitude()
{
return Math.abs(amplitude);
}
public double obterPeriodo()
{
return (periodo/Math.PI);
}
public String obterPeriodoFormatado()
{
DecimalFormat fmt = new DecimalFormat("0.0000");
String part[] = fmt.format(periodo/Math.PI).split("[,]");
return (part[0] + "." + part[1]);
}
}
+49
View File
@@ -0,0 +1,49 @@
package grafico;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
public class PnlGrafico extends JPanel
{
private static final long serialVersionUID = 0L;
private int qtdOndas;
private ClsOnda ondas[];
public PnlGrafico(int qtdOndas, ClsOnda ondas[])
{
this.qtdOndas = qtdOndas;
this.ondas = ondas;
}
public void atualizarTela(int qtdOndas, ClsOnda ondas[], Graphics g)
{
this.qtdOndas = qtdOndas;
this.ondas = ondas;
paintAll(g);
}
public void paintAll(Graphics g)
{
super.paintComponent(g);
super.setBorder(BorderFactory.createLineBorder(Color.black, 2));
int eixoXX[] = {0, 558};
int eixoXY[] = {100, 100};
int eixoYX[] = {279, 279};
int eixoYY[] = {0, 200};
ClsEixos eixos = new ClsEixos(eixoXX, eixoXY, eixoYX, eixoYY, g, Color.BLACK);
for (int x = 0; x < qtdOndas; x++)
{
g.setColor(ondas[x].getCor());
g.drawPolyline(ondas[x].obterX(), ondas[x].obterY(), ondas[x].getLargura());
}
}
public void paintComponent(Graphics g)
{
paintAll(g);
}
}
+5
View File
@@ -0,0 +1,5 @@
[.ShellClassInfo]
InfoTip=Esta pasta está compartilhada on-line.
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
IconIndex=12