94 lines
1.8 KiB
C++
94 lines
1.8 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGObject3D.cpp
|
|
// = Version : ver2.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: 类的定义
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "TGObject3D.h"
|
|
#include "TGPoint3D.h"
|
|
|
|
IMPLEMENT_RUN_TIME_CLASS1(TGObject3D,"TGObject3D",TGObject)
|
|
|
|
|
|
TGObject3D::~TGObject3D()
|
|
{
|
|
|
|
}
|
|
|
|
bool TGObject3D::IsInclude(const TGObject&obj) const
|
|
{
|
|
if(IS_TYPE(&obj,TGPoint3D))
|
|
{
|
|
return HitTest((const TGPoint3D&)obj).Is(GR_IN);
|
|
}
|
|
else
|
|
{
|
|
return TGObject::IsInclude(obj);
|
|
}
|
|
}
|
|
|
|
//投影XY平面上的二维实体
|
|
TGObject2D * TGObject3D::Convert2D() const
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
//如果在一个平面上,返回之
|
|
bool TGObject3D::GetPlane(TPGePlane&plane) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
void TGObject3D::Move(double cx,double cy,double cz)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateMoveMatrix(cx,cy,cz);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::Scale(double sx,double sy,double sz)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateScaleMatrix(sx,sy,sz);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::Scale(double sx,double sy,double sz,const TGPoint& basePoint)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateScaleMatrix(sx,sy,sz,basePoint);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::RotateX(double angle)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateXRotateMatrix(angle);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::RotateY(double angle)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateYRotateMatrix(angle);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::RotateZ(double angle)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateZRotateMatrix(angle);
|
|
TransformBy(mat);
|
|
}
|
|
|
|
void TGObject3D::Rotate(double angle,TPGeLine3D& axis)
|
|
{
|
|
TGMatrix mat;
|
|
mat.CreateRotateMatrix(angle,axis);
|
|
TransformBy(mat);
|
|
} |