椭圆的排列算法 参考:http://school.itzcn.com/special-spid-12.html上面有关于这方面的信息,楼主可以看看,希望对你有所帮助。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 也许我语文不够好吧看不懂你的题目>.<能不能画个草图说明下... 条件不是很清楚如果矩形形状相同,而且是刚好放进去的话那椭圆的高可以通过方程求出来假设矩形宽是a,高是b,间距是c,椭圆'宽'是x1,'高'是y1.那么(a, b*N+c*(N-1)/2 )这个点在椭圆上,直接带入椭圆方程就可以得到这个椭圆的参数椭圆参数有了那么每个矩形的位置也就可以固定了…… 问题已经解决了,现在才贴出来,希望有遇到类似问题的朋友有一点帮助//该项目中有输入和输出两种模块,Input是输入模块,显示在椭圆的左半圆, //Output是输出模块,显示在椭圆的右半圆。 //graphWidth 当前模块的宽, graphHeight当前模块的高 Point center = new Point(graphWidth / 2, graphHeight / 2); //输入/输出小方块边长 //int sideLength = 10; double radiusX = (graphWidth - inOutHeight) * 0.5; double radiusY = (graphHeight - inOutHeight) * 0.5; double x = 0; double y = 0; foreach (Input ef in InputCollection) { inputIndex++; double inputAngle; if (inputCount > 1) { inputAngle = 2 * Math.PI / (inputCount + outputCount); // 位置 double angle = inputIndex * inputAngle / 2; x = center.X - radiusX * Math.Sin(angle) - inOutHeight; y = center.Y + radiusY * Math.Cos(angle) - inOutHeight; } else { inputAngle = 2 * Math.PI / inputCount; // 位置 double angle = inputIndex * inputAngle; x = center.X - radiusX * Math.Cos(angle) - inOutHeight / 2; y = center.Y - radiusY * Math.Sin(angle) - inOutHeight / 2; } ef.PositionX = x + graphLeft; ef.PositionY = y + graphTop; Canvas.SetLeft(ef, ef.PositionX); Canvas.SetTop(ef, ef.PositionY); } foreach (Output ef in OutputCollection) { outputIndex++; double outputAngle; if (outputCount > 1) { outputAngle = 2 * Math.PI / (inputCount + outputCount); // 位置 double angle = outputIndex * outputAngle / 2; x = center.X + radiusX * Math.Sin(angle) - inOutHeight; y = center.Y + radiusY * Math.Cos(angle) - inOutHeight; } else { outputAngle = 2 * Math.PI / outputCount; // 位置 double angle = outputIndex * outputAngle; x = center.X + radiusX * Math.Cos(angle) - inOutHeight / 2; y = center.Y + radiusY * Math.Sin(angle) - inOutHeight / 2; } ef.PositionX = x + graphLeft; ef.PositionY = y + graphTop; Canvas.SetLeft(ef, ef.PositionX); Canvas.SetTop(ef, ef.PositionY); } 请问C#有没有办法使用7z对文件进行压缩? 帮忙写条sql语句 五彩色连珠游戏 急!急!急!哪位好心人帮帮小弟啊!!!!!万分感谢!!!!!!!!!! IE Web Control問題? 检测 keyup 事件 请高手指教 我是一个C#的初学者,问个简单的问题!!!即时结贴给分。 请教:c#实现修改mssql数据库的大小 同一个页面中,选择一个下拉选择框后,要求在同一页面的ID框中显示显示同一数据表中下拉选择项对应的ID号? 如何在客户端浏览器自动下载用c#(vb.net)编写的控件? c#中想让textbox控件多次或者焦点并自动选中其中的文本 目前C#最流行的技术是什么呀
看不懂你的题目>.<
能不能画个草图说明下...
如果矩形形状相同,而且是刚好放进去的话
那椭圆的高可以通过方程求出来
假设矩形宽是a,高是b,间距是c,椭圆'宽'是x1,'高'是y1.那么(a, b*N+c*(N-1)/2 )这个点在椭圆上,直接带入椭圆方程就可以得到这个椭圆的参数椭圆参数有了那么每个矩形的位置也就可以固定了……
//Output是输出模块,显示在椭圆的右半圆。
//graphWidth 当前模块的宽, graphHeight当前模块的高
Point center = new Point(graphWidth / 2, graphHeight / 2); //输入/输出小方块边长
//int sideLength = 10; double radiusX = (graphWidth - inOutHeight) * 0.5;
double radiusY = (graphHeight - inOutHeight) * 0.5; double x = 0;
double y = 0; foreach (Input ef in InputCollection)
{
inputIndex++;
double inputAngle;
if (inputCount > 1)
{
inputAngle = 2 * Math.PI / (inputCount + outputCount);
// 位置
double angle = inputIndex * inputAngle / 2;
x = center.X - radiusX * Math.Sin(angle) - inOutHeight;
y = center.Y + radiusY * Math.Cos(angle) - inOutHeight;
}
else
{
inputAngle = 2 * Math.PI / inputCount;
// 位置
double angle = inputIndex * inputAngle;
x = center.X - radiusX * Math.Cos(angle) - inOutHeight / 2;
y = center.Y - radiusY * Math.Sin(angle) - inOutHeight / 2;
}
ef.PositionX = x + graphLeft;
ef.PositionY = y + graphTop; Canvas.SetLeft(ef, ef.PositionX);
Canvas.SetTop(ef, ef.PositionY);
} foreach (Output ef in OutputCollection)
{
outputIndex++;
double outputAngle;
if (outputCount > 1)
{
outputAngle = 2 * Math.PI / (inputCount + outputCount); // 位置
double angle = outputIndex * outputAngle / 2;
x = center.X + radiusX * Math.Sin(angle) - inOutHeight;
y = center.Y + radiusY * Math.Cos(angle) - inOutHeight;
}
else
{
outputAngle = 2 * Math.PI / outputCount;
// 位置
double angle = outputIndex * outputAngle;
x = center.X + radiusX * Math.Cos(angle) - inOutHeight / 2;
y = center.Y + radiusY * Math.Sin(angle) - inOutHeight / 2;
}
ef.PositionX = x + graphLeft;
ef.PositionY = y + graphTop; Canvas.SetLeft(ef, ef.PositionX);
Canvas.SetTop(ef, ef.PositionY);
}