📄 mathutils.h
字号:
/* * * mathutils.h * Copyright (C) 2006 Michael H. Overlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact at poster_printer@yahoo.com */#ifndef MATHUTILS_H#define MATHUTILS_H#include "types.h"#include <windows.h>#define MICROMETERS_PER_INCH ( (double) 25400.0 )#define MM_PER_INCH ( MICROMETERS_PER_INCH / 1000 )#define INCHES_PER_MM ( 1.0 / MM_PER_INCH )#define INCHES_PER_MICROMETER ( 1.0 / MICROMETERS_PER_INCH )#define AREA(sz) ( (sz).cx * (sz).cy )#define RW(r) ( (r).right - (r).left )#define RH(r) ( (r).bottom - (r).top )#define RoundToLong(x) ( (LONG) ((x) + 0.5) )void AddToPoint(IN OUT POINTD& ptd, IN const POINTD& ptdSrc);void CenterInRect(IN OUT POINTD& ptd, IN const RECTD& rd);void CenterInRect(IN OUT POINT& pt, IN const RECT& r);void CenterInRect(IN OUT RECT& rOut, IN const RECT& rSrc);BOOL EqualPt(const POINT& pt1, const POINT& pt2);BOOL EqualRect(IN const RECTD& rd1, IN const RECTD& rd2);BOOL EqualSz(const SIZE& sz1, const SIZE& sz2);double GetMaxIsoScale(const SIZED &szdFrame, const SIZED& szdImage) ;BOOL IsRectEmpty(IN const RECTD& rd);BOOL IntersectRect(OUT RECTD& rd, IN const RECTD& rd2, IN const RECTD& rd3);::LandscapeRot::LandscapeRot LandscapeRotateBack(::LandscapeRot::LandscapeRot rotDir) ;void LandscapeRotate(OUT RECT& rDest, IN const RECT& rSrc, IN LandscapeRot::LandscapeRot rotDir) ;inline void LandscapeRotate(IN OUT RECT& r, IN ::LandscapeRot::LandscapeRot rotDir) { ::LandscapeRotate(r, r, rotDir); }void LandscapeRotate(OUT RECTD& rdDest, IN const RECTD& rdSrc, IN LandscapeRot::LandscapeRot rotDir) ;inline void LandscapeRotate(IN OUT RECTD& rd, IN ::LandscapeRot::LandscapeRot rotDir) { ::LandscapeRotate(rd, rd, rotDir); }BOOL OffsetRect(OUT RECTD& rd, IN double dx, IN double dy);BOOL PtInRect(IN const RECTD& rd, IN const POINTD& ptd);void SetRect(OUT RECTD& rdDest, IN const POINTD& ptdSrc, IN const SIZED& szdSrc);void SetRect(OUT RECT& rDest, IN const POINT& ptTopLeft, IN const SIZE& sz);void SetRect(OUT RECTD& rdDest, IN double dLeft, double dTop, double dRight, double dBottom);void UnionRect(OUT RECTD& rdDest, IN const RECTD& rdSrc1, IN const RECTD& rdSrc2); // DEST AND A SRC CAN BE SAMEvoid Reflect(OUT RECT& rDest, IN const RECT& rSrc);inline void Reflect(IN OUT RECT& r) { ::Reflect(r, r); }void Reflect(OUT RECTD& rdDest, IN const RECTD& rdSrc);inline void Reflect(IN OUT RECTD& rd) { ::Reflect(rd, rd); }void Reflect(OUT POINT& ptDest, IN const POINT& ptSrc);inline void Reflect(IN OUT POINT&pt) { ::Reflect(pt, pt); }void Reflect(OUT POINTD& ptdDest, IN const POINTD& ptdSrc);inline void Reflect(IN OUT POINTD& ptd) { ::Reflect(ptd, ptd); }void RoundMult(OUT POINT& pt, IN const POINTD& pt1, IN const POINTD& pt2) ;void RoundMult(OUT RECT& rl, IN const RECTD& rd, IN const POINTD& ptd) ;LONG RoundUp(double d) ;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -