105 lines
2.6 KiB
C++
105 lines
2.6 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TPGeCoordSys 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TPGeCoordSys 相对坐标系声明
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _TPGECOORDSYS_H_
|
|
#define _TPGECOORDSYS_H_
|
|
|
|
#ifndef _TGPOINT_H_
|
|
#include "TGPoint.h"
|
|
#endif
|
|
|
|
#ifndef _TGVECTOR3D_H_
|
|
#include "TGVector3D.h"
|
|
#endif
|
|
|
|
#ifndef _TPGEPLANE_H_
|
|
#include "TPGePlane.h"
|
|
#endif
|
|
|
|
class TGMatrix;
|
|
|
|
class GEOAPI TPGeCoordSys
|
|
{
|
|
public:
|
|
|
|
TPGeCoordSys();
|
|
|
|
TPGeCoordSys(const TGPoint& pt,const TGVector3D& z,bool bRight = true);
|
|
|
|
TPGeCoordSys(const TGPoint& pt,const TGVector3D& x,const TGVector3D& y,const TGVector3D& z);
|
|
|
|
TPGeCoordSys(const TGPoint& pt,const TGVector3D& x,const TGVector3D& vt,bool bRight = true);
|
|
|
|
TPGeCoordSys(const TGPoint& pt,const TGPoint& xPt,const TGPoint& yPt,bool bRight = true);
|
|
|
|
TPGeCoordSys(const TPGePlane& plane,bool bRight = true);
|
|
|
|
virtual ~TPGeCoordSys();
|
|
|
|
//设为世界坐标系
|
|
void Reset();
|
|
|
|
void Normalize();
|
|
|
|
void Set(const TGPoint& pt, const TGVector3D& x, const TGVector3D& y, const TGVector3D& z);
|
|
|
|
//以下三个函数如果是右手系,反向叉乘得到未知的两个轴矢量
|
|
void Set(const TGPoint& pt, const TGVector3D& x, const TGVector3D& vt, bool bRight = true);
|
|
|
|
//vt为XY平面上一个取样矢量,影响Z轴方向
|
|
void Set(const TGPoint& pt, const TGPoint& xPt, const TGPoint& yPt, bool bRight = true);
|
|
|
|
//yPt为XY平面上的一个取样点,影响Z轴方向,X轴为Z.GetVertVector()
|
|
void Set(const TGPoint& pt,const TGVector3D& z,bool bRight = true);
|
|
|
|
void Set(const TPGePlane& plane,bool bRight = true);
|
|
|
|
//Z轴为平面法线,XY平面与plane重合,X轴为平面法线GetVertVector()
|
|
void TransformBy(const TGMatrix* pMat);
|
|
|
|
//轴矢量为单位矢量,且轴矢量不平行
|
|
bool IsValid() const;
|
|
|
|
//从世界坐标系向this变换
|
|
void GetMatrixTo(TGMatrix* pMat) const;
|
|
|
|
void TransUcs(TGPoint& pt) const;
|
|
|
|
void TransUcs(TGVector3D& vt) const;
|
|
|
|
//从this向世界坐标变换
|
|
void GetMatrixFrom(TGMatrix* pMat) const;
|
|
|
|
void TransWcs(TGPoint& pt) const;
|
|
|
|
void TransWcs(TGVector3D& vt) const;
|
|
|
|
//世界坐标系在this坐标系中的表示
|
|
void GetWcs(TPGeCoordSys& sys) const;
|
|
|
|
void GetXYPlane(TPGePlane& plane) const;
|
|
|
|
void GetYZPlane(TPGePlane& plane) const;
|
|
|
|
void GetZXPlane(TPGePlane& plane) const;
|
|
|
|
public:
|
|
|
|
//世界坐标系
|
|
static TPGeCoordSys WCS;
|
|
|
|
//原点在世界坐标系下的坐标
|
|
TGPoint origin;
|
|
|
|
//世界坐标系下的单位矢量
|
|
TGVector3D xAxis,yAxis,zAxis;
|
|
};
|
|
|
|
#endif |