vector3D surface_quadratic::atnormal(const point3D &p) const {
		double gx = 2 * coef_xx * p.x + coef_xy * p.y + coef_xz * p.z + coef_x;
		double gy = 2 * coef_yy * p.y + coef_xy * p.x + coef_yz * p.z + coef_y;
		double gz = 2 * coef_zz * p.z + coef_xz * p.x + coef_yz * p.y + coef_z;

		return vector3D(gx, gy, gz).normalize(); 
	}
Esempio n. 2
0
	inline void light::set_spot(bool enabled_, const vector3D &direction_ = vector3D(0, 0, 1), double cutoff_ = pi / 2, int exponent_ = 1) {
		spot_enabled = enabled_;
		spot_direction = direction_.normalized();
		spot_cutoff = cutoff_;
		spot_cos_cutoff = cos(spot_cutoff);
		spot_exponent = exponent_;
	}
Esempio n. 3
0
void flight::file_out(char *_filename)
{
    ofstream FILE_OUT(_filename);
    osculation out_elem;
    transformer trns;

    for(unsigned i = 0; i < res.size(); i++)
    {
        out_elem.set_new_r_v(vector3D(res[i][0], res[i][1], res[i][2]),vector3D(res[i][3], res[i][4], res[i][5]));

        if(time[i] == t_separate) FILE_OUT << "**************************Разделение с КА**************************" << endl;
        if(time[i] == t_on)       FILE_OUT << "**************************Включение ДМТ****************************" << endl;
        if(time[i] == t_off)      FILE_OUT << "**************************Выключение ДМТ***************************" << endl;
        FILE_OUT << fixed << setprecision(5) << "t = " << time[i] << " tkp = " << time[i] - 5.0135 << " ТАКТОВ = " << time[i]/0.032768 << " m = " << res[i][6] << endl;
        FILE_OUT << "x = " << res[i][0]/1000 << " y = " << res[i][1]/1000 << " z = " << res[i][2]/1000 << endl;
        FILE_OUT << "vx= " << res[i][3]/1000 << " vy= " << res[i][4]/1000 << " vz= " << res[i][5]/1000 << endl;
        FILE_OUT << "xN= " << trns.gisk_to_nssk(vector3D(res[i][0], res[i][1], res[i][2]), A, B, L)[0]/1000 << " yN= " << trns.gisk_to_nssk(vector3D(res[i][0], res[i][1], res[i][2]), A, B, L)[1]/1000 << " zN= " << trns.gisk_to_nssk(vector3D(res[i][0], res[i][1], res[i][2]), A, B, L)[2]/1000 << endl;
        FILE_OUT << "vxN= " << trns.gisk_to_nssk(vector3D(res[i][3], res[i][4], res[i][5]),  A, B, L)[0]/1000 << " vyN= " << trns.gisk_to_nssk(vector3D(res[i][3], res[i][4], res[i][5]),  A, B, L)[1]/1000 << " vzN= " << trns.gisk_to_nssk(vector3D(res[i][3], res[i][4], res[i][5]),  A, B, L)[2]/1000 << endl;
        FILE_OUT << "i = " << out_elem.get_i() << " a = " << out_elem.get_a() << " hp = " << out_elem.get_hp()/1000 << " ha = " << out_elem.get_ha()/1000 << endl;
        FILE_OUT << "Va = " << vector3D(res[i][3], res[i][4], res[i][5]).abs_vec() << " Vo = " << gr_at.v_otn(res[i]).abs_vec()/1000 << " H = " << trns.coord_to_angles(vector3D(res[i][0], res[i][1], res[i][2]))[2] << endl;
        if (time[i] >= t_on && time[i] <= t_off) FILE_OUT << "P = " << imp.get_scal_p() << " mst = " << imp.get_dm();
        else FILE_OUT << "P = " << 0 << " mst = " << 0;
        FILE_OUT << " Wхар = " << res[i][7]/1000;
        if (time[i] >= t_on && time[i] <= t_off) FILE_OUT << " nx = " << imp.get_scal_p()/res[i][6] << endl;
        else FILE_OUT << " nx = " << 0 << endl;
        FILE_OUT << "fi = " << trns.coord_to_angles(vector3D(res[i][0], res[i][1], res[i][2]))[0] << " lm = " << trns.coord_to_angles(vector3D(res[i][0], res[i][1], res[i][2]))[1] << endl;
        if(time[i] == t_separate || time[i] == t_on || time[i] == t_off) FILE_OUT << "*******************************************************************" << endl;
        FILE_OUT << endl;
    }
    FILE_OUT.close();
    res.clear();
    time.clear();
}
Esempio n. 4
0
Sky::Sky ( float radius, float angle, int nBlocksX, int nBlocksY )
{
	float gridX = PI2 / nBlocksX; //!< Angle to the next point in X direction.
	float gridY = PI  / nBlocksY;

	nVertices_  = nBlocksX * (nBlocksY / 2) + 1;
	nTriangles_ = ( nBlocksX * (nBlocksY / 2) ) * 2 + nBlocksX;
	vertices_   = new Vertex [nVertices_];
	indices_    = new int    [nTriangles_ * 3];

	float x, y, z;
	int   i = 0;

	for ( float phi = 0; phi < PI2; phi += gridX ) {
		x = cos (phi) * radius;
		z = sin (phi) * radius;
		for ( float psi = 0; psi < halfPI; psi += gridY ) {
			y = sin (psi) * radius;
			vertices_ [i++].coord = vector3D ( x, y, z );
		}
	}

	int j = 0;

	//!< Can be reorganized to TRIANGLES_STRIP.
	for ( i = 0; i < nTriangles_ - nBlocksX; i++ ) {
		indices_ [j++] = i;
		indices_ [j++] = i + nBlocksX;
		indices_ [j++] = i + 1;
		indices_ [j++] = i + 1;
		indices_ [j++] = i + nBlocksX;
		indices_ [j++] = i + nBlocksX + 1;
	}

	for ( ; i < nTriangles_; i++ ) {
		indices_ [j++] = i;
		indices_ [j++] = nVertices_ - 1;
		indices_ [j++] = i + 1;
	}

	uploadToGpu ();
}
Esempio n. 5
0
//Init the statistics
void initStatistics() {

    statistics.currentFeedRate = 4800.0; // Default feed rate (mm/min)
    
    statistics.currentLocation = vector3D(0,0,0);
    statistics.totalTravelledTime = 0;
    statistics.totalTravelledDistance = 0;
    statistics.totalExtrudedTime = 0;
    statistics.totalExtrudedDistance = 0;
    
    statistics.currentExtrudedLengthToolA = 0;
    statistics.currentExtrudedLengthToolB = 0;
    
    statistics.totalExtrudedLengthToolA = 0;
    statistics.totalExtrudedLengthToolB = 0;
    
    statistics.movementLinesCount = 0;
    statistics.layersCount = 0;
    statistics.layerHeight = 0;
    
    statistics.extruding = false;
    statistics.dualExtrusion = false;
    statistics.usingToolB = false;
}
Esempio n. 6
0
Ray::Ray()
{
	Origin = vector3D(0, 0, 0);
	Direction = vector3D (1, 0, 0);
	
}
Esempio n. 7
0
vector3D vector3D::operator /(float f) {
	f = 1/f;
	return vector3D(x * f, y * f, z * f);
}
Esempio n. 8
0
vector3D vector3D::operator *(float f) {
	return vector3D(x * f, y * f, z * f);
}
Esempio n. 9
0
vector3D Phase::getBodyVelocity(identifier body) const {
	assert(body < numberOfBodies);
	return vector3D(at(6 * body + Coord::vx), at(6 * body + Coord::vy), at(6 * body + Coord::vz));
}
Esempio n. 10
0
vector3D vector3D::operator /(vector3D &v) {
	return vector3D(x / v.x, y / v.y, z / v.z);
}
Esempio n. 11
0
vector3D vector3D::operator *(vector3D &v) {
	return vector3D(x * v.x, y * v.y, z * v.z);
}
Esempio n. 12
0
vector3D vector3D::operator +(vector3D &v) {
	return vector3D(x + v.x, y + v.y, z + v.z);
}
Esempio n. 13
0
vector3D vector3D::operator -(vector3D &v) {
	return vector3D(x - v.x, y - v.y, z - v.z);
}
Esempio n. 14
0
vector3D xmul(vector3D &v1, vector3D &v2) {
	return vector3D(v1.y*v2.z - v1.z*v2.y,
								  v1.z*v2.x - v1.x*v2.z,
									v1.x*v2.y - v1.y*v2.x);
}
Esempio n. 15
0
	vector3D surface_mobius::atnormal(const point3D &point) const {
		double x = point.x, y = point.y, z = point.z, R = radius;
		vector3D ret =  vector3D(2 * x * y - 2 * R * z - 4 * x * z, -R * R + x * x + 3 * y * y - 4 * y * z + z * z, -2 * R * x - 2 * x * x - 2 * y * y + 2 * y * z);

		return ret.normalize();
	}
Esempio n. 16
0
vector3D Phase::getBodyPosition(identifier body) const {
	assert(body < numberOfBodies);
	return vector3D(at(6 * body + Coord::x), at(6 * body + Coord::y), at(6 * body + Coord::z));
}
Esempio n. 17
0
vector3D vector3D::operator +(float f) {
	return vector3D(x + f, y + f, z + f);
}
Esempio n. 18
0
vector3D vector3D::operator -(float f) {
	return vector3D(x - f, y - f, z - f);
}
Esempio n. 19
0
	ray::ray() {
		origin = point3D(0, 0, 0);
		dir = vector3D(0, 0, 1);
	}