private bool translacao() { funcmat.calculaH_K(coeficientes); det = funcmat.acharSolucoesSistema(coeficientes[0], coeficientes[1], coeficientes[2]); if (det == 0) // Poder ter infinitas soluções ou ser incompativel { if (double.IsNaN(funcmat.getH()) || double.IsNaN(funcmat.getK())) { // Sistema incompativel } if (double.IsInfinity(funcmat.getH()) || double.IsInfinity(funcmat.getK())) { // Sistema com infinitas soluções } // Não conseguiu eliminar os termos lineares matrizG2 = funcmat.gerarEquacaoG2(coeficientes[0], coeficientes[1], coeficientes[2], coeficientes[3], coeficientes[4], coeficientes[5]); return(false); // não conseguiu realizar a translação } matrizG2 = funcmat.gerarEquacaoG2(coeficientes[0], coeficientes[1], coeficientes[2], coeficientes[3], coeficientes[4], coeficientes[5]); // Conseguiu realizar a translação, então remover os termos lineares funcmat.setDL(0); funcmat.setEL(0); return(true); }
public int whatConica(double[] coeficientes) { // determinante da matrix de coeficientes 3x3 double big_det = funcMat.whole_matrix_determinant(coeficientes); // determinante da matriz "minor" 2x2 formada por a,b,c double det = funcMat.acharSolucoesSistema(coeficientes[0], coeficientes[1], coeficientes[2]); // Conica nao degenerada: tem conicas com centro unico if (big_det != 0) { // conjunto vazio nos Reais --> (A+C)*big_det > 0 if ((coeficientes[0] + coeficientes[2]) * big_det > 0) { return(0); } // circ else if (coeficientes[0] == coeficientes[2] && coeficientes[1] == 0) { return(5); } // elipse else if (det > 0) { return(6); } //Hiperbole else if (det < 0) { return(7); } // parabola else if (det == 0) { return(8); } } // Conicas Degeneradas else if (big_det == 0) { // ponto if (det > 0) { return(1); } // retas concorrentes else if (det < 0) { return(4); } // retas paralelas else if (det == 0) { // D^2 + E^2 > 4(A+C)F // distintas se if ((Math.Pow(coeficientes[3], 2) + Math.Pow(coeficientes[3], 2)) > 4 * (coeficientes[0] + coeficientes[2]) * coeficientes[5]) { return(3); } // coincidentes se else if ((Math.Pow(coeficientes[3], 2) + Math.Pow(coeficientes[3], 2)) == 4 * (coeficientes[0] + coeficientes[2]) * coeficientes[5]) { return(2); } } } return(-1);// ERRO }