71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TPGeCircle Àà ÎÞÏòÔ²
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TPGeCircle ÉùÃ÷ ·½³Ì:x=center.x+radius*cos(t);y=center.y+radius*sin(t)
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#ifndef _TPGECIRCLE_H_
|
|
#define _TPGECIRCLE_H_
|
|
|
|
#ifndef _TGPOINT_H_
|
|
#include "TGPoint.h"
|
|
#endif
|
|
|
|
#ifndef _TPGELINE2D_H_
|
|
#include "TPGeLine2D.h"
|
|
#endif
|
|
|
|
class GEOAPI TPGeCircle
|
|
{
|
|
public:
|
|
TPGeCircle();
|
|
TPGeCircle(const TGPoint& pt,double radius);
|
|
TPGeCircle(const TGPoint& pt0,const TGPoint& pt1,const TGPoint& pt2);
|
|
TPGeCircle(const TGPoint& pt0,const TGPoint& pt1,double angle);
|
|
virtual ~TPGeCircle();
|
|
|
|
void Init(const TGPoint& pt0,const TGPoint& pt1,const TGPoint& pt2);
|
|
void Init(const TGPoint& pt0,const TGPoint& pt1,double angle);
|
|
|
|
bool IsValid() const;
|
|
|
|
int HitTest(const TGPoint& pt) const;
|
|
|
|
void GetDirection(const TGPoint& pt,TGPoint& vt) const;
|
|
void GetDirection(double pa,TGPoint& vt) const;
|
|
|
|
void GetTangent(double pa,TPGeLine2D& line) const;
|
|
|
|
void Pt2Pa(const TGPoint& pt,double& pa) const;
|
|
void Pa2Pt(double pa,TGPoint& pt) const;
|
|
|
|
double Length() const;
|
|
double Area() const;
|
|
double Integration(double pa0,double pa1) const;
|
|
|
|
bool operator == (const TPGeCircle& c) const;
|
|
bool operator != (const TPGeCircle& c) const;
|
|
|
|
int Intersect(const TPGeLine2D& line,TGPoint& pt1,TGPoint& pt2,bool bNormalized = false) const;
|
|
int Intersect(const TPGeCircle& circle,TGPoint& pt1,TGPoint& pt2) const;
|
|
|
|
bool Offset(double nDist);
|
|
|
|
public:
|
|
TGPoint center;
|
|
double r;
|
|
|
|
private:
|
|
void InitCircle2D(const TGPoint&pt0,const TGPoint&pt1,double angle,TGPoint¢er,double&r);
|
|
void InitCircle2D(const TGPoint&pt0,const TGPoint&pt1,const TGPoint&pt2,TGPoint¢er,double&r);
|
|
int CircleInt(const TGPoint¢er1,double r1,const TGPoint¢er2,double r2,TGPoint&pt1,TGPoint&pt2)const;
|
|
|
|
};
|
|
|
|
#endif
|
|
|