You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.2 KiB
C++
103 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "DllDefines.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CMyPoint
|
|
|
|
class UTILITYDLL CMyPoint
|
|
{
|
|
public:
|
|
CMyPoint()
|
|
{
|
|
x = 0;
|
|
y = 0;
|
|
}
|
|
|
|
double x;
|
|
double y;
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CThreePoint
|
|
// x3, y3
|
|
// _______________
|
|
// | |
|
|
// | - |
|
|
// | } |
|
|
// | + __|___- |
|
|
// | | |
|
|
// | | |
|
|
// | + |
|
|
// |_______________|
|
|
//
|
|
// x1, y1 x2, y2
|
|
//
|
|
// dx = x3 - x1 / No of y pt
|
|
// dy = y2 - y1 / No of x pt
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// tan theta = adjacent / opposite = y / x
|
|
// cos theta = adjacent / hypo = x / hypo
|
|
// sine theta = opposite / hypo = y / hypo
|
|
// cotan theta = opposite / adjacent = x / y
|
|
// secant theta = hypo / adjacent = hypo / x
|
|
// cosecant theta = hypo / opposite = hypo / y
|
|
constexpr auto PI = 3.1415926535897932384626433832795;
|
|
constexpr auto RAD_TO_DEGREE = 180 / PI; // 1 RADIAN = 57.29577951
|
|
|
|
class UTILITYDLL CThreePoint
|
|
{
|
|
public:
|
|
CThreePoint();
|
|
|
|
enum
|
|
{
|
|
PT1,
|
|
PT2,
|
|
PT3,
|
|
};
|
|
|
|
double Getx(int iPt);
|
|
|
|
double Gety(int iPt);
|
|
|
|
void Setx(int iPt, double x);
|
|
|
|
void Sety(int iPt, double y);
|
|
|
|
void Setx(double p1, double p2, int iPitchStep = 0);
|
|
|
|
void Setx(double p1, double p2, double p3, int iStep = 0, int iPitchStep = 0);
|
|
|
|
void Sety(double p1, double p2, int iStep = 0);
|
|
|
|
void Sety(double p1, double p2, double p3, int iStep = 0, int iPitchStep = 0);
|
|
|
|
double Pitchx(void);
|
|
|
|
double Pitchy(void);
|
|
|
|
double Dx(void);
|
|
|
|
double Dy(void);
|
|
|
|
double Xcentre(void);
|
|
|
|
double Ycentre(void);
|
|
|
|
// get theta in radian
|
|
double Theta();
|
|
|
|
// get theta in degree
|
|
double ThetaInDegree();
|
|
|
|
double x,
|
|
y;
|
|
|
|
protected:
|
|
CMyPoint pt1,
|
|
pt2,
|
|
pt3;
|
|
CMyPoint delta;
|
|
CMyPoint pitch;
|
|
}; |