我一直在使用函数文件[ret]=drawellipse(x,y,a,b,angle,steps,color,img)。通过脚本文件调用函数,在图像中绘制随机椭圆。但是,一旦我设置了随机中心点(x,y)和随机a,b,椭圆相交的可能性很高。怎样才能防止交叉路口呢?(我应该画出彼此独立的椭圆),这里有一个函数文件,用来检查椭圆是否重叠,overlap = overlap_ellipses(x0,y0,a0,b0,angle0,x1,y1,a1,b1,angle1)。如果两个椭圆重叠,则‘重叠=1’,否则‘重叠=0’。基于这些,我在命令窗口中进行了测试:
x=rand(4,1)*400; % x a
我使用这个类根据LockBits函数填充位图的像素:
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices.Marshal
Public Class Fill
Public Shared Function Process(ByVal b As Bitmap) As Bitmap
Dim bmd As BitmapData = _
b.LockBits(New Rectangle(0, 0, b.Width, b.Height), _
System.Drawing.Imag
我已经创建了代码,以便在每次循环运行时在swing中提供的平面部分的随机部分中绘制一个具有随机颜色和坐标的随机椭圆。有没有一种更简单的方法来获得椭圆的这些随机值,如果有,是什么?下面是我使用的代码: for(int i = 0; i <= 200; i++) {
double r = Math.random();
int k = (int)(r * 255);
double s = Math.random();
int l = (int)(s * 255);
doub