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

210 lines
3.5 KiB
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TPGeCurve3D.cpp
// = Version : ver2.0
// = Author : xlc
// = CreateDate : 2002-09-09
// = Description: 类的定义
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#include "StdAfx.h"
#include "TPGeCurve3D.h"
#include "TPGeFace3D.h"
#include "TGPoint3D.h"
IMPLEMENT_RUN_TIME_CLASS1(TPGeCurve3D,"TPGeCurve3D",TGObject3D)
TPGeCurve3D::~TPGeCurve3D()
{
}
bool TPGeCurve3D::IsInclude(const TGObject&obj) const
{
if(IS_CLASS(&obj,TPGeFace3D))
{
return false;
}
else
{
return TGObject3D::IsInclude(obj);
}
}
double TPGeCurve3D::Length() const
{
TGObjectList oList;
double dLength = 0;
if(Explode(oList))
{
for(oList.MoveToFirst();!oList.IsOut();oList.MoveToNext())
{
dLength += oList.GetCurCurve3D().Length();
}
}
return dLength;
}
bool TPGeCurve3D::IsClosed() const
{
TGPoint3D pt0,pt1;
GetStartPoint(pt0);
GetEndPoint(pt1);
return pt0 == pt1;
}
bool TPGeCurve3D::IsConnect(const TPGeCurve3D&seg) const
{
if(!IsFinite(false) || !seg.IsFinite(true))
{
return false;
}
TGPoint3D pt0,pt1;
GetEndPoint(pt0);
seg.GetStartPoint(pt1);
return pt0 == pt1;
}
void TPGeCurve3D::Split(const TTable<double>&paTable,TGObjectList&res) const
{
if(paTable.IsEmpty())
{
return;
}
if(IsClosed())
{
if(paTable.GetLength() == 1)
{
res << GetSubCurve(paTable.GetAt(0),paTable.GetAt(0));
}
else
{
for(long i = 1; i < paTable.GetLength(); i++)
{
if(DOWN_ZERO(paTable.GetAt(i - 1) - paTable.GetAt(i)))
{
res << GetSubCurve(paTable.GetAt(i - 1),paTable.GetAt(i));
}
}
double last = paTable.GetAt(i - 1);
if(DOWN_ZERO(last - 1) || UP_ZERO(paTable.GetAt(0)))
{
res << GetSubCurve(last,paTable.GetAt(0));
}
}
}
else
{
if(UP_ZERO(paTable.GetAt(0)))
{
res << GetSubCurve(0,paTable.GetAt(0));
}
for(long i = 1;i < paTable.GetLength();i++)
{
if(DOWN_ZERO(paTable.GetAt(i - 1) - paTable.GetAt(i)))
{
res << GetSubCurve(paTable.GetAt(i - 1),paTable.GetAt(i));
}
}
if(DOWN_ZERO(paTable.GetAt(i - 1) - 1))
{
res << GetSubCurve(paTable.GetAt(i - 1), 1);
}
}
}
void TPGeCurve3D::GetStartPoint(TGPoint&pt) const
{
Pa2Pt(0,pt);
}
void TPGeCurve3D::GetEndPoint(TGPoint&pt) const
{
Pa2Pt(1,pt);
}
void TPGeCurve3D::GetMidPoint(TGPoint&pt) const
{
Pa2Pt(0.5,pt);
}
bool TPGeCurve3D::IsCurveSeg() const
{
return IsFinite(true) && IsFinite(false);
}
bool TPGeCurve3D::IsFinite() const
{
return IsCurveSeg() || IsClosed();
}
bool TPGeCurve3D::IsInfinite() const
{
return !IsClosed() && !IsFinite(true) && !IsFinite(false);
}
bool TPGeCurve3D::IsFinite(bool bStart) const
{
return true;
}
bool TPGeCurve3D::IsSelfCross() const
{
return false;
}
//由曲线参数得到点
void TPGeCurve3D::Pa2Pt(double pa,TGPoint&pt) const
{
}
//由点得到曲线参数,适用于非自交时!
void TPGeCurve3D::Pt2Pa(const TGPoint&pt,double&pa) const
{
}
double TPGeCurve3D::Area() const
{
return 0;
}
//反向
void TPGeCurve3D::Reverse()
{
}
TGMLine3D* TPGeCurve3D::MLinearize(double paDist/* = 0*/) const
{
return NULL;
}
//取线型化的默认精度
double TPGeCurve3D::GetMLinePrec() const
{
return 0;
}
TPGeCurve3D* TPGeCurve3D::GetSubCurve(double pa0,double pa1) const
{
return NULL;
}
TGPoint TPGeCurve3D::GetSamplePoint() const
{
TGPoint pt;
GetMidPoint(pt);
return pt;
}