218 lines
5.7 KiB
C++
218 lines
5.7 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGGeSurface3D.h
|
|
// = Version : ver2.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: 类的声明
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#ifndef _TGGESURFACE3D_H_
|
|
#define _TGGESURFACE3D_H_
|
|
|
|
#ifndef _TGGEREGION2D_H_
|
|
#include "TGGeRegion2D.h"
|
|
#endif
|
|
|
|
#ifndef _TADSGEPOINT3D_H_
|
|
#include "TADSGePoint3d.h"
|
|
#endif
|
|
|
|
#ifndef _TDPTRLIST_H_
|
|
#include "TDPtrList.h"
|
|
#endif
|
|
|
|
#ifndef _TGGEPOLY3D_H_
|
|
#include "TGGePoly3D.h"
|
|
#endif
|
|
|
|
#ifndef _TGGESURFACE3D_H_
|
|
#include "TGGeSurface3D.h"
|
|
#endif
|
|
|
|
#ifndef _TGGEPOLY2D_H_
|
|
#include "TGGePoly2D.h"
|
|
#endif
|
|
|
|
#ifndef _TGGE3DFACE_H_
|
|
#include "TGGe3DFace.h"
|
|
#endif
|
|
|
|
#ifndef _TGGEREGION2D_H_
|
|
#include "TGGeRegion2D.h"
|
|
#endif
|
|
|
|
#ifndef _TADSGEPOINT3D_H_
|
|
#include "TADSGePoint3d.h"
|
|
#endif
|
|
|
|
#ifndef _TGGELINE_H_
|
|
#include "TGGeLine.h"
|
|
#endif
|
|
|
|
#ifndef _TDPTRLIST_H_
|
|
#include "TDPtrList.h"
|
|
#endif
|
|
|
|
class TGGePFace3D;
|
|
class TGGeAFace3D;
|
|
|
|
//有限边界曲面基类
|
|
class GEOAPI TGGeSurface3D
|
|
{
|
|
public:
|
|
|
|
virtual ~TGGeSurface3D();
|
|
|
|
//转化为平面
|
|
virtual void CreatePFace3D(TDPtrList<TGGePFace3D>& lstFace, double nDiv = 30)const = 0;
|
|
|
|
//反射区域计算
|
|
virtual bool Reflect(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D>& polyRes)const = 0;
|
|
|
|
//阴影计算
|
|
virtual bool GetShadow(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D> & lstPoly,bool bSpeed = false)const = 0;
|
|
|
|
//阴影计算
|
|
virtual bool Project(TVector3D vtLightIn,double nElev,const TGGePFace3D& face,TDPtrList<TGGeRegion2D>& lstPoly)const = 0;
|
|
};
|
|
|
|
|
|
//竖向面(基线为直线段或圆弧)
|
|
class GEOAPI TGGeAFace3D : public TGGeCurveSegment, public TGGeSurface3D
|
|
{
|
|
public:
|
|
|
|
TGGeAFace3D();
|
|
|
|
TGGeAFace3D(TGGeCurveSegment cv,double dThick);
|
|
|
|
TGGeAFace3D(TGGeAFace3D& face);
|
|
|
|
//面上一点处
|
|
double GetTopElev()const;
|
|
|
|
double GetElev()const;
|
|
|
|
TVector3D GetNormal(TADSGePoint3d pt)const;
|
|
|
|
//面上一点处切面
|
|
TGGePlane GetPlane(TADSGePoint3d pt)const;
|
|
|
|
void CreatePFace3D(TGGePFace3D &face)const;
|
|
|
|
virtual void CreatePFace3D(TDPtrList<TGGePFace3D>&lstFace,double nDiv = 30)const;
|
|
|
|
//vtLight都必须是单位向量!
|
|
//阴影计算
|
|
virtual bool GetShadow(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D> &lstPoly,bool bSpeed = false)const;
|
|
|
|
//计算入射角,入射光线与面法向夹角
|
|
double GetAngle(TADSGePoint3d pt,TVector3D vtLight)const;
|
|
|
|
//光线反射,返回false代表无反射
|
|
bool Reflect(TADSGePoint3d pt,TVector3D vtLight,TVector3D &vtRes)const;
|
|
|
|
//是否有反射
|
|
bool IsReflect(TADSGePoint3d pt,TVector3D vtLight)const;
|
|
|
|
//从一点射出的光线与面求交
|
|
bool LightInt(TADSGePoint3d ptFrom,TVector3D vtLight,TADSGePoint3d &ptInt)const;
|
|
|
|
//直线代表入射光线,返回false代表无反射(无阻挡)
|
|
bool Reflect(TGGeLine &lineLight,TGGeLine &lineMirror)const;
|
|
|
|
//本面反射光线投影到水平面
|
|
virtual bool Reflect(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D>& polyRes)const;
|
|
|
|
virtual bool Project(TVector3D vtLightIn,double nElev,const TGGePFace3D& face,TDPtrList<TGGeRegion2D>&lstPoly)const;
|
|
|
|
//光线返回法
|
|
//反射光线是否照射到一点
|
|
bool IsReflectOn(TADSGePoint3d pt,TVector3D vtLightIn,TADSGePoint3d &ptInt,TVector3D &vtLightOut)const;
|
|
|
|
public:
|
|
|
|
double m_fThickness;//厚度
|
|
};
|
|
|
|
|
|
//三维平面多边形
|
|
class GEOAPI TGGePFace3D : public TGGePoly3D, public TGGeSurface3D
|
|
{
|
|
public:
|
|
TGGePFace3D();
|
|
TGGePFace3D(const TGGePoly2D&poly);
|
|
TGGePFace3D(const TGGe3DFace&face);
|
|
|
|
virtual ~TGGePFace3D();
|
|
|
|
virtual bool Reflect(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D>& polyRes)const;
|
|
|
|
virtual void CreatePFace3D(TDPtrList<TGGePFace3D>&lstFace,double nDiv=30)const;
|
|
|
|
//在face遮挡条件下,光线经本面反射,最后在平面上形成的阴影区,考虑了face对入射光线和反射光线的遮挡
|
|
virtual bool Project(TVector3D vtLightIn,double nElev,const TGGePFace3D& face,TDPtrList<TGGeRegion2D>&lstPoly)const;
|
|
|
|
//阴影计算,vtLight都必须是单位向量!
|
|
virtual bool GetShadow(TVector3D vtLightIn,double nElev,TDPtrList<TGGeRegion2D> &lstPoly,bool bSpeed=false)const;
|
|
|
|
//所在平面
|
|
TGGePlane GetPlane()const;
|
|
|
|
//计算入射角,入射光线与面法向夹角
|
|
double GetAngle(TVector3D vtLightIn)const;
|
|
|
|
//光线反射,返回false代表无反射
|
|
bool Reflect(TVector3D vtLightIn,TVector3D&vtLightOut)const;
|
|
|
|
//是否有反射
|
|
bool IsReflect(TVector3D vtLightIn)const;
|
|
|
|
//投影点包含测试
|
|
bool IsInclude(TADSGePoint3d pt)const;
|
|
|
|
//与直线(段)求交
|
|
bool Intersect(const TGGeLine& line,TADSGePoint3d &ptInt)const;
|
|
|
|
//从一点射出的光线与面求交,ptFrom在面上时返回false
|
|
bool LightInt(TADSGePoint3d ptFrom,TVector3D vtLight,TADSGePoint3d &ptInt)const;
|
|
|
|
//直线代表入射光线,返回false代表无反射(无阻挡)
|
|
bool Reflect(TGGeLine &lineLight,TGGeLine&lineMirror)const;
|
|
|
|
//直线代表入射光线,返回false代表无反射(无阻挡),区别在于光线是否有起点
|
|
bool ReflectSunLight(TGGeLine &lineLight,TGGeLine&lineMirror)const;
|
|
|
|
//光线返回法
|
|
//反射光线是否照射到这个点,vtLight是本面入射光线,pt在面上时返回false
|
|
bool IsReflectOn(TADSGePoint3d pt,TVector3D vtLightIn,TVector3D&ptInt,TVector3D&vtLightOut)const;
|
|
|
|
//反射光线是否照射到一系列点,其它同上
|
|
void IsReflectOn(TVector3D vtLightIn,const TDPtrList<TADSGePoint3d> &lstPt,TVector3D& vtLightOut,TDPtrList<bool> &res)const;
|
|
|
|
//光线反射投影
|
|
//本面反射光线投影到水平面
|
|
bool Reflect(TVector3D vtLightIn,double nElev,TVector3D &vtLightOut,TGGePoly2D& polyRes)const;
|
|
|
|
//光线经本面反射投影到faceDest,返回覆盖区域,faceDest不能与this相互切割,重合面不反射
|
|
void Reflect(TVector3D vtLightIn,TGGePFace3D faceDest,TVector3D &vtLightOut,TDPtrList<TGGePFace3D>&faceNewList)const;
|
|
|
|
//光线经本面遮挡而在faceDest造成的阴影区(无反射区)faceDest不能与this相互切割,重合面不遮挡!
|
|
void Project(TVector3D vtLightIn,const TGGePFace3D &faceDest,TDPtrList<TGGePFace3D> &faceNewList)const;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |