高分求助!用求逼近点的方法,画椭圆和圆弧。

hardstudylulin 2003-02-20 01:08:20
不用CDC类库中的画椭圆和圆弧的函数来画,而是求出椭圆和圆上的逼近点,然后连接各个逼点形成椭圆和圆弧!
如有算法或现成的例子,请发到:hardlulin@163.com
万分感谢!
...全文
72 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hailong0108 2003-02-21
  • 打赏
  • 举报
回复
椭圆用这个方程:
x(t) = (ax* t*t + bx * t + cx)/(1 + t*t)
y(t) = (ay* t*t + by * t + cy)/(1 + t*t)
t[0,1];的参数
cx = x0;
cy = y0;
bx = -2*x0 + 2* x1;
by = -2*y0 + 2* y1;
ax = x0 -2*x1 + 2*x2;
ay = y0 -2*y1 + 2*y2;
第一点 x0,y0;
第二点 x1,y1;
第三点 x2,y2;
hailong0108 2003-02-21
  • 打赏
  • 举报
回复
用这个方程:
先定出每一段的长度。由半径及长度就可求出每次所转的角度, 在做个函数求每一点绕圆心旋转所成的点;
大体思路就是这样的。你在整理一下。
我给你一个旋转函数。
/**********************************************************************************
名称: Rotate()
时间: 2003.1.20
参数: point1 要转的点,pointCenter 旋转中心。Angle 旋转角(弧度) + 为逆时针 - 顺时针
返回值:point
说明: 求绕某点的旋转点
/************************************************************************************/

void Rotate(CPoint point1,CPoint pointCenter,double Angle,CPoint& point)
{
Angle = Angle*180/3.1415926;
double O1,O;
O1=atan(fabs((double)(point1.y - pointCenter.y)/(point1.x - pointCenter.x)));//#include <math.h>
//判断两点的相对位置
//在坐标轴上的情况
if(point1.y == pointCenter.y && point1.x > pointCenter.x) //0度角
{
O1 = 0;
}
else if(point1.y > pointCenter.y && point1.x == pointCenter.x) //90度角
{
O1 = 90;
}
else if(point1.y == pointCenter.y && point1.x < pointCenter.x) //180度角
{
O1 = 180;
}
else if(point1.y < pointCenter.y && point1.x ==pointCenter.x) //270度角
{
O1 = 270;
}
else if(point1.x > pointCenter.x && point1.y > pointCenter.y) //the first quadrant
{
O1 = O1*180/3.1415926;
}
else if(point1.x < pointCenter.x && point1.y > pointCenter.y) //the secondly quadrant
{
O1 = 180-O1*180/3.1415926;
}
else if(point1.x < pointCenter.x && point1.y < pointCenter.y) //the third quadrant
{
O1= 180+O1*180/3.1415926;
}
else //the forthly quadrant
{
O1= 360-O1*180/3.1415926;
}
double L=sqrt((point1.x - pointCenter.x)*(point1.x - pointCenter.x)+(point1.y - pointCenter.y)*(point1.y - pointCenter.y));
O=(O1-Angle)/180*3.1415926;
point.x = (long)(pointCenter.x + L*cos(O));//加入#include <math.h>
point.y = (long)(pointCenter.y + L*sin(O));
}

zswzwy 2003-02-20
  • 打赏
  • 举报
回复
这个吗,。。。我也不清楚,搜一下吧。
hailong0108 2003-02-20
  • 打赏
  • 举报
回复
这个我能帮你查一下,现在我也在研究这个方向。

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧