0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cscの作法 その578

Posted at

概要

cscの作法、調べてみた。
OpenRCF v2.8、見つけたので、windows11で、MSbuildしてみた。
練習問題やってみた。

練習問題

ボールをシミュレーションせよ。

写真

image.png

サンプルコード

using System;
using System.Windows;
using OpenRCF;
using Vector = OpenRCF.Vector;


namespace OpenRCF
{
	partial class MainWindow: Window {
		Sphere Ball = new Sphere(0.25f);
		float g = 9.8f,
			v0 = 6,
			t,
			z;
		bool isMoved = false;

		void Setup() {
			Ball.Position[2] = Ball.Radius;
		}
		void Loop() {
			if (isMoved)
			{
				t = Timer.GetElapsedTimeSec(0);
				z = Ball.Radius + v0 * t - 0.5F * g * t * t;
				if (Ball.Radius < z)
				{
					Ball.Position[2] = z;
				}
				else
				{
					Ball.Position[2] = Ball.Radius;
					//isMoved = false;
					v0 *= 0.8f;
					Timer.SetTimeLabel(0);
				}
			}
		}
		void Draw() {
			Ball.Draw();
		}
		void Button1_Click(object sender, RoutedEventArgs e) {
			Timer.SetTimeLabel(0);
			isMoved = true;
		}
		void Button2_Click(object sender, RoutedEventArgs e) {
			
		}
		void Button3_Click(object sender, RoutedEventArgs e) {
			
		}
		void Button4_Click(object sender, RoutedEventArgs e) {
			
		}
		void Button5_Click(object sender, RoutedEventArgs e) {
			
		}
	}
}




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?