已知三点坐标 求抛物线的方程 积分求面积 计算几何

已知三点坐标 求抛物线的方程 积分求面积 计算几何

#include < iostream >
#include
< cstdio >
using   namespace  std;
void  main()
{
    
int  n;
    
double  x1,x2,x3,y1,y2,y3,a,b,c,k,m,area;
    cin
>> n;
    
while (n -- ){
        cin
>> x1 >> y1;
        cin
>> x2 >> y2;
        cin
>> x3 >> y3;
        a
= (y2 - y1) / ((x1 - x2) * (x1 - x2));
        b
=- 2 * x1 * (y2 - y1) / ((x1 - x2) * (x1 - x2));
        c
= y1 - x1 * x1 * (y2 - y1) / ((x1 - x2) * (x1 - x2)) + 2 * x1 * x1 * (y2 - y1) / ((x1 - x2) * (x1 - x2));
        k
= (y3 - y2) / (x3 - x2);
        m
= y2 - (y3 - y2) / (x3 - x2) * x2;
        area
= (a * x3 * x3 * x3 / 3 + (b - k) * x3 * x3 / 2 + (c - m) * x3) - (a * x2 * x2 * x2 / 3 + (b - k) * x2 * x2 / 2 + (c - m) * x2);
        printf(
" %.2lf\n " ,area);
    }
}


你可能感兴趣的:(已知三点坐标 求抛物线的方程 积分求面积 计算几何)