/////////////////////// // normal void Tooltip::draw() { if(is_visible()) { std::string text = get_text(); int x = get_x(); int y = get_y(); int width = get_width (); int height = get_height(); double angle = get_angle(); double scale_x = get_scale().x; double scale_y = get_scale().y; double red = get_color().x; double green = get_color().y; double blue = get_color().z; double alpha = get_color().w; Renderer::draw_tooltip(text, x, y, width, height, angle, scale_x, scale_y, red, green, blue, alpha); if(label != nullptr) { label->draw(); //Renderer::draw_label(text, x, y, angle, get_label()->get_scale().x, get_label()->get_scale().y, // get_label()->get_font()->get_data(), // get_text_color().x,get_text_color().y,get_text_color().z,get_text_color().w); } } on_draw(); // callback for all gui }
node<P> batch_create(DistanceCallback& dcb, v_array<P> points) { assert(points.index > 0); v_array<ds_node<P> > point_set; v_array<v_array<ds_node<P> > > stack; for (int i = 1; i < points.index; i++) { ds_node<P> temp; push(temp.dist, distance(dcb, points[0], points[i], std::numeric_limits<ScalarType>::max())); temp.p = points[i]; push(point_set,temp); } v_array<ds_node<P> > consumed_set; ScalarType max_dist = max_set(point_set); node<P> top = batch_insert (dcb, points[0], get_scale(max_dist), get_scale(max_dist), point_set, consumed_set, stack); for (int i = 0; i<consumed_set.index;i++) free(consumed_set[i].dist.elements); free(consumed_set.elements); for (int i = 0; i<stack.index;i++) free(stack[i].elements); free(stack.elements); free(point_set.elements); return top; }
Vector2 GraphNode::get_connection_output_pos(int p_idx){ if (connpos_dirty) _connpos_update(); ERR_FAIL_INDEX_V(p_idx,conn_output_cache.size(),Vector2()); Vector2 pos = conn_output_cache[p_idx].pos; pos.x *= get_scale().x; pos.y *= get_scale().y; return pos; }
void geometry2d_renderer::render(renderer_ptr render) { if (game_obj_.expired()) { return; } auto obj = game_obj_.lock(); if (!obj->get_active()) { return; } auto trans = obj->get_component<transform2d>(); assert_return((trans != nullptr)); if (geo_type_ == gt_none) { return; } vert_buf_.clear(); if (geo_type_ == gt_polygon) { auto mat = matrix3::make_transform(trans->get_pos(), trans->get_scale(), trans->get_forward()); for (auto vt : geo_data_.vertices) { vert_buf_.push_back(mat * vt); } } else if (geo_type_ == gt_circle) { static const int vert_cnt = 180; float scale_factor = 100.0f; vec2 scale = trans->get_scale(); vec2 pos = trans->get_pos(); for (int i = 0; i < vert_cnt; ++i) { float delta = 360.0f / vert_cnt; float rad = (float)(i * delta * PI) / 180.0f; vec2 pt; pt.x = scale_factor * cosf(rad) * geo_data_.radius * scale.x / scale_factor + pos.x; pt.y = scale_factor * sinf(rad) * geo_data_.radius * scale.y / scale_factor + pos.y; vert_buf_.push_back(pt); } vec2 st = vert_buf_[0]; vert_buf_.push_back(st); } else { return; } render->set_draw_color(vert_color_); render->draw_polygon(vert_buf_); }
/* * This function returns the major scale of the given tonic note. The scale is * an array of semitone_t terminated by an UNKNOWN_SEMITONE, and it is allocated * on the heap. If the tonic is an illegal argument, NULL is returned. */ enum semitone_t *get_major_scale(enum semitone_t tonic) { enum semitone_t major_scale[] = {C, D, E, F, G, A, B, UNKNOWN_SEMITONE}; return get_scale(tonic, major_scale, sizeof(major_scale) / sizeof(enum semitone_t)); }
/* * This function returns the chromatic scale of the given tonic note. The scale * is an array of semitone_t terminated by an UNKNOWN_SEMITONE, and it is * allocated on the heap. If the tonic is an illegal argument, NULL is * returned. */ enum semitone_t *get_chromatic_scale(enum semitone_t tonic) { enum semitone_t chromatic_scale[] = {C, Db, D, Eb, E, F, Gb, G, Ab, A, Bb, B, UNKNOWN_SEMITONE}; return get_scale(tonic, chromatic_scale, sizeof(chromatic_scale) / sizeof(enum semitone_t)); }
/* * This function returns the natural minor scale of the given tonic note. The * scale is an array of semitone_t terminated by an UNKNOWN_SEMITONE, and it is * allocated on the heap. If the tonic is an illegal argument, NULL is * returned. */ enum semitone_t *get_natural_minor_scale(enum semitone_t tonic) { enum semitone_t natural_minor_scale[] = {C, D, Eb, F, G, Ab, Bb, UNKNOWN_SEMITONE}; return get_scale(tonic, natural_minor_scale, sizeof(natural_minor_scale) / sizeof(enum semitone_t)); }
static void clamp_view(struct image *image) { struct rectangle allocation; double scale = get_scale(image); double sw, sh; sw = image->width * scale; sh = image->height * scale; widget_get_allocation(image->widget, &allocation); if (sw < allocation.width) { image->matrix.x0 = (allocation.width - image->width * scale) / 2; } else { if (image->matrix.x0 > 0.0) image->matrix.x0 = 0.0; if (sw + image->matrix.x0 < allocation.width) image->matrix.x0 = allocation.width - sw; } if (sh < allocation.width) { image->matrix.y0 = (allocation.height - image->height * scale) / 2; } else { if (image->matrix.y0 > 0.0) image->matrix.y0 = 0.0; if (sh + image->matrix.y0 < allocation.height) image->matrix.y0 = allocation.height - sh; } }
/* * This function returns the melodic minor scale of the given tonic note. The * scale is an array of semitone_t terminated by an UNKNOWN_SEMITONE, and it is * allocated on the heap. If the tonic is an illegal argument, NULL is * returned. */ enum semitone_t *get_melodic_minor_scale(enum semitone_t tonic) { enum semitone_t melodic_minor_scale[] = {C, D, Eb, F, G, A, B, UNKNOWN_SEMITONE}; return get_scale(tonic, melodic_minor_scale, sizeof(melodic_minor_scale) / sizeof(enum semitone_t)); }
/* * This function returns the harmonic minor scale of the given tonic note. The * scale is an array of semitone_t terminated by an UNKNOWN_SEMITONE, and it is * allocated on the heap. If the tonic is an illegal argument, NULL is * returned. */ enum semitone_t *get_harmonic_minor_scale(enum semitone_t tonic) { enum semitone_t harmonic_minor_scale[] = {C, D, Eb, F, G, Ab, B, UNKNOWN_SEMITONE}; return get_scale(tonic, harmonic_minor_scale, sizeof(harmonic_minor_scale) / sizeof(enum semitone_t)); }
CL_CollisionOutline CL_CollisionOutline::clone() const { CL_CollisionOutline copy; copy.impl->contours.clear(); copy.impl->contours.reserve(impl->contours.size()); for (size_t i = 0; i < impl->contours.size(); i++) copy.impl->contours.push_back(impl->contours[i].clone()); copy.impl->do_inside_test = get_inside_test(); copy.impl->width = get_width(); copy.impl->height = get_height(); copy.impl->position = get_translation(); copy.impl->scale_factor = get_scale(); copy.impl->angle = get_angle(); copy.impl->minimum_enclosing_disc = get_minimum_enclosing_disc(); bool points, normals, metadata, pendepths; get_collision_info_state(points,normals,metadata,pendepths); copy.enable_collision_info(points,normals,metadata,pendepths); CL_Origin origin; float x, y; get_alignment(origin,x,y); copy.impl->translation_origin = origin; copy.impl->translation_offset.x = x; copy.impl->translation_offset.y = y; get_rotation_hotspot(origin,x,y); copy.impl->rotation_origin = origin; copy.impl->rotation_hotspot.x = x; copy.impl->rotation_hotspot.y = y; return copy; }
//! get parameter var* sci_psk_dem::get(int param) { var* p_var_vec = new var_vec; // create var_vec; vec &v = (dynamic_cast<var_vec *>(p_var_vec))->v; // alias to vector var* p_var_ivec = new var_ivec; // create var_vec; ivec &iv = (dynamic_cast<var_ivec *>(p_var_ivec))->v; // alias to vector switch (param) { case SCI_SIZE: iv.set_length(1); iv[0] = get_size(); return(p_var_ivec); case SCI_SCALE: v.set_length(1); v[0] = get_scale(); return(p_var_vec); case SCI_OUTPUT: iv.set_length(1); iv[0] = get_output(); return(p_var_ivec); default: throw sci_exception ("sci_psk_dem::get - unknown param"); } };
void AnimationNode::set_transform(const D3DXMATRIX& transform) { transform_ = transform; pos_ = get_translation(transform); D3DXQuaternionRotationMatrix(&rot_, &transform); scale_ = get_scale(transform); }
bool NodeDatabrick::compute_projection_bbox(CFrustumCull* fculler, float* bbox) { bool ret = fculler->get_boundingbox(get_pos(), get_scale(), bbox); return ret; }
main(){ make_linked_list(); get_numbers(); get_scale(); calculate_sum(); print_result(); getch(); }
Dictionary Node2D::_edit_get_state() const { Dictionary state; state["position"] = get_position(); state["rotation"] = get_rotation(); state["scale"] = get_scale(); return state; }
int dcpred_for_enc(M4V_DCPRED* p, int n, int level) { int* dc_cur = p->dc_cur[n]; int scale = get_scale(p, n); int pred = get_pred(dc_cur, p->stride[n], scale); set_dc_to_dc_cur(dc_cur, level, scale); return level - pred; }
Variant Node2D::edit_get_state() const { Array state; state.push_back(get_pos()); state.push_back(get_rot()); state.push_back(get_scale()); return state; }
void sphere::gl_render( view& geometry) { if (degenerate()) return; //init_model(); init_model(geometry); // coverage is the radius of this sphere in pixels: double coverage = geometry.pixel_coverage( pos, radius); int lod = 0; if (coverage < 0) // Behind the camera, but still visible. lod = 4; else if (coverage < 30) lod = 0; else if (coverage < 100) lod = 1; else if (coverage < 500) lod = 2; else if (coverage < 5000) lod = 3; else lod = 4; lod += geometry.lod_adjust; // allow user to reduce level of detail if (lod > 5) lod = 5; else if (lod < 0) lod = 0; gl_matrix_stackguard guard; model_world_transform( geometry.gcf, get_scale() ).gl_mult(); color.gl_set(opacity); if (translucent()) { // Spheres are convex, so we don't need to sort gl_enable cull_face( GL_CULL_FACE); // Render the back half (inside) glCullFace( GL_FRONT ); geometry.sphere_model[lod].gl_render(); // Render the front half (outside) glCullFace( GL_BACK ); geometry.sphere_model[lod].gl_render(); } else { // Render a simple sphere. geometry.sphere_model[lod].gl_render(); } }
void view::transform(int& x, int& y) { int dx = get_dx(); int dy = get_dy(); double scale = get_scale(); x *= scale; y *= scale; x += dx; y += dy; }
void view::rtransform(int& x, int& y) { int dx = - get_dx(); int dy = - get_dy(); double scale = 1.0 / get_scale(); x += dx; y += dy; x *= scale; y *= scale; }
inline void rebuild() { glm::mat4 matrix; matrix = glm::translate(get_translation()); matrix *= glm::mat4(glm::mat3_cast( get_rotation())); matrix = glm::scale(matrix, get_scale()); m_matrix = glm::mat4x3(matrix); }
void Edit::draw() { if(is_visible()) // is it visible? { if(is_active()) // is it disabled? {} double x = get_position().x; double y = get_position().y; double angle = get_angle(); double scale_x = get_scale().x; double scale_y = get_scale().y; int width = get_width(); int height = get_height(); int red = get_color().x; int green = get_color().y; int blue = get_color().z; int alpha = get_color().w; void * font = (get_label() ? get_label()->get_font()->get_data() : nullptr); Vector4 text_color = get_text_color(); // Draw edit Renderer::draw_edit(get_text(), x, y, width, height, angle, scale_x, scale_y, red, green, blue, alpha, multilined, cursor, cursor_x, cursor_y); // Draw text if(!label->get_string().empty()) { label->draw(); label->set_position(x, y + cursor_y); label->set_scale(0.5, 0.5); label->set_color(text_color); } // if mouse over edit, change mouse to I-beam // edit is pressed, set cursor at position_pressed on_hover(); on_mousepress(); on_keypress(); on_backspace(); on_enter(); } }
static void move_viewport(struct image *image, double dx, double dy) { double scale = get_scale(image); if (!image->initialized) return; cairo_matrix_translate(&image->matrix, -dx/scale, -dy/scale); clamp_view(image); window_schedule_redraw(image->window); }
static void zoom(struct image *image, double scale) { double x = image->pointer.x; double y = image->pointer.y; cairo_matrix_t scale_matrix; if (!image->initialized) return; if (get_scale(image) * scale > 20.0 || get_scale(image) * scale < 0.02) return; cairo_matrix_init_identity(&scale_matrix); cairo_matrix_translate(&scale_matrix, x, y); cairo_matrix_scale(&scale_matrix, scale, scale); cairo_matrix_translate(&scale_matrix, -x, -y); cairo_matrix_multiply(&image->matrix, &image->matrix, &scale_matrix); clamp_view(image); }
void view::transform(int& x, int& y, int& w, int& h, int& r) { int dx = get_dx(); int dy = get_dy(); double scale = get_scale(); x *= scale; y *= scale; w *= scale; h *= scale; r *= scale; x += dx; y += dy; }
void sphere::gl_pick_render( view& geometry) { if (degenerate()) return; //init_model(); init_model(geometry); gl_matrix_stackguard guard; model_world_transform( geometry.gcf, get_scale() ).gl_mult(); geometry.sphere_model[0].gl_render(); //check_gl_error(); }
void Standard_model_low_scale_constraint<Two_scale>::apply() { assert(model && "Error: Standard_model_low_scale_constraint::apply():" " model pointer must not be zero"); qedqcd.runto(scale, 1.0e-5); model->calculate_DRbar_masses(); const double alpha_em = qedqcd.displayAlpha(softsusy::ALPHA); const double alpha_s = qedqcd.displayAlpha(softsusy::ALPHAS); const double mz_pole = qedqcd.displayPoleMZ(); double delta_alpha_em = 0.; double delta_alpha_s = 0.; if (model->get_thresholds()) { delta_alpha_em = model->calculate_delta_alpha_em(alpha_em); delta_alpha_s = model->calculate_delta_alpha_s(alpha_s); } const double alpha_em_drbar = alpha_em / (1.0 - delta_alpha_em); const double alpha_s_drbar = alpha_s / (1.0 - delta_alpha_s); const double e_drbar = Sqrt(4.0 * Pi * alpha_em_drbar); const double g1 = model->get_g1(); const double g2 = model->get_g2(); const double mZ = model->get_thresholds() ? model->calculate_MVZ_DRbar(mz_pole) : mz_pole; double theta_w = model->calculate_theta_w(qedqcd, alpha_em_drbar); if (IsFinite(theta_w)) { model->get_problems().unflag_non_perturbative_parameter( "sin(theta_W)"); } else { model->get_problems().flag_non_perturbative_parameter( "sin(theta_W)", theta_w, get_scale(), 0); theta_w = ArcSin(Electroweak_constants::sinThetaW); } model->set_v(Re((2*mZ)/Sqrt(0.6*Sqr(g1) + Sqr(g2)))); model->calculate_Yu_DRbar(qedqcd); model->calculate_Yd_DRbar(qedqcd); model->calculate_Ye_DRbar(qedqcd); model->set_g1(1.2909944487358056*e_drbar*Sec(theta_w)); model->set_g2(e_drbar*Csc(theta_w)); model->set_g3(3.5449077018110318*Sqrt(alpha_s_drbar)); if (model->get_thresholds()) qedqcd.setPoleMW(model->recalculate_mw_pole(qedqcd.displayPoleMW())); }
template<class T> node<T> batch_create(const std::vector<T> &points, typename distfn<T>::Type distance, const double* dist_params, void* dist_extra) { v_array<ds_node<T> > point_set; v_array<v_array<ds_node<T> > > stack; ds_node<T> initial_pt; initial_pt.p = points[0]; for (std::vector<point>::size_type i = 1; i < points.size(); i++) { ds_node<T> temp; push(temp.dist, distance(points[0], points[i], std::numeric_limits< double >::max(), dist_params, dist_extra)); temp.p = points[i]; push(point_set,temp); } v_array< ds_node < T > > consumed_set; double max_dist = max_set(point_set); node<T> top = batch_insert(initial_pt, get_scale(max_dist), get_scale(max_dist), point_set, consumed_set, stack, distance, dist_params, dist_extra); for (int i = 0; i<consumed_set.index;i++) free(consumed_set[i].dist.elements); free(consumed_set.elements); for (int i = 0; i<stack.index;i++) free(stack[i].elements); free(stack.elements); free(point_set.elements); return top; }
void NodeDatabrick::draw() { //std::cout <<"direction=" << m_direction << ",ratio=" << m_ratio << "\n"; //NodeDimension::draw(); float color[4]={0.5, 0.5, 0.5, 0.5}; //float color[4]={0., 0., 1., 0.5}; //for(int i=0; i<3; i++) //color[0] = 0.35*(0.5 - m_pos[0]); //color[1] = 0.5*(0.5 - m_pos[1]); //color[2] = 0.35*(0.5 + m_pos[2]); drawColorBox(get_scale(), get_pos(), color); //drawColorBox(get_scale(), get_pos(), 0); }