private void ProjecaoObliqua(double[][] mat) { int j; double[] p1, p2; No face; Pontos[] p; ret = imgBmp; Reta.IniciarMatriz(); for (int i = 0; i < lFace.Count; i++) { face = ((No)(lFace[i])); p = new Pontos[face.getCount()]; j = 0; while (face != null) { p[j] = (Pontos)lVertAtual[face.getPos()]; j++; face = face.getProx(); } p[j] = p[0]; Pontos vertAB = new Pontos(p[1].getX() - p[0].getX(), p[1].getY() - p[0].getY(), p[1].getZ() - p[0].getZ()); Pontos vertAC = new Pontos(p[2].getX() - p[0].getX(), p[2].getY() - p[0].getY(), p[2].getZ() - p[0].getZ()); if (lVetorNormal.Count <= i) { lVetorNormal.Add(new Vetor(vertAB, vertAC)); } else { lVetorNormal[i] = new Vetor(vertAB, vertAC); } if (cbBackFaceCulling.Checked) { if (((Vetor)lVetorNormal[i]).getZ() > 0) { for (int k = 0; k < j; k++) { p1 = MultiplicarPontos(mat, p[k]); p2 = MultiplicarPontos(mat, p[k + 1]); Reta.Bresenham((int)p1[0], (int)p1[1], (int)p2[0], (int)p2[1]); } } } else { for (int k = 0; k < j; k++) { p1 = MultiplicarPontos(mat, p[k]); p2 = MultiplicarPontos(mat, p[k + 1]); Reta.Bresenham((int)p1[0], (int)p1[1], (int)p2[0], (int)p2[1]); } } } Reta.AlocarBitmap(ret); Reta.Desenhar(); if (btnColorir.Text.Equals("Colorir")) { // ScanLine.Scanline(Reta.getImgDta()); } Reta.DesalocarBitmap(ret); pictureBox.Image = ret; imgBmp = ret; }
private void OrtograficaLateral() { int j; No face; Pontos[] p; ret = imgBmp; Reta.IniciarMatriz(); for (int i = 0; i < lFace.Count; i++) { face = ((No)(lFace[i])); p = new Pontos[face.getCount()]; j = 0; while (face != null) { p[j] = (Pontos)lVertAtual[face.getPos()]; j++; face = face.getProx(); } p[j] = p[0]; Pontos vertAB = new Pontos(p[1].getX() - p[0].getX(), p[1].getY() - p[0].getY(), p[1].getZ() - p[0].getZ()); Pontos vertAC = new Pontos(p[2].getX() - p[0].getX(), p[2].getY() - p[0].getY(), p[2].getZ() - p[0].getZ()); if (lVetorNormal.Count <= i) { lVetorNormal.Add(new Vetor(vertAB, vertAC)); } else { lVetorNormal[i] = new Vetor(vertAB, vertAC); } if (cbBackFaceCulling.Checked) { if (((Vetor)lVetorNormal[i]).getX() > 0) { for (int k = 0; k < j; k++) { Reta.Bresenham(p[k].getY() + 100, p[k].getZ() + 425, p[k + 1].getY() + 100, p[k + 1].getZ() + 425);//pintanto } } } else { for (int k = 0; k < j; k++) { Reta.Bresenham(p[k].getY() + 100, p[k].getZ() + 425, p[k + 1].getY() + 100, p[k + 1].getZ() + 425);//pintanto } } } Reta.AlocarBitmap(ret); Reta.Desenhar(); if (btnColorir.Text.Equals("Colorir")) { //ScanLine.Scanline(Reta.getImgDta()); } Reta.DesalocarBitmap(ret); pictureBox.Image = ret; imgBmp = ret; }