float inter_plan(t_sphere *sphere, t_expose *expose) { float result; sphere->z1 -= Z_PLAN; sphere->x1 -= X_1; sphere->y1 -= Y_1; rotation_x(sphere, PLAN_ROTX); rotation_y(sphere, PLAN_ROTY); rotation_z(sphere, PLAN_ROTZ); if (sphere->z1 == 0) return (0); sphere->k = - (sphere->zo / sphere->z1); rotation_x(sphere, -(PLAN_ROTX)); rotation_y(sphere, -(PLAN_ROTY)); rotation_z(sphere, -(PLAN_ROTZ)); sphere->z1 += Z_PLAN; sphere->x1 += X_1; sphere->y1 += Y_1; result = create_paralel(expose); if (sphere->k < 0) return (sphere->k1); // else if (result != -1) // return (sphere->k); else return (0); }
float create_cone(t_sphere *sphere) { float k; sphere->x1 -= X_CONE; sphere->y1 -= Y_CONE; sphere->z1 -= Z_CONE; rotation_x(sphere, CONE_ROTX); rotation_y(sphere, CONE_ROTY); rotation_z(sphere, CONE_ROTZ); sphere->a = powf(sphere->x1, 2) + powf(sphere->y1, 2) - (powf(sphere->z1, 2) / powf(tanf(RAD * ANGLE_CONE), 2)); sphere->b = 2 * ((sphere->xo * sphere->x1) + (sphere->yo * sphere->y1) - (powf(sphere->zo, 2) / powf(tanf(RAD * ANGLE_CONE), 2))); sphere->c = powf(sphere->xo, 2) + powf(sphere->yo, 2) - (powf(sphere->zo, 2) / powf(tanf(RAD * ANGLE_CONE), 2)); rotation_x(sphere, -(CONE_ROTX)); rotation_y(sphere, -(CONE_ROTY)); rotation_z(sphere, -(CONE_ROTZ)); sphere->x1 += X_CONE; sphere->y1 += Y_CONE; sphere->z1 += Z_CONE; sphere->delta = powf(sphere->b, 2) - (4 * sphere->a * sphere->c); k = create_cone_follow(sphere); return (k); }
float create_sphere(t_sphere *sphere) { float k; sphere->x1 -= X_SPHERE; sphere->y1 -= Y_SPHERE; sphere->z1 -= Z_SPHERE; rotation_x(sphere, SPHERE_ROTX); rotation_y(sphere, SPHERE_ROTY); rotation_z(sphere, SPHERE_ROTZ); sphere->a = powf(sphere->x1, 2) + powf(sphere->y1, 2) + powf(sphere->z1, 2); sphere->b = 2 * ((sphere->xo * sphere->x1) + (sphere->yo * sphere->y1) + (sphere->zo * sphere->z1)); sphere->c = powf(sphere->xo, 2) + powf(sphere->yo, 2) + powf(sphere->zo, 2) - powf(R_SPHERE, 2); rotation_x(sphere, -(PLAN_ROTX)); rotation_y(sphere, -(PLAN_ROTY)); rotation_z(sphere, -(PLAN_ROTZ)); sphere->x1 += X_SPHERE; sphere->y1 += Y_SPHERE; sphere->z1 += Z_SPHERE; sphere->delta = powf(sphere->b, 2) - (4 * sphere->a * sphere->c); k = create_sphere_follow(sphere); return (k); }
void CShape::Do(void) { m_bRun = true; m_bThread = true; for (int i = 0; ; i++)//i < 360*3 { rotation_y(i); rotation_x(i); show_xy_face(); ::Sleep(30); if (!m_bRun) { break; } clear(); SetData(); } m_bRun = false; m_bThread = false; }
void cam::look_right(double a) { _r.z -= a; _v = _vi; rotation_x(_r.x, _v); rotation_y(_r.y, _v); rotation_z(_r.z, _v); }
void EditorCamera::Draw() { Mat4 to_look_at = rotation_y(DegToRad(m_yaw)) * rotation_x(DegToRad(m_pitch)); Vec3 vec = m_zoom * get_column(to_look_at, 2); m_camera.SetPosition(m_target+vec); m_camera.SetLookDir(-vec); m_camera.Draw(); }
void cam::look_left(double a) { _r.z += a; _v = _vi; rotation_x(_r.x, _v); rotation_y(_r.y, _v); rotation_z(_r.z, _v); }
void update_status_turtlepitch(void) { if (current_mode == perspectivemode) sprintf(YABuffer, "%1.2f", rotation_x()); else sprintf(YABuffer, "%1.2f", 0.0); MainWindowx->StatusWindow-> SendDlgItemMsg(ID_TURTLEPITCH, WM_SETTEXT, 0, (DWORD) YABuffer); }
void cam::look_down(double a) { _r.x -= a; if (_r.x <= -PI / 2) _r.x = -PI / 2 + 0.001; _v = _vi; rotation_x(_r.x, _v); rotation_y(_r.y, _v); rotation_z(_r.z, _v); }
void cam::look_up(double a) { _r.x += a; if (_r.x >= PI / 2) _r.x = PI / 2 - 0.001; _v = _vi; rotation_x(_r.x, _v); rotation_y(_r.y, _v); rotation_z(_r.z, _v); }
void cam::up(double k) { sf::Vector3f t; t = _vi; rotation_x(PI / 2, t); _c.x += t.x * k; _c.y += t.y * k; _c.z += t.z * k; }
void cam::right(double k) { sf::Vector3f t; t = _vi; rotation_z(-PI / 2, t); rotation_x(_r.x, t); rotation_y(_r.y, t); rotation_z(_r.z, t); _c.x += t.x * k; _c.y += t.y * k; _c.z += t.z * k; }
void rotate_caster(t_caster *caster, t_object *object) { double *z_rotate; double *x_rotate; double *y_rotate; x_rotate = rotation_x(object->rotation.x); y_rotate = rotation_y(object->rotation.y); z_rotate = rotation_z(object->rotation.z); rotate_coordinate(&caster->temp_vec, z_rotate); rotate_coordinate(&caster->temp_vec, y_rotate); rotate_coordinate(&caster->temp_vec, x_rotate); free(z_rotate); free(y_rotate); free(x_rotate); }
cam::cam() { _c.x = 0; _c.y = 0; _c.z = 0; _r.x = -0.74; _r.y = 0; _r.z = 2.40159; _vi.x = 0; _vi.y = 1; _vi.z = 0; _v = _vi; rotation_x(_r.x, _v); rotation_y(_r.y, _v); rotation_z(_r.z, _v); }