定高曲线算法

frp529 2011-10-31 11:17:17
已知100个点坐标,定高高度。如何画一条等高的曲线
算法要考虑高低落差。
...全文
72 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jone7319 2011-11-01
  • 打赏
  • 举报
回复
下面这个类就是我画等值线用的类,可以在地图上画地形等高线,等温线、等压线等等,类的代码较大,这里放不下,给你看一下类定义,是不是你要的

#include <math.h>
#include <fstream.h>
//本类用于绘制等值线

const MaxVertices = 500000;
const MaxTriangles = 1000000;
const ExPtTolerance = 0.000001; //小于这个被认为是同一点



typedef int TCastArray[3][3][3];
typedef double TVectorL3D[3];
typedef int TVectorL3I[3];

typedef struct TPointPair
{
double x1,y1, x2,y2;
}PointPair ;

typedef PointPair *PPointPair;

struct TLever //单条等值线
{
double FZ;
TList *Points;
};

struct dVertex //Points (Vertices)
{
double X,Y,Z;
};

struct dTriangle //Created Triangles, vv# are the vertex pointers(点的索引)
{
long vv0,vv1,vv2;
int PreCalc;
double xc,yc,r; //三角形外接圆圆心坐标和半径
};

//################################################################################
//三角形网类定义
class TDelaunay
{
private:
double FzLow,FzHigh;
dVertex *FVertexs ;
dTriangle *FTriangles ;
int FTriangleCount;
int FPointCount; //Variable for total number of points (vertices)
void QuickSort(dVertex *aVertexs,int Low,int High);
int GetPointCount();
bool InCircle(double xp,double yp,double x1,double y1,double x2,double y2,double x3,double y3,double &xc,double &yc,double &r,int j);
int Triangulate(int nVert);
void DoQuickSort(dVertex *aVertexs,int iLo,int iHi); //增加排序函数
double Sec(double a,double b,double c,double d);//增加插值函数

public:
TLever *FLevers;//等值线
TCanvas *canvas;
TDelaunay();
~TDelaunay();
void Mesh();
void DrawTriangles(double lon0,double lat0,float lon1,float lon2,float lat1,float lat2,double zoom);//(lon0,lat0)左上角经、纬度,(lon1,lat1)、(lon2,lat2)画图区域,zoom-放大倍数
void DrawContour(double lon0,double lat0,float lon1,float lon2,float lat1,float lat2,double low,double high,double step,double zoom); //(lon0,lat0)左上角经、纬度,(lon2,lat2)画图区域,low-最低值线,high-最高值线,step-线条间隔,zoom-放大倍数
void ScatterContour(int ZCount,float *Z);
void AddPoint(float x,float y,float z);
void LoadFromMicapsFile4(String file);//file-micaps第4类文件
void LoadFromMicapsFile3(String file);//file-micaps第3类文件

__property double zLow={read=FzLow,write=FzLow};
__property double zHigh={read=FzHigh,write=FzHigh};
__property dVertex *Vertexs={read=FVertexs};
__property dTriangle *Triangles={read=FTriangles};
__property int TriangleCount={read=FTriangleCount};
__property int PointCount={read=GetPointCount};
};
///################################################################################
//================================================================================
jone7319 2011-11-01
  • 打赏
  • 举报
回复
我做过画等值线图的,不知是不是你想要,较复杂,需要用到三角网算法
lhy 2011-11-01
  • 打赏
  • 举报
回复
插值,然后把最邻近的等高点连起来。
frp529 2011-11-01
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 lhylhy 的回复:]

插值,然后把最邻近的等高点连起来。
[/Quote]

能说具体一点吗?
是定高的曲线

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧