多边形顺时针方向判断公式及C++代码实现
//#include "PolygonInterMul.h"#pragma once //编译一次
#ifndef Const采用PI采用H
#define Const采用PI采用H
const double PI=3.141592654;
const double e=2.718;
#endif
#ifndef PolygonInterMul采用H
#define PolygonInterMul采用H
//顶点对象
public struct Top采用Point
{
void set(double x,double y,double z)
{
this->X =x;
this->Y =y;
this->Z =z;
};
double X;
double Y;
double Z;
};
//顶点对象
public class Top采用PointClass
{
public:
void set(double x,double y,double z)
{
this->X =x;
this->Y =y;
this->Z =z;
};
double X;
double Y;
double Z;
};
//失量/向量
public struct Vertex
{
void set(double i,double j,double k)
{
this->I=i;
this->J=j;
this->K=k;
};
double I;
double J;
double K;
};
//
class PolygonInterMul
{
public :
PolygonInterMul();
~PolygonInterMul();
public :
//求向量p1->p2
Vertex getVertex(Top采用Point p1,Top采用Point p2);
//求叉积
Vertex getInterMul(Vertex v1,Vertex v2);
//求向量夹角
double getJJ(Vertex v1,Vertex v2);
//测试
void Test();
//三顶点求面积p1->p2->p3(顶点成逆时针回路)
double getArea(Top采用Point p1,Top采用Point p2,Top采用Point p3);
//多顶点求面积(顶点成逆时针回路)梯形法
double getArea(System::Collections::ArrayList PointList);
double getArea(Top采用PointClass *PointArray);//??
private:
double Nums;
};
#endif
页:
[1]