Files
envi-code/SourceCode/Code2026/tg_shs/shs_subgeLib/TGPoint3D.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

132 lines
2.2 KiB
C++

//-----------------------------------------------------------------------------+
// 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);
}