求以知两点坐标画曲线的算法.

MOmo400 2009-03-12 01:29:43
求已知两点坐标画曲线的算法.
坐标A(x1,y1),B(x2,y2)
画一条平滑的曲线连结这两点的算法.谢谢.
C#做.
...全文
506 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhengdaolin 2009-03-16
  • 打赏
  • 举报
回复
仅仅只有两个点的话,你这个问题没有意义
而且你也不说用什么曲线去连
曲线种类很多的
happychou 2009-03-15
  • 打赏
  • 举报
回复
double instance =Math.Sqrt( (p1.X - p2.X) * (p1.X - p2.X) - (p1.Y - p2.Y) * (p1.Y - p2.Y));
是什么意思啊?
听该是double instance =Math.Sqrt( (p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y));吧
MOmo400 2009-03-13
  • 打赏
  • 举报
回复
自己UP
aruaru77 2009-03-13
  • 打赏
  • 举报
回复
mark了
Cherishny 2009-03-13
  • 打赏
  • 举报
回复
PointF[] CurrP = new PointF[2]{A(x1,y1),B(x2,y2)
};

g.DrawCurve(CurvePan, CurrP);
就可以了这是两点的
多的话就这样
List<PointF> list = new List<PointF>();
PointF pt0 = new PointF(x0,y0);
list.add(pt0);
PointF pt2 = new PointF(x1,y1);
list.add(pt1);
PointF pt2 = new PointF(x2,y2);
list.add(pt2);
PointF pt3 = new PointF(x3,y3);
list.add(pt3);
PointF[] ptdfdf = new PointF[list.Count];
list.CopyTo(ptdfdf);
if (ptdfdf.Length > 1)
{
for (int i = 0; i < list.Count; i++)
{
g.DrawCurve(new Pen(cuvecolor), ptdfdf);
}
}


indefectible 2009-03-12
  • 打赏
  • 举报
回复
帮顶,关注
MOmo400 2009-03-12
  • 打赏
  • 举报
回复
多点也是这两个点之间去分呀...
birdlonger 2009-03-12
  • 打赏
  • 举报
回复
应该是多点平滑才有意思吧?
MOmo400 2009-03-12
  • 打赏
  • 举报
回复
曲线问题这么难吗?
zgke 2009-03-12
  • 打赏
  • 举报
回复
帮顶
MOmo400 2009-03-12
  • 打赏
  • 举报
回复
大家进来看看发表意见...
MOmo400 2009-03-12
  • 打赏
  • 举报
回复
Pen CurvePan = new Pen(currentColor, 2);

if(p1.X>p1.X)
{
PointF ptem = new PointF();
ptem=p1;
p1=p2;
p2=ptem;
}

double instance =Math.Sqrt( (p1.X - p2.X) * (p1.X - p2.X) - (p1.Y - p2.Y) * (p1.Y - p2.Y));

int height = Convert.ToInt16( Math.Abs(p1.Y - p2.Y));

int width=Convert.ToInt16( Math.Abs(p1.X - p2.X));

int total = height ;

PointF[] CurrP = new PointF[total];

double R = instance / 2.0f + height / 3.0f;

for (int i = 0; i < total; i++)
{
float x = p1.X +(width/(total+.01f))*i;
float y = p1.Y + (float)Math.Sqrt(R * R - x * x);
PointF pch= new PointF(x, y);
CurrP[i] = pch;


}
g.DrawCurve(CurvePan, CurrP, 0.1f);
我的算法,结果不能连结两点

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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