جربت تشغيل الكود لم يعمل
جربت ايضًا استخراج المعادلة او المنطق من الكود ولم انجح
هذا الكود محسن استعملت فيه ال timer بدلا من ال multi threading
كود PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsFormsApplication2
{
public partial class playGround : Form
{
private readonly int radius =150 ;
private readonly double velociy =10 ;
private double omega;
private int ctime;
public playGround()
{
InitializeComponent();
omega = velociy / radius;
ctime = 0;
this.Size = new System.Drawing.Size(4 * radius, 3 * radius);
this.Paint += new PaintEventHandler(DrawEllipseRectangle);
}
private void Form1_Load(object sender, EventArgs e)
{
animate_object(100);
}
private void animate_object(int interval)
{
time.Interval = interval;
time.Start();
time.Enabled = true;
}
private void DrawEllipseRectangle(object sender, PaintEventArgs e)
{
// Create pen.
Pen blackPen = new Pen(Color.Black, 3);
// Create rectangle for ellipse.
Rectangle rect = new Rectangle(radius, 0, radius * 2, radius * 2);
// Draw ellipse to screen.
e.Graphics.DrawEllipse(blackPen, rect);
}
private void ttick(object sender, EventArgs e)
{
int x, y;
ctime++;
x = Convert.ToInt16(radius - radius * Math.Cos(omega * ctime)) + Convert.ToInt16(radius) ;
y = Convert.ToInt16(radius * Math.Sin(omega * ctime)) + Convert.ToInt16(radius);
A.Location = new Point(x,y);
}
}
}
لا تنس اضافة ال timer يدويًا
بالنسبة للرسم الثلاثي الابعاد والذي هو موضوعنا هنا
انا لا احبذ مسألة تخمين المعادلة حتى الوصول إلى الشكل المناسب
هناك مكتبات مثل directX وغيرها متخصصة في الرسم ثلاثي الابعاد
وفيها دوال خاصة للتحويل من 3d->2d
ويمكن فيها تحديد جهة "الكاميرا" والاضواء
اقترح ان نبدأ بالبحث في هذا المجال