计算三角形面积(叉积)

论坛 期权论坛 脚本     
匿名技术用户   2020-12-30 22:09   55   0
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef struct point{
double x;
double y;
}point;
double CrossProduct(point A, point B, point C){
return (B.x-A.x)*(C.y-A.y) - (B.y-A.y)*(C.x-A.x);
}
int main()
{
point a, b, c;
double temp, area;
cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
temp = CrossProduct(a, b, c);
area = 0.5*fabs(temp);
cout << area << endl;
return 0;
}



分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP