Files
envi-code/SourceCode/Code2026/inc/_cgal.h
T
2026-09-28 15:28:50 +08:00

90 lines
2.3 KiB
C++

#pragma once
#ifdef EARTHWORM_EXPORT
#define DLLIMPEXP __declspec(dllexport)
#else
#define DLLIMPEXP __declspec(dllimport)
#endif
namespace Geometry
{
typedef std::vector<AcGePoint2d> GePoint2dArray;
typedef std::vector<AcGePoint3d> GePoint3dArray;
typedef std::vector<GePoint3dArray> GePolyArray3d;
// 多边形
struct GePolygon2d
{
GePoint2dArray vertexs;
};
typedef std::vector<GePolygon2d> GePolygon2dList;
// 多边形带泂 polygon with holes
struct GePwh2d
{
GePolygon2d outer_boundary;
GePolygon2dList inner_holes;
};
typedef std::vector<GePwh2d> GePwh2dList;
enum Bounded_side
{
eOutside = -1,
eIsPoint,
eOnside,
eInside,
SIDE_ERROR,
};
// 对pts做delaunary三角化,并保存成GePolyFaceMesh结构
DLLIMPEXP void delaunayTriangulationMesh(const GePoint3dArray &arPts
, AcGePoint3dArray &vertexArray
, AcArray<Adesk::Int32> &faceArray);
DLLIMPEXP void delaunayTriangulationMeshWithHolds(const GePoint3dArray &arPts
, const GePolyArray3d &holds
, AcGePoint3dArray &vertexArray
, AcArray<Adesk::Int32> &faceArray);
// 计算一堆点的凸包曲线
// 传出是一个point数组,按顺序组成一条polygon
DLLIMPEXP void calcConvexHull2D(const GePoint2dArray &arPts, GePoint2dArray &poly);
DLLIMPEXP void calcConvexHull2D(const GePoint3dArray &arPts, GePoint2dArray &poly);
DLLIMPEXP void calcConvexHull2D(const GePoint3dArray &arPts, GePoint3dArray &poly);
DLLIMPEXP Bounded_side boundary_check(const AcGePoint2d &pt, const GePwh2d &gepoly);
DLLIMPEXP bool is_vaild_polygon(const GePwh2d &P);
DLLIMPEXP bool is_vaild_polygon(const GePolygon2d &P);
DLLIMPEXP bool is_counterclockwise(const GePwh2d &P);
DLLIMPEXP bool is_counterclockwise(const AcGePoint2d &ptS
, const AcGePoint2d &ptM
, const AcGePoint2d &ptE);
DLLIMPEXP bool is_intersect(const GePwh2d &p1, const GePwh2d &p2);
DLLIMPEXP void intersect(const GePwh2d &P
, const GePwh2d &Q
, GePwh2dList &gepwhlst);
DLLIMPEXP bool join(const GePwh2d &P
, const GePwh2d &Q
, GePwh2d &gepwh);
DLLIMPEXP void difference(const GePwh2d &P
, const GePwh2d &Q
, GePwh2dList &gepwhlst);
DLLIMPEXP void symmetric_difference(const GePwh2d &P
, const GePwh2d &Q
, GePwh2dList &gepwhlst);
DLLIMPEXP void convexHull2d(const AcGePoint2dArray &input, AcGePoint2dArray &output);
}