Files
envi-code/SourceCode/Code2026/tg_shs/inc/subgeo/TGVector3D.h
T
2026-09-28 15:28:50 +08:00

63 lines
1.8 KiB
C++

//-------------------------------------------------------------------------------------------------------+
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TGVector3D 类
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
// = Description: TGVector3D 声明
// = Maintainers:
//
//-------------------------------------------------------------------------------------------------------+
#ifndef _TGVECTOR3D_H_
#define _TGVECTOR3D_H_
#ifndef _TGPOINT_H_
#include "TGPoint.h"
#endif
class GEOAPI TGVector3D:public TGPoint
{
public:
TGVector3D(double x = 0,double y = 0,double z = 0);
TGVector3D(double *p);
TGVector3D(float*p);
TGVector3D(const TGPoint& pt);
TGVector3D(const TGPoint& fromPt,const TGPoint& toPt);
~TGVector3D();
double Length() const;
bool IsValid() const;
bool IsNullVector() const;
bool IsNormalized() const;
bool Normalize();
void SetVector(double x,double y,double z);
void SetLength(double len);
void Reverse();
TGVector3D operator -() const;
TGVector3D operator +(const TGPoint& vt) const;
TGVector3D operator -(const TGPoint& vt) const;
TGVector3D operator *(double rate) const;
TGVector3D operator /(double rate) const;
TGVector3D operator *(const TGPoint& vt) const;
double operator & (const TGPoint& vt) const;
bool IsParallel(const TGPoint& vt,bool bNormalized = false) const;
bool IsVert(const TGPoint& vt,bool bNormalized = false) const;
//夹角小于90度
bool IsSameDirection(const TGPoint& vt,bool bNormalized = false) const;
//夹角大于90度
bool IsReverseDirection(const TGPoint& vt,bool bNormalized = false) const;
//[0,PI]
double GetAngleWith(const TGPoint& vt,bool bNormalized = false) const;
//空矢量返回false
bool GetVertVector(TGPoint& vt) const;
};
#endif