148 lines
3.5 KiB
C++
148 lines
3.5 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TPGeExtend3D 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TPGeExtend3D 定义
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "TPGeExtend3D.h"
|
|
|
|
TPGeExtend3D::TPGeExtend3D(double xMin,double xMax,double yMin,double yMax,double zMin,double zMax)
|
|
:TPGeExtend2D(xMin,xMax,yMin,yMax),m_zExt(zMin,zMax)
|
|
{
|
|
|
|
}
|
|
|
|
TPGeExtend3D::TPGeExtend3D(const TPGeExtend& xExt,const TPGeExtend& yExt,const TPGeExtend& zExt)
|
|
:TPGeExtend2D(xExt,yExt),m_zExt(zExt)
|
|
{
|
|
|
|
}
|
|
|
|
TPGeExtend3D::~TPGeExtend3D()
|
|
{
|
|
|
|
}
|
|
|
|
void TPGeExtend3D::SetRange(double xMin,double xMax,double yMin,double yMax,double zMin,double zMax)
|
|
|
|
{
|
|
TPGeExtend2D::SetRange(xMin,xMax,yMin,yMax);
|
|
m_zExt.SetRange(zMin,zMax);
|
|
}
|
|
|
|
void TPGeExtend3D::SetRange(const TPGeExtend& xExt,const TPGeExtend& yExt,const TPGeExtend& zExt)
|
|
{
|
|
TPGeExtend2D::SetRange(xExt,yExt);
|
|
m_zExt = zExt;
|
|
}
|
|
|
|
TPGeExtend TPGeExtend3D::GetZExtend() const
|
|
{
|
|
return m_zExt;
|
|
}
|
|
|
|
double TPGeExtend3D::GetDepth() const
|
|
{
|
|
return m_zExt.GetLength();
|
|
}
|
|
|
|
double TPGeExtend3D::GetVolumn() const
|
|
{
|
|
return GetArea() * GetDepth();
|
|
}
|
|
|
|
bool TPGeExtend3D::IsValid() const
|
|
{
|
|
return TPGeExtend2D::IsValid() && m_zExt.IsValid();
|
|
}
|
|
|
|
bool TPGeExtend3D::operator == (const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend2D::operator == (ext) && m_zExt == ext.GetZExtend();
|
|
}
|
|
|
|
bool TPGeExtend3D::operator != (const TPGeExtend3D& ext) const
|
|
{
|
|
return !(*this == ext);
|
|
}
|
|
|
|
bool TPGeExtend3D::operator > (const TPGeExtend3D& ext) const
|
|
{
|
|
return m_zExt > ext.GetZExtend();
|
|
}
|
|
|
|
bool TPGeExtend3D::operator >= (const TPGeExtend3D& ext) const
|
|
{
|
|
return m_zExt >= ext.GetZExtend();
|
|
}
|
|
|
|
bool TPGeExtend3D::operator < (const TPGeExtend3D& ext) const
|
|
{
|
|
return m_zExt < ext.GetZExtend();
|
|
}
|
|
|
|
bool TPGeExtend3D::operator <= (const TPGeExtend3D& ext) const
|
|
{
|
|
return m_zExt <= ext.GetZExtend();
|
|
}
|
|
|
|
bool TPGeExtend3D::IsInclude(double x,double y,double z) const
|
|
{
|
|
return TPGeExtend2D::IsInclude(x,y) && m_zExt.IsInclude(z);
|
|
}
|
|
|
|
bool TPGeExtend3D::IsInclude(const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend2D::IsInclude(ext) && m_zExt.IsInclude(ext.GetZExtend());
|
|
}
|
|
|
|
bool TPGeExtend3D::IsIntersect(const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend2D::IsIntersect(ext) && m_zExt.IsIntersect(ext.GetZExtend());
|
|
}
|
|
|
|
bool TPGeExtend3D::IsConnect(const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend2D::IsConnect(ext) && m_zExt.IsConnect(ext.GetZExtend());
|
|
}
|
|
|
|
bool TPGeExtend3D::IsXYIntersect(const TPGeExtend2D& ext) const
|
|
{
|
|
return TPGeExtend2D::IsIntersect(ext);
|
|
}
|
|
|
|
bool TPGeExtend3D::IsXYConnect(const TPGeExtend2D& ext) const
|
|
{
|
|
return TPGeExtend2D::IsConnect(ext);
|
|
}
|
|
|
|
TPGeExtend3D TPGeExtend3D::operator & (const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend3D(m_xExt & ext.GetXExtend(),m_yExt & ext.GetYExtend(),m_zExt & ext.GetZExtend());
|
|
}
|
|
|
|
TPGeExtend3D TPGeExtend3D::operator +(const TPGeExtend3D& ext) const
|
|
{
|
|
return TPGeExtend3D(m_xExt + ext.GetXExtend(), m_yExt + ext.GetYExtend(),m_zExt + ext.GetZExtend());
|
|
}
|
|
|
|
TPGeExtend3D& TPGeExtend3D::operator += (const TPGeExtend3D& ext)
|
|
{
|
|
m_xExt += ext.GetXExtend();
|
|
m_yExt += ext.GetYExtend();
|
|
m_zExt += ext.GetZExtend();//注意wlw以前没有=号,m_zExt + ext.GetZExtend()
|
|
return *this;
|
|
|
|
}
|
|
|
|
void TPGeExtend3D::Inflate(double d)
|
|
{
|
|
m_xExt.Inflate(d);
|
|
m_yExt.Inflate(d);
|
|
m_zExt.Inflate(d);
|
|
} |