⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 squirmcell.cpp

📁 本程序模拟细胞的自我繁殖
💻 CPP
字号:
// SquirmCell.cpp

#include "stdafx.h"
#include "SquirmCell.h"
#include "SquirmCellSlot.h"

#include <math.h>

SquirmCell::SquirmCell(C2dVector loc,char type,int state)
     : SquirmCellProperties(type,state)
{
    this->location = loc;
    AssignRandomVelocity();
}

void SquirmCell::AssignRandomVelocity()
{
	// initialize with a random velocity
	float angle = rand()*2.0F*3.1415926535F/RAND_MAX;
	this->velocity.x = MAX_VELOCITY * (float)cos(angle);
	this->velocity.y = MAX_VELOCITY * (float)sin(angle);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -