//-----------------------------------------------------------------------------+ // Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd. // = FileName : TGPoint3D.cpp // = Version : ver2.0 // = Author : xlc // = CreateDate : 2002-09-09 // = Description: ÀàµÄ¶¨Òå // = Maintainers: // //-----------------------------------------------------------------------------+ #include "StdAfx.h" #include "TGPoint3D.h" #include "TPGeCurve3D.h" #include "TPGeFace3D.h" #include "TGSolid.h" #include "TGPoint2D.h" IMPLEMENT_RUN_TIME_CLASS1(TGPoint3D,"TGPoint3D",TGObject3D) TGPoint3D::TGPoint3D(double X,double Y,double Z) : TGPoint(X,Y,Z) { } TGPoint3D::TGPoint3D(double *p) : TGPoint(p) { } TGPoint3D::TGPoint3D(float *p) : TGPoint(p) { } TGPoint3D::TGPoint3D(const TGPoint&pt) : TGPoint(pt) { } TGPoint3D::~TGPoint3D() { } double TGPoint3D::Distance(const TGPoint&pt) const { return TchSubPrivate::Distance3D(*this,pt); } bool TGPoint3D::IsValid() const { return true; } void TGPoint3D::TransformBy(const TGMatrix&matrix) { matrix.Transform3D(*this); } TGObject * TGPoint3D::Clone() const { return new TGPoint3D(*this); } GRelation TGPoint3D::HitTest(const TGPoint&pt) const { return *this == pt?GR_IN:GR_OUT; } bool TGPoint3D::GetExtend3D(TPGeExtend3D& ext) const { ext.SetRange(x,x,y,y,z,z); return true; } bool TGPoint3D::GetExtend2D(TPGeExtend2D& ext) const { ext.SetRange(x,x,y,y); return true; } TGPoint TGPoint3D::GetSamplePoint() const { return *this; } bool TGPoint3D::Intersect(const TGObject&obj,TGObjectList&res) const { if (IS_TYPE(&obj,TGPoint3D)) { if (*this == (const TGPoint3D&)obj) { res << new TGPoint3D(*this); return true; } else { return false; } } else if (obj.HitTest(*this).Is(GR_IN)) { res << new TGPoint3D(*this); return true; } return false; } bool TGPoint3D::IsInclude(const TGObject&obj) const { if (IS_TYPE(&obj,TGPoint3D)) { return *this == (const TGPoint3D&)obj; } else if (IS_CLASS(&obj,TPGeCurve3D) || IS_CLASS(&obj,TPGeFace3D) || IS_CLASS(&obj,TGSolid)) { return false; } else { return TGObject3D::IsInclude(obj); } } TGObject2D *TGPoint3D::Convert2D() const { return new TGPoint2D(*this); }