Beispiel #1
0
bool Cone::Init(bool binary, std::istream *i)
{
	float rotate = 0;
	if(binary)
	{
		i->read((char *)&m_center, sizeof(m_center));
		i->read((char *)&m_axisDir, sizeof(m_axisDir));
		i->read((char *)&m_angle, sizeof(m_angle));
		i->read((char *)&rotate,
			sizeof(rotate));
	}
	else
	{
		for(size_t j = 0; j < 3; ++j)
			(*i) >> m_center[j];
		for(size_t j = 0; j < 3; ++j)
			(*i) >> m_axisDir[j];
		(*i) >> m_angle;
		(*i) >> rotate;
	}
	m_normal = Vec3f(std::cos(-m_angle), std::sin(-m_angle), 0);
	m_normalY = m_normal[1] * m_axisDir;
	m_n2d[0] = std::cos(m_angle);
	m_n2d[1] = -std::sin(m_angle);
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
	return true;
}
Beispiel #2
0
void Cylinder::Init(FILE *i)
{
	float rotate = 0;
	fread(&m_axisDir, sizeof(m_axisDir), 1, i);
	fread(&m_axisPos, sizeof(m_axisPos), 1, i);
	fread(&m_radius, sizeof(m_radius), 1, i);
	fread(&rotate, sizeof(rotate), 1, i);
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
}
Beispiel #3
0
void Cylinder::Init(float *array)
{
	float rotate = 0;
	for(int i=0;i<3;i++){
		m_axisDir[i] = array[i];
		m_axisPos[i] = array[i+3];
	}
	m_radius=array[6];
	rotate=array[7];	
	
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
}
Beispiel #4
0
void Cone::Init(FILE *i)
{
	float rotate = 0;
	fread(&m_center, sizeof(m_center), 1, i);
	fread(&m_axisDir, sizeof(m_axisDir), 1, i);
	fread(&m_angle, sizeof(m_angle), 1, i);
	fread(&rotate, sizeof(rotate), 1, i);
	m_normal = Vec3f(std::cos(-m_angle), std::sin(-m_angle), 0);
	m_normalY = m_normal[1] * m_axisDir;
	m_n2d[0] = std::cos(m_angle);
	m_n2d[1] = -std::sin(m_angle);
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
}
Beispiel #5
0
void Cone::Init(float *array)
{
	float rotate = 0;
	for(int i=0;i<3;i++){
		m_center[i] = array[i];
		m_axisDir[i] = array[3+i];
	}
	m_angle = array[6];
	rotate = array[7];
	
	m_normal = Vec3f(std::cos(-m_angle), std::sin(-m_angle), 0);
	m_normalY = m_normal[1] * m_axisDir;
	m_n2d[0] = std::cos(m_angle);
	m_n2d[1] = -std::sin(m_angle);
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
}
Beispiel #6
0
bool Cylinder::Init(bool binary, std::istream *i)
{
	float rotate = 0;
	if(binary)
	{
		i->read((char *)&m_axisDir, sizeof(m_axisDir));
		i->read((char *)&m_axisPos, sizeof(m_axisPos));
		i->read((char *)&m_radius, sizeof(m_radius));
		i->read((char *)&rotate, sizeof(rotate));
	}
	else
	{
		for(size_t j = 0; j < 3; ++j)
			(*i) >> m_axisDir[j];
		for(size_t j = 0; j < 3; ++j)
			(*i) >> m_axisPos[j];
		(*i) >> m_radius;
		(*i) >> rotate;
	}
	m_hcs.FromNormal(m_axisDir);
	m_angularRotatedRadians = 0;
	RotateAngularDirection(rotate);
	return true;
}