151 lines
4.2 KiB
C++
151 lines
4.2 KiB
C++
#pragma once
|
|
|
|
class GeCircle;
|
|
class GePlane;
|
|
class GeLine;
|
|
class EntitySet;
|
|
|
|
class ADSGePoint3d
|
|
{
|
|
public:
|
|
ADSGePoint3d(const ads_point src);
|
|
ADSGePoint3d(const AcGePoint3d &src);
|
|
ADSGePoint3d(const AcGePoint2d &src);
|
|
ADSGePoint3d(const AcGeVector3d &src);
|
|
ADSGePoint3d(const AcGeVector2d &src);
|
|
ADSGePoint3d(const ADSGePoint3d &ptFrom, double dDrt, double dDist);
|
|
ADSGePoint3d(ads_real dx = 0.0, ads_real dy = 0.0, ads_real dz = 0.0);
|
|
~ADSGePoint3d();
|
|
|
|
ADSGePoint3d& operator = (const AcGePoint3d &src);
|
|
ADSGePoint3d& operator = (const AcGePoint2d &src);
|
|
ADSGePoint3d& operator = (const AcGeVector3d &src);
|
|
ADSGePoint3d& operator = (const AcGeVector2d &src);
|
|
ADSGePoint3d& operator = (const ADSGePoint3d & pt);
|
|
ADSGePoint3d& operator = (const ads_point pt);
|
|
|
|
void operator > (ads_point pt) const;
|
|
bool operator > (const ADSGePoint3d &pt) const;
|
|
bool operator < (const ADSGePoint3d &pt)const;
|
|
void operator += (const ADSGePoint3d &pt);
|
|
void operator -= (const ADSGePoint3d &pt);
|
|
void operator *= (double dScale);
|
|
void operator /= (double dScale);
|
|
bool operator == (const ADSGePoint3d & pt) const;
|
|
bool operator == (const ads_point pt) const;
|
|
bool operator != (const ADSGePoint3d &pt) const;
|
|
|
|
operator ads_real* () const;
|
|
operator void* () const;
|
|
|
|
ads_real& operator [] (int i);
|
|
ads_real operator [] (int i) const;
|
|
|
|
int operator ! () const;
|
|
|
|
//3D属性;
|
|
//把当前点往线上投影, rp--结果
|
|
int Project(const GeLine* pLine, ads_point rp) const;
|
|
int Project(const GeCircle* pCir, ads_point rp) const;
|
|
int Project(const AcGeLine3d* pLine,ads_point rp) const;
|
|
|
|
ADSGePoint3d Project(const GePlane* pPlan) const;
|
|
|
|
double Distance(const GeLine* pLine) const;
|
|
double Distance(const ADSGePoint3d& pt) const;
|
|
double Distance2d(const ADSGePoint3d& pt) const;
|
|
double Distance(const ADSGePoint3d& ptSta,const ADSGePoint3d& ptEnd) const;
|
|
|
|
void TransformBy(ads_matrix mat);
|
|
void TransformBy(const AcGeMatrix3d& mat);
|
|
ADSGePoint3d TransformAs(ads_matrix mat) const;
|
|
|
|
void GetRotationMatrix(ads_real dRot, ads_matrix mat) const;
|
|
void GetScaleMatrix(ads_real dScale, ads_matrix mat) const;
|
|
void GetScaleMatrix(ads_real sx, ads_real sy, ads_real sz, ads_matrix mat) const;
|
|
void GetMoveMatrix(const ADSGePoint3d& ptDest, ads_matrix mat) const;
|
|
|
|
void Mirror(const ads_point src, ads_point dest) const;
|
|
void Mirror(const ADSGePoint3d& ptSrc, ADSGePoint3d& ptDest) const;
|
|
|
|
void Rotate(ads_real dAng);
|
|
|
|
void Reverse();
|
|
|
|
void Normalize();
|
|
|
|
int Make(LPCTSTR pszLay = NULL) const;
|
|
int Modify(const EntitySet* pEntity) const;
|
|
int MakeEntity(const EntitySet* pEntity) const;
|
|
|
|
ads_real Length() const;
|
|
|
|
void Scale(ads_real dScale);
|
|
|
|
operator const AcGePoint3d & ();
|
|
operator AcGePoint3d & () const;
|
|
AcGePoint3d AsAcGePoint3d() const;
|
|
|
|
operator const AcGeVector3d & ();
|
|
operator AcGeVector3d & () const;
|
|
AcGeVector3d AsAcGeVector3d() const;
|
|
|
|
operator const AcGePoint2d & ();
|
|
operator AcGePoint2d & () const;
|
|
AcGePoint2d AsAcGePoint2d() const;
|
|
|
|
operator const AcGeVector2d & ();
|
|
operator AcGeVector2d & () const;
|
|
AcGeVector2d AsAcGeVector2d() const;
|
|
|
|
void PointTransformBy(ads_matrix xform,ads_point pt,ads_point newpt) const;
|
|
|
|
public:
|
|
|
|
ads_real x,y,z;
|
|
};
|
|
|
|
typedef class ADSGePoint3d Point;
|
|
|
|
typedef class ADSGePoint3d Vector3D;
|
|
|
|
typedef class ADSGePoint3d TVector3D;
|
|
|
|
inline ADSGePoint3d operator + (const ADSGePoint3d & pt1, const ADSGePoint3d & pt2)
|
|
{
|
|
return Point(pt1.x + pt2.x, pt1.y + pt2.y, pt1.z + pt2.z);
|
|
}
|
|
|
|
inline ADSGePoint3d operator - (const ADSGePoint3d & pt1, const ADSGePoint3d & pt2)
|
|
{
|
|
return Point(pt1.x - pt2.x, pt1.y - pt2.y, pt1.z - pt2.z);
|
|
}
|
|
|
|
inline ADSGePoint3d Max(const ADSGePoint3d &pt1, const ADSGePoint3d &pt2)
|
|
{
|
|
ADSGePoint3d upPt;
|
|
upPt.x = max(pt1.x, pt2.x);
|
|
upPt.y = max(pt1.y, pt2.y);
|
|
upPt.z = max(pt1.z, pt2.z);
|
|
return upPt;
|
|
}
|
|
|
|
inline ADSGePoint3d Min(const ADSGePoint3d &pt1, const ADSGePoint3d &pt2)
|
|
{
|
|
ADSGePoint3d lowPt;
|
|
lowPt.x = min(pt1.x, pt2.x);
|
|
lowPt.y = min(pt1.y, pt2.y);
|
|
lowPt.z = min(pt1.z, pt2.z);
|
|
return lowPt;
|
|
}
|
|
|
|
//inline TVector3D operator * (const TVector3D &pt1, const Vector3D &pt2)
|
|
//{
|
|
// TVector3D vt;
|
|
// vt.x = pt1.y * pt2.z - pt1.z * pt2.y;
|
|
// vt.y = pt1.z * pt2.x - pt1.x * pt2.z;
|
|
// vt.z = pt1.x * pt2.y - pt1.y * pt2.x;
|
|
//
|
|
// return vt;
|
|
//}
|