day7 – CAD 操作

旋转

// common.h : 
//
/
#if !defined(AFX_ROTATE_H__73DFDF03_3596_48CE_851E_4BD6D70B5495__INCLUDED_)
#define AFX_ROTATE_H__73DFDF03_3596_48CE_851E_4BD6D70B5495__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
const int LINERANGE = 20;
const double PI = 3.14159265358979323846;
#include "math.h"
#include "framework.h"
inline void rotate(CPoint& beginPos, CPoint& endPos, double dblR)
{
    double x = (beginPos.x + endPos.x) / 2.0;
    double y = (beginPos.y + endPos.y) / 2.0;
    CPoint pos;
    pos.x = (long)(   (beginPos.x - x) * cos(dblR) - (beginPos.y - y) * sin(dblR) + x);
    pos.y = ((long)((beginPos.x - x) * sin(dblR) - (beginPos.y - y) * cos(dblR) + y));
    beginPos = pos;
    pos.x = ((long)((endPos.x - x) * cos(dblR) - (endPos.y - y) * sin(dblR) + x));
    pos.y = ((long)((endPos.x - x) * sin(dblR) - (endPos.y - y) * cos(dblR) + y));
    endPos = pos;
}
#endif // !defined(AFX_ROTATE_H__73DFDF03_3596_48CE_851E_4BD6D70B5495__INCLUDED_)

CRgn::PtInRegion

检查 xy 给定的点是否位于对象中存储的区域内 CRgn

BOOL PtInRegion(
    int x,
    int y) const;

BOOL PtInRegion(POINT point) const;

参数

x
指定要测试的点的逻辑 x 坐标。

y
指定要测试的点的逻辑 y 坐标。

情况 的 x 和 y 坐标指定了测试值的点的 x 和 y 坐标。 Point 参数可以是结构,也可以是 POINT CPoint 对象。

返回值

如果点在区域中,则为非零值;否则为0。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值