找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1012|回复: 8

[ARX函数]:缓和曲线类(转)

[复制链接]
发表于 2004-10-10 08:25:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
缓和曲线类   9pt 10pt 11pt 12pt 13pt 15pt  

:9
曲线放样是有数学模型的,根据数学模型来计算坐标,下面提供一个类的定义,供参考。
/***
*Engin.hpp - definitions and declarations for additional engineering library
*
* Copyright (c) 2000-2001, By Liurenzhao. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the additional math subroutine library.
*
* [Public]
*
****/

#ifndef _INC_ENGIN_HPP
#define _INC_ENGIN_HPP

///////////////////////////////////
class CircleRoute //圆曲线测设
///////////////////////////////////
{
private:
double radius; //半径(米)
double angle; //偏角(弧度)
char *JDstake; //交点桩号 例如: JDstake[]="K87+441.41"
double step;
bool flag; //左偏为true,右偏为false

public:
CircleRoute(double r,double a, char *stake)
{ radius=r; angle=fabs(a);
if(a>=0) flag=true;
else flag=false;
JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
CircleRoute(double r,double a, double l=10.0)
{ radius=r; angle=fabs(a); step=l;
if(a>=0) flag=true;
else flag=false;
};
CircleRoute(){};
~CircleRoute() { delete JDstake; };

void setRadius(double);
void setAngle(double);
void setJDstake(char *);
void setStep(double);

double getRadius(void);
double getAngle(void);
double getStep(void);
bool getFlag(void);

double getT(void); //切线长
double getL(void); //曲线长
double getE(void); //外矢距
double getq(void); //切曲差

char* getJDstake(void);
char* getZYstake(void);
char* getYZstake(void);
char* getQZstake(void);

bool getCoordinate(AcGePoint3dArray& point3dArray);
} ;

inline void CircleRoute::setRadius(double r) { radius=r; }
inline void CircleRoute::setAngle(double a)
{ angle=fabs(a);
if(a>=0) flag=true;
else flag=false;
}
inline void CircleRoute::setJDstake(char *stake)
{ JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
inline void CircleRoute::setStep(double l) { step=l; }

inline double CircleRoute::getRadius(void) { return(radius); }
inline double CircleRoute::getAngle(void) { return(angle); }
inline double CircleRoute::getStep(void) { return(step); }
inline bool CircleRoute::getFlag(void) { return(flag); }
///////////////////////////////////////////

inline double CircleRoute::getT(void) { return(radius*tan(angle*0.5)); }
inline double CircleRoute::getL(void) { return(angle*radius); }
inline double CircleRoute::getE(void) { return(radius/cos(angle*0.5)-radius); }
inline double CircleRoute::getq(void) { return(2*this->getT()-this->getL()); }
////////////////////////////////////////////

inline char* CircleRoute::getJDstake(void) { return(JDstake); }

inline char* CircleRoute::getZYstake(void)
{ char *ZYstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double zy_km,zy_m,zy,jd;
ZYstake=new char[strlen(JDstake)+1]; ZYstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
zy=jd-this->getT();
zy_km=(int)(zy/1000); zy_m=zy-zy_km*1000;
sprintf(strkm,"%.0lf",zy_km); sprintf(strm, "%.3lf",zy_m );
strcat(ZYstake,"K"); strcat(ZYstake,strkm);
strcat(ZYstake,"+"); strcat(ZYstake,strm);
return(ZYstake);
}

inline char* CircleRoute::getYZstake(void)
{ char *YZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double yz_km,yz_m,yz,jd;
YZstake=new char[strlen(JDstake)+1]; YZstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
yz=jd-this->getT()+this->getL();
yz_km=(int)(yz/1000); yz_m=yz-yz_km*1000;
sprintf(strkm,"%.0lf",yz_km); sprintf(strm, "%.3lf",yz_m );
strcat(YZstake,"K"); strcat(YZstake,strkm);
strcat(YZstake,"+"); strcat(YZstake,strm);
return(YZstake);
}

inline char* CircleRoute::getQZstake(void)
{ char *QZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double qz_km,qz_m,qz,jd;
QZstake=new char[strlen(JDstake)+1]; QZstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
qz=jd-this->getT()+this->getL()*0.5;
qz_km=(int)(qz/1000); qz_m=qz-qz_km*1000;
sprintf(strkm,"%.0lf",qz_km); sprintf(strm, "%.3lf",qz_m );
strcat(QZstake,"K"); strcat(QZstake,strkm);
strcat(QZstake,"+"); strcat(QZstake,strm);
return(QZstake);
}


inline bool CircleRoute::getCoordinate(AcGePoint3dArray& point3dArray)
{ int num,i;
double xi,yi,arc;
AcGePoint3d point3d;

arc=step/radius; num=(int)(angle/arc);
for(i=0;i xi=radius*sin(i*arc);
if(flag==true) yi=radius*(1-cos(i*arc));
else yi=-radius*(1-cos(i*arc));
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
xi=radius*sin(angle);
if(flag==true) yi=radius*(1-cos(angle));
else yi=-radius*(1-cos(angle));
point3d.set(xi,yi,0); point3dArray.append(point3d);
if(point3dArray.length() < 3) return false;
else return true;
}



///////////////////////////////////////
class AllayCircleRoute //缓和曲线测设
///////////////////////////////////////
{
private:
double radius; //半径(米)
double angle; //偏角(弧度)
char *JDstake; //交点桩号 例如: JDstake[]="K87+441.41"
double step;
double allay; //缓和曲线长度
bool flag; //左偏为true,右偏为false

public:
AllayCircleRoute(double r, double a, double L0, char *stake)
{ radius=r; angle=fabs(a); allay=L0;
if(a>=0) flag=true;
else flag=false;
JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
AllayCircleRoute(double r, double a, double L0, double l=10.0)
{ radius=r; angle=fabs(a); allay=L0; step=l;
if(a>=0) flag=true;
else flag=false;
};
AllayCircleRoute(){};
~AllayCircleRoute() { delete JDstake; };

void setRadius(double);
void setAngle(double);
void setAllay(double);
void setJDstake(char *);
void setStep(double);

double getRadius(void);
double getAngle(void);
double getAllay(void);
double getStep(void);
bool getFlag(void);

double getT(void); //切线长
double getL(void); //曲线长
double getE(void); //外矢距
double getq(void); //切曲差

char* getJDstake(void);
char* getZHstake(void);
char* getHYstake(void);
char* getQZstake(void);
char* getZYstake(void);
char* getYHstake(void);
char* getHZstake(void);

bool getCoordinate(AcGePoint3dArray& point3dArray);
} ;

inline void AllayCircleRoute::setRadius(double r) { radius=r; }
inline void AllayCircleRoute::setAngle(double a)
{ angle=a;
if(a>=0) flag=true;
else flag=false;
}
inline void AllayCircleRoute::setAllay(double L0) { allay=L0; }
inline void AllayCircleRoute::setJDstake(char *stake)
{ JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
inline void AllayCircleRoute::setStep(double l) { step=l; }

inline double AllayCircleRoute::getRadius(void) { return(radius); }
inline double AllayCircleRoute::getAngle(void) { return(angle); }
inline double AllayCircleRoute::getAllay(void) { return(allay); }
inline double AllayCircleRoute::getStep(void) { return(step); }
inline bool AllayCircleRoute::getFlag(void) { return(flag); }
///////////////////////////////////////////

inline double AllayCircleRoute::getT(void)
{ double m, p;
m=allay/2.0-pow(allay,3)/(240.0*radius*radius);
p=allay*allay/(24.0*radius);
return(m+(radius+p)*tan(angle*0.5));
}

inline double AllayCircleRoute::getL(void)
{ double b, ang;
b=allay/(2.0*radius); ang=angle-2*b;
return(ang*radius+2*allay);
}

inline double AllayCircleRoute::getE(void)
{ double p=allay*allay/(24.0*radius);
return((radius+p)/cos(angle*0.5)-radius);
}

inline double AllayCircleRoute::getq(void) { return(2*this->getT()-this->getL()); }
////////////////////////////////////////////

inline char* AllayCircleRoute::getJDstake(void) { return(JDstake); }

inline char* AllayCircleRoute::getZHstake(void)//计算直缓点的里程桩号
{ char *ZHstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double zh_km,zh_m,zh,jd;
ZHstake=new char[strlen(JDstake)+1]; ZHstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
zh=jd-this->getT();
zh_km=(int)(zh/1000); zh_m=zh-zh_km*1000;
sprintf(strkm,"%.0lf",zh_km); sprintf(strm, "%.3lf",zh_m );
strcat(ZHstake,"K"); strcat(ZHstake,strkm);
strcat(ZHstake,"+"); strcat(ZHstake,strm);
return(ZHstake);
}

inline char* AllayCircleRoute::getHYstake(void)//计算缓圆点的里程桩号
{ char *HYstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double hy_km,hy_m,hy,zh;
HYstake=new char[strlen(this->getZHstake())+1]; HYstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
hy=zh+allay;
hy_km=(int)(hy/1000); hy_m=hy-hy_km*1000;
sprintf(strkm,"%.0lf",hy_km); sprintf(strm, "%.3lf",hy_m );
strcat(HYstake,"K"); strcat(HYstake,strkm);
strcat(HYstake,"+"); strcat(HYstake,strm);
return(HYstake);
}

inline char* AllayCircleRoute::getQZstake(void)//计算曲中点的里程桩号
{ char *QZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double qz_km,qz_m,qz,zh;
QZstake=new char[strlen(this->getZHstake())+1]; QZstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
qz=zh+this->getL()*0.5;
qz_km=(int)(qz/1000); qz_m=qz-qz_km*1000;
sprintf(strkm,"%.0lf",qz_km); sprintf(strm, "%.3lf",qz_m );
strcat(QZstake,"K"); strcat(QZstake,strkm);
strcat(QZstake,"+"); strcat(QZstake,strm);
return(QZstake);
}

inline char* AllayCircleRoute::getHZstake(void)//计算圆缓直点的里程桩号
{ char *HZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double hz_km,hz_m,hz,zh;
HZstake=new char[strlen(this->getZHstake())+1]; HZstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
hz=zh+this->getL();
hz_km=(int)(hz/1000); hz_m=hz-hz_km*1000;
sprintf(strkm,"%.0lf",hz_km); sprintf(strm, "%.3lf",hz_m );
strcat(HZstake,"K"); strcat(HZstake,strkm);
strcat(HZstake,"+"); strcat(HZstake,strm);
return(HZstake);
}

inline char* AllayCircleRoute::getYHstake(void)//计算圆缓点的里程桩号
{ char *YHstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double yh_km,yh_m,yh,hz;
YHstake=new char[strlen(this->getHZstake())+1]; YHstake[0]='\0';
rzrxstrlist(this->getHZstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
hz=atof(ss[0])*1000+atof(ss[1]);
yh=hz-allay;
yh_km=(int)(yh/1000); yh_m=yh-yh_km*1000;
sprintf(strkm,"%.0lf",yh_km); sprintf(strm, "%.3lf",yh_m );
strcat(YHstake,"K"); strcat(YHstake,strkm);
strcat(YHstake,"+"); strcat(YHstake,strm);
return(YHstake);
}


inline bool AllayCircleRoute::getCoordinate(AcGePoint3dArray& point3dArray)
{ int num,i;
double xi,yi,Li,ai,m,p;
AcGePoint3d point3d;
////缓和曲线坐标计算
num=(int)(allay/step);
for(i=0;i Li=i*step;
xi=Li-pow(Li,5)/(40.0*pow((radius*allay),2));
if(flag==true) yi=pow(Li,3)/(6.0*radius*allay);
else yi=-pow(Li,3)/(6.0*radius*allay);
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
xi=allay-pow(allay,3)/(40.0*radius*radius);
if(flag==true) yi=pow(allay,2)/(6.0*radius);
else yi=-pow(allay,2)/(6.0*radius);
point3d.set(xi,yi,0); point3dArray.append(point3d);

////圆曲线坐标计算
m=allay/2.0-pow(allay,3)/(240.0*radius*radius);
p=pow(allay,2)/(24.0*radius);
num=(int)((this->getL()-2.0*allay)/(2.0*step));
for(i=1;i Li=allay+i*step; ai=(Li-0.5*allay)/radius;
xi=radius*sin(ai)+m;
if(flag==true) yi=radius*(1-cos(ai))+p;
else yi=-radius*(1-cos(ai))+p;
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
ai=(this->getL()-allay)/(2.0*radius);
xi=radius*sin(ai)+m;
if(flag==true) yi=radius*(1-cos(ai))+p;
else yi=-radius*(1-cos(ai))+p;
point3d.set(xi,yi,0); point3dArray.append(point3d);
if(point3dArray.length() < 3) return false;
else return true;
}

////////////////////////////////////////////////////
#endif // _INC_ENGIN_HPP/***
*Engin.hpp - definitions and declarations for additional engineering library
*
* Copyright (c) 2000-2001, By Liurenzhao. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the additional math subroutine library.
*
* [Public]
*
****/

#ifndef _INC_ENGIN_HPP
#define _INC_ENGIN_HPP

///////////////////////////////////
class CircleRoute //圆曲线测设
///////////////////////////////////
{
private:
double radius; //半径(米)
double angle; //偏角(弧度)
char *JDstake; //交点桩号 例如: JDstake[]="K87+441.41"
double step;
bool flag; //左偏为true,右偏为false

public:
CircleRoute(double r,double a, char *stake)
{ radius=r; angle=fabs(a);
if(a>=0) flag=true;
else flag=false;
JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
CircleRoute(double r,double a, double l=10.0)
{ radius=r; angle=fabs(a); step=l;
if(a>=0) flag=true;
else flag=false;
};
CircleRoute(){};
~CircleRoute() { delete JDstake; };

void setRadius(double);
void setAngle(double);
void setJDstake(char *);
void setStep(double);

double getRadius(void);
double getAngle(void);
double getStep(void);
bool getFlag(void);

double getT(void); //切线长
double getL(void); //曲线长
double getE(void); //外矢距
double getq(void); //切曲差

char* getJDstake(void);
char* getZYstake(void);
char* getYZstake(void);
char* getQZstake(void);

bool getCoordinate(AcGePoint3dArray& point3dArray);
} ;

inline void CircleRoute::setRadius(double r) { radius=r; }
inline void CircleRoute::setAngle(double a)
{ angle=fabs(a);
if(a>=0) flag=true;
else flag=false;
}
inline void CircleRoute::setJDstake(char *stake)
{ JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
inline void CircleRoute::setStep(double l) { step=l; }

inline double CircleRoute::getRadius(void) { return(radius); }
inline double CircleRoute::getAngle(void) { return(angle); }
inline double CircleRoute::getStep(void) { return(step); }
inline bool CircleRoute::getFlag(void) { return(flag); }
///////////////////////////////////////////

inline double CircleRoute::getT(void) { return(radius*tan(angle*0.5)); }
inline double CircleRoute::getL(void) { return(angle*radius); }
inline double CircleRoute::getE(void) { return(radius/cos(angle*0.5)-radius); }
inline double CircleRoute::getq(void) { return(2*this->getT()-this->getL()); }
////////////////////////////////////////////

inline char* CircleRoute::getJDstake(void) { return(JDstake); }

inline char* CircleRoute::getZYstake(void)
{ char *ZYstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double zy_km,zy_m,zy,jd;
ZYstake=new char[strlen(JDstake)+1]; ZYstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
zy=jd-this->getT();
zy_km=(int)(zy/1000); zy_m=zy-zy_km*1000;
sprintf(strkm,"%.0lf",zy_km); sprintf(strm, "%.3lf",zy_m );
strcat(ZYstake,"K"); strcat(ZYstake,strkm);
strcat(ZYstake,"+"); strcat(ZYstake,strm);
return(ZYstake);
}

inline char* CircleRoute::getYZstake(void)
{ char *YZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double yz_km,yz_m,yz,jd;
YZstake=new char[strlen(JDstake)+1]; YZstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
yz=jd-this->getT()+this->getL();
yz_km=(int)(yz/1000); yz_m=yz-yz_km*1000;
sprintf(strkm,"%.0lf",yz_km); sprintf(strm, "%.3lf",yz_m );
strcat(YZstake,"K"); strcat(YZstake,strkm);
strcat(YZstake,"+"); strcat(YZstake,strm);
return(YZstake);
}

inline char* CircleRoute::getQZstake(void)
{ char *QZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double qz_km,qz_m,qz,jd;
QZstake=new char[strlen(JDstake)+1]; QZstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
qz=jd-this->getT()+this->getL()*0.5;
qz_km=(int)(qz/1000); qz_m=qz-qz_km*1000;
sprintf(strkm,"%.0lf",qz_km); sprintf(strm, "%.3lf",qz_m );
strcat(QZstake,"K"); strcat(QZstake,strkm);
strcat(QZstake,"+"); strcat(QZstake,strm);
return(QZstake);
}


inline bool CircleRoute::getCoordinate(AcGePoint3dArray& point3dArray)
{ int num,i;
double xi,yi,arc;
AcGePoint3d point3d;

arc=step/radius; num=(int)(angle/arc);
for(i=0;i xi=radius*sin(i*arc);
if(flag==true) yi=radius*(1-cos(i*arc));
else yi=-radius*(1-cos(i*arc));
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
xi=radius*sin(angle);
if(flag==true) yi=radius*(1-cos(angle));
else yi=-radius*(1-cos(angle));
point3d.set(xi,yi,0); point3dArray.append(point3d);
if(point3dArray.length() < 3) return false;
else return true;
}



///////////////////////////////////////
class AllayCircleRoute //缓和曲线测设
///////////////////////////////////////
{
private:
double radius; //半径(米)
double angle; //偏角(弧度)
char *JDstake; //交点桩号 例如: JDstake[]="K87+441.41"
double step;
double allay; //缓和曲线长度
bool flag; //左偏为true,右偏为false

public:
AllayCircleRoute(double r, double a, double L0, char *stake)
{ radius=r; angle=fabs(a); allay=L0;
if(a>=0) flag=true;
else flag=false;
JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
AllayCircleRoute(double r, double a, double L0, double l=10.0)
{ radius=r; angle=fabs(a); allay=L0; step=l;
if(a>=0) flag=true;
else flag=false;
};
AllayCircleRoute(){};
~AllayCircleRoute() { delete JDstake; };

void setRadius(double);
void setAngle(double);
void setAllay(double);
void setJDstake(char *);
void setStep(double);

double getRadius(void);
double getAngle(void);
double getAllay(void);
double getStep(void);
bool getFlag(void);

double getT(void); //切线长
double getL(void); //曲线长
double getE(void); //外矢距
double getq(void); //切曲差

char* getJDstake(void);
char* getZHstake(void);
char* getHYstake(void);
char* getQZstake(void);
char* getZYstake(void);
char* getYHstake(void);
char* getHZstake(void);

bool getCoordinate(AcGePoint3dArray& point3dArray);
} ;

inline void AllayCircleRoute::setRadius(double r) { radius=r; }
inline void AllayCircleRoute::setAngle(double a)
{ angle=a;
if(a>=0) flag=true;
else flag=false;
}
inline void AllayCircleRoute::setAllay(double L0) { allay=L0; }
inline void AllayCircleRoute::setJDstake(char *stake)
{ JDstake=new char[strlen(stake)+1];
strcpy(JDstake,_strupr(strdup(stake)));
};
inline void AllayCircleRoute::setStep(double l) { step=l; }

inline double AllayCircleRoute::getRadius(void) { return(radius); }
inline double AllayCircleRoute::getAngle(void) { return(angle); }
inline double AllayCircleRoute::getAllay(void) { return(allay); }
inline double AllayCircleRoute::getStep(void) { return(step); }
inline bool AllayCircleRoute::getFlag(void) { return(flag); }
///////////////////////////////////////////

inline double AllayCircleRoute::getT(void)
{ double m, p;
m=allay/2.0-pow(allay,3)/(240.0*radius*radius);
p=allay*allay/(24.0*radius);
return(m+(radius+p)*tan(angle*0.5));
}

inline double AllayCircleRoute::getL(void)
{ double b, ang;
b=allay/(2.0*radius); ang=angle-2*b;
return(ang*radius+2*allay);
}

inline double AllayCircleRoute::getE(void)
{ double p=allay*allay/(24.0*radius);
return((radius+p)/cos(angle*0.5)-radius);
}

inline double AllayCircleRoute::getq(void) { return(2*this->getT()-this->getL()); }
////////////////////////////////////////////

inline char* AllayCircleRoute::getJDstake(void) { return(JDstake); }

inline char* AllayCircleRoute::getZHstake(void)//计算直缓点的里程桩号
{ char *ZHstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double zh_km,zh_m,zh,jd;
ZHstake=new char[strlen(JDstake)+1]; ZHstake[0]='\0';
rzrxstrlist(JDstake,'K',sk); rzrxstrlist(sk[1],'+',ss);
jd=atof(ss[0])*1000+atof(ss[1]);
zh=jd-this->getT();
zh_km=(int)(zh/1000); zh_m=zh-zh_km*1000;
sprintf(strkm,"%.0lf",zh_km); sprintf(strm, "%.3lf",zh_m );
strcat(ZHstake,"K"); strcat(ZHstake,strkm);
strcat(ZHstake,"+"); strcat(ZHstake,strm);
return(ZHstake);
}

inline char* AllayCircleRoute::getHYstake(void)//计算缓圆点的里程桩号
{ char *HYstake,strkm[6],strm[10],sk[2][32],ss[2][32];
double hy_km,hy_m,hy,zh;
HYstake=new char[strlen(this->getZHstake())+1]; HYstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
hy=zh+allay;
hy_km=(int)(hy/1000); hy_m=hy-hy_km*1000;
sprintf(strkm,"%.0lf",hy_km); sprintf(strm, "%.3lf",hy_m );
strcat(HYstake,"K"); strcat(HYstake,strkm);
strcat(HYstake,"+"); strcat(HYstake,strm);
return(HYstake);
}

inline char* AllayCircleRoute::getQZstake(void)//计算曲中点的里程桩号
{ char *QZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double qz_km,qz_m,qz,zh;
QZstake=new char[strlen(this->getZHstake())+1]; QZstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
qz=zh+this->getL()*0.5;
qz_km=(int)(qz/1000); qz_m=qz-qz_km*1000;
sprintf(strkm,"%.0lf",qz_km); sprintf(strm, "%.3lf",qz_m );
strcat(QZstake,"K"); strcat(QZstake,strkm);
strcat(QZstake,"+"); strcat(QZstake,strm);
return(QZstake);
}

inline char* AllayCircleRoute::getHZstake(void)//计算圆缓直点的里程桩号
{ char *HZstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double hz_km,hz_m,hz,zh;
HZstake=new char[strlen(this->getZHstake())+1]; HZstake[0]='\0';
rzrxstrlist(this->getZHstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
zh=atof(ss[0])*1000+atof(ss[1]);
hz=zh+this->getL();
hz_km=(int)(hz/1000); hz_m=hz-hz_km*1000;
sprintf(strkm,"%.0lf",hz_km); sprintf(strm, "%.3lf",hz_m );
strcat(HZstake,"K"); strcat(HZstake,strkm);
strcat(HZstake,"+"); strcat(HZstake,strm);
return(HZstake);
}

inline char* AllayCircleRoute::getYHstake(void)//计算圆缓点的里程桩号
{ char *YHstake,strkm[5],strm[10],sk[2][32],ss[2][32];
double yh_km,yh_m,yh,hz;
YHstake=new char[strlen(this->getHZstake())+1]; YHstake[0]='\0';
rzrxstrlist(this->getHZstake(),'K',sk); rzrxstrlist(sk[1],'+',ss);
hz=atof(ss[0])*1000+atof(ss[1]);
yh=hz-allay;
yh_km=(int)(yh/1000); yh_m=yh-yh_km*1000;
sprintf(strkm,"%.0lf",yh_km); sprintf(strm, "%.3lf",yh_m );
strcat(YHstake,"K"); strcat(YHstake,strkm);
strcat(YHstake,"+"); strcat(YHstake,strm);
return(YHstake);
}


inline bool AllayCircleRoute::getCoordinate(AcGePoint3dArray& point3dArray)
{ int num,i;
double xi,yi,Li,ai,m,p;
AcGePoint3d point3d;
////缓和曲线坐标计算
num=(int)(allay/step);
for(i=0;i Li=i*step;
xi=Li-pow(Li,5)/(40.0*pow((radius*allay),2));
if(flag==true) yi=pow(Li,3)/(6.0*radius*allay);
else yi=-pow(Li,3)/(6.0*radius*allay);
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
xi=allay-pow(allay,3)/(40.0*radius*radius);
if(flag==true) yi=pow(allay,2)/(6.0*radius);
else yi=-pow(allay,2)/(6.0*radius);
point3d.set(xi,yi,0); point3dArray.append(point3d);

////圆曲线坐标计算
m=allay/2.0-pow(allay,3)/(240.0*radius*radius);
p=pow(allay,2)/(24.0*radius);
num=(int)((this->getL()-2.0*allay)/(2.0*step));
for(i=1;i Li=allay+i*step; ai=(Li-0.5*allay)/radius;
xi=radius*sin(ai)+m;
if(flag==true) yi=radius*(1-cos(ai))+p;
else yi=-radius*(1-cos(ai))+p;
point3d.set(xi,yi,0);
point3dArray.append(point3d);
}
ai=(this->getL()-allay)/(2.0*radius);
xi=radius*sin(ai)+m;
if(flag==true) yi=radius*(1-cos(ai))+p;
else yi=-radius*(1-cos(ai))+p;
point3d.set(xi,yi,0); point3dArray.append(point3d);
if(point3dArray.length() < 3) return false;
else return true;
}

////////////////////////////////////////////////////
#endif // _INC_ENGIN_HPP  




由 XDSoft 于 2002年09月18日 18:20 最后编辑
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2005-7-24 18:08:42 | 显示全部楼层
不介绍一下?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2005-7-24 19:38:15 | 显示全部楼层
看不懂,那个高手能转道vb上?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-3-18 03:53:28 | 显示全部楼层
我真的是看不懂啊
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-3-18 18:37:05 | 显示全部楼层
是不是CAD里面画缓和曲线的
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-3-28 22:12:45 | 显示全部楼层
太深奥了
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-5-11 08:12:53 | 显示全部楼层

谢谢
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-5-11 12:45:13 | 显示全部楼层
没学过这程序,看不懂呀,高手请仔细介绍下
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2006-5-19 20:12:32 | 显示全部楼层
能介绍一下吗?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-12-23 10:12 , Processed in 0.455549 second(s), 47 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表