- UID
- 177683
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-9-23
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
缓和曲线类 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 最后编辑 |
|