SimTK::Transform ContactGeometry::getTransform() { return SimTK::Transform(Rotation(SimTK::BodyRotationSequence, get_orientation()[0], SimTK::XAxis, get_orientation()[1], SimTK::YAxis, get_orientation()[2], SimTK::ZAxis), get_location()); }
Path::Path(Point s, Point e):start(s),end(e),edge(start, end){ prev = next = NULL; vec = end - start; vec = vec.normalize(); to_next = get_orientation(vec); to_prev = get_orientation(start-end); set_angel(); }
/* Check for what card has been clicked and process it */ gboolean table_handle_cardclick_event(GdkEventButton * event) { /* this function is tricky. There are lots of different variables: x, y, w, h describe the card area itself, including the "selected card" area. xo and yo describe the offset given by the "selected card". x1 and y1 are specific coordinates of a card. xdiff and ydiff is the overlapping offset for cards in hand. There are so many variables because hands can be facing any direction, and it's possible to be playing from *any* hand (at least in theory). */ int target; int which = -1; int p = ggzcards.play_hand; /* player whose hand it is */ int card_width, card_height; int hand_size; /* If it's not our turn to play, we don't care. */ if (ggzcards.state != STATE_PLAY) return FALSE; assert(p >= 0 && p < ggzcards.num_players); ggz_debug(DBG_TABLE, "table_handle_click_event: " "click at %f %f.", event->x, event->y); /* This gets all of the layout information from the layout engine. Unfortunately, it's very dense code. */ card_width = get_card_width(get_orientation(p)); card_height = get_card_height(get_orientation(p)); /* Calculate our card target */ hand_size = preferences.collapse_hand ? ggzcards.players[p].hand.hand_size : ggzcards.players[p].u_hand_size; for (target = 0; target < hand_size; target++) { int x, y; if (!preferences.collapse_hand && !ggzcards.players[p].u_hand[target].is_valid) continue; get_card_pos(p, target, target == selected_card, &x, &y); if (event->x >= x && event->x <= x + card_width /* TODO: generalize for any orientation */ && event->y >= y && event->y <= y + card_height) which = target; } if (which == -1) /* The click wasn't actually on a card. */ return FALSE; /* Handle the click. */ table_card_clicked(which); return TRUE; }
bool GeoConnection::same_orientation(double xi, double yi, double xj, double yj) { unsigned short oi = get_orientation(xi,yi); unsigned short oj = get_orientation(xj,yj); if ((oj > oi-orientationGap) && (oj < oi + orientationGap)) { return true; } return false; }
void track_bar_impl::get_channel_rect(RECT * rc) const { RECT rc_client; GetClientRect(get_wnd(), &rc_client); unsigned cx = calculate_thumb_size(); rc->left = get_orientation() ? rc_client.right/2-2 : rc_client.left + cx/2; rc->right = get_orientation() ? rc_client.right/2+2 : rc_client.right - cx + cx/2; rc->top = get_orientation() ? rc_client.top + cx/2 : rc_client.bottom/2-2; rc->bottom = get_orientation() ? rc_client.bottom - cx + cx/2 : rc_client.bottom/2+2; }
SortPlan_t * create_sort_plan(const Image * img, const Context_t * ctx) { if(ROW == get_orientation(ctx)) { return create_sort_plan(img, ctx, ROW); } else if(COLUMN == get_orientation(ctx)) { return create_sort_plan(img, ctx, COLUMN); } else { SortPlan_t * plan_ptr = create_sort_plan(img, ctx, ROW); plan_ptr->next_step_ptr = create_sort_plan(img, ctx, COLUMN); return plan_ptr; } }
int validate_hit(float shooter_x, float shooter_y, float shooter_z, float orientation_x, float orientation_y, float orientation_z, float ox, float oy, float oz, float tolerance) { float cx, cy, cz, r, x, y; Orientation o; get_orientation(&o, orientation_x, orientation_y, orientation_z); ox -= shooter_x; oy -= shooter_y; oz -= shooter_z; cz = ox * o.f.x + oy * o.f.y + oz * o.f.z; r = 1.f/cz; cx = ox * o.s.x + oy * o.s.y + oz * o.s.z; x = cx * r; cy = ox * o.h.x + oy * o.h.y + oz * o.h.z; y = cy * r; r *= tolerance; int ret = (x-r < 0 && x+r > 0 && y-r < 0 && y+r > 0); #if 0 if (!ret) { printf("hit test failed: %f %f %f\n", x, y, r); } #endif return ret; }
bool splitter_window_impl::find_by_divider_pt(POINT & pt, unsigned & p_out) { unsigned n, count = m_panels.get_count(); for (n = 0; n<count; n++) { pfc::refcounted_object_ptr_t<panel> p_item = m_panels.get_item(n); if (p_item->m_wnd_child) { RECT rc_area; GetRelativeRect(p_item->m_wnd_child, m_wnd, &rc_area); if (PtInRect(&rc_area, pt)) return false; bool in_divider = false; if (get_orientation() == vertical) { in_divider = (pt.y >= rc_area.bottom) && (pt.y < (rc_area.bottom + (LONG)get_panel_divider_size(n))); } else { in_divider = pt.x >= rc_area.right && pt.x < (rc_area.right + (LONG)get_panel_divider_size(n)); } if (in_divider) { p_out = n; return true; } } } return false; }
std::unique_ptr<SkCodec> SkHeifCodec::MakeFromStream( std::unique_ptr<SkStream> stream, Result* result) { std::unique_ptr<HeifDecoder> heifDecoder(createHeifDecoder()); if (heifDecoder.get() == nullptr) { *result = kInternalError; return nullptr; } HeifFrameInfo frameInfo; if (!heifDecoder->init(new SkHeifStreamWrapper(stream.release()), &frameInfo)) { *result = kInvalidInput; return nullptr; } std::unique_ptr<SkEncodedInfo::ICCProfile> profile = nullptr; if ((frameInfo.mIccSize > 0) && (frameInfo.mIccData != nullptr)) { // FIXME: Would it be possible to use MakeWithoutCopy? auto icc = SkData::MakeWithCopy(frameInfo.mIccData.get(), frameInfo.mIccSize); profile = SkEncodedInfo::ICCProfile::Make(std::move(icc)); } if (profile && profile->profile()->data_color_space != skcms_Signature_RGB) { // This will result in sRGB. profile = nullptr; } SkEncodedInfo info = SkEncodedInfo::Make(frameInfo.mWidth, frameInfo.mHeight, SkEncodedInfo::kYUV_Color, SkEncodedInfo::kOpaque_Alpha, 8, std::move(profile)); SkEncodedOrigin orientation = get_orientation(frameInfo); *result = kSuccess; return std::unique_ptr<SkCodec>(new SkHeifCodec(std::move(info), heifDecoder.release(), orientation)); }
void rotating_body::update(const simulation_context *c) { if (rotator) rotator->calc_orientation(c->julian_cur, get_orientation(), get_angular_velocity()); assert(get_linear_velocity().mag() == 0); } // update()
void HalfEllipsoid::draw( Geovalue &gval, GsTLGridProperty *propTi ) { grid_->select_property( propTi->name() ); double p = gen_(); rmax_ = get_max_radius( p ); rmed_ = get_med_radius( p ); rmin_ = get_min_radius( p ); //Convert angles to radian float strike = get_orientation( p ); float deg_to_rad = -3.14159265/180; if ( strike > 180 ) strike -= 360; if ( strike < -180 ) strike += 360; strike *= deg_to_rad; int node_id = gval.node_id(); std::vector<float> facies_props; std::vector<Geovalue> gbRaster = rasterize( node_id, propTi, strike, facies_props ); rasterizedVol_ = 0; if ( accept_location( facies_props ) ) { std::vector<Geovalue>::iterator gv_itr; for ( gv_itr = gbRaster.begin(); gv_itr != gbRaster.end(); ++gv_itr ) { int cur_index = propTi->get_value( gv_itr->node_id() ); gstl_assert( ( cur_index >= 0 ) && ( cur_index < erosion_rules_.size() ) ); if ( cur_index != geobody_index_ ) { if ( erosion_rules_[cur_index] == 1 ) { //decrease proportion of eroded geobodies? propTi->set_value( geobody_index_, gv_itr->node_id() ); rasterizedVol_++; } } } } }
SkCodec* SkHeifCodec::NewFromStream(SkStream* stream, Result* result) { std::unique_ptr<SkStream> streamDeleter(stream); std::unique_ptr<HeifDecoder> heifDecoder(createHeifDecoder()); if (heifDecoder.get() == nullptr) { *result = kInternalError; return nullptr; } HeifFrameInfo frameInfo; if (!heifDecoder->init(new SkHeifStreamWrapper(streamDeleter.release()), &frameInfo)) { *result = kInvalidInput; return nullptr; } SkEncodedInfo info = SkEncodedInfo::Make( SkEncodedInfo::kYUV_Color, SkEncodedInfo::kOpaque_Alpha, 8); Origin orientation = get_orientation(frameInfo); sk_sp<SkColorSpace> colorSpace = nullptr; if ((frameInfo.mIccSize > 0) && (frameInfo.mIccData != nullptr)) { SkColorSpace_Base::ICCTypeFlag iccType = SkColorSpace_Base::kRGB_ICCTypeFlag; colorSpace = SkColorSpace_Base::MakeICC( frameInfo.mIccData.get(), frameInfo.mIccSize, iccType); } if (!colorSpace) { colorSpace = SkColorSpace::MakeSRGB(); } *result = kSuccess; return new SkHeifCodec(frameInfo.mWidth, frameInfo.mHeight, info, heifDecoder.release(), std::move(colorSpace), orientation); }
unsigned track_bar::calculate_position_from_point(const POINT & pt_client) const { RECT rc_channel, rc_client; GetClientRect(get_wnd(), &rc_client); get_channel_rect(&rc_channel); POINT pt = pt_client; if (get_orientation()) { pfc::swap_t(pt.x, pt.y); pfc::swap_t(rc_channel.left, rc_channel.top); pfc::swap_t(rc_channel.bottom, rc_channel.right); pfc::swap_t(rc_client.left, rc_client.top); pfc::swap_t(rc_client.bottom, rc_client.right); } int cx = pt.x; if (cx < rc_channel.left) cx = rc_channel.left; else if (cx > rc_channel.right) cx = rc_channel.right; return rc_channel.right-rc_channel.left ? MulDiv(m_reversed ? rc_channel.right - cx: cx - rc_channel.left, m_range, rc_channel.right-rc_channel.left) : 0; }
//------------------------------------------------------------------------ void vcgen_contour::add_vertex(double x, double y, unsigned cmd) { m_status = initial; if(is_move_to(cmd)) { m_src_vertices.modify_last(vertex_dist(x, y)); } else { if(is_vertex(cmd)) { m_src_vertices.add(vertex_dist(x, y)); } else { if(is_end_poly(cmd)) { m_closed = get_close_flag(cmd); if(m_orientation == path_flags_none) { m_orientation = get_orientation(cmd); } } } } }
void Sinusoid::draw( Geovalue &gval, GsTLGridProperty *propTi ) { grid_->select_property( propTi->name() ); double p = gen_(); get_length( p ); get_width( p ); depth_ = cdf_depth_->inverse( p ); //Convert angle to radian & do checks float strike = get_orientation( p ); float deg_to_rad = 3.14159265/180; if ( strike > 180 ) strike -= 360; if ( strike < -180 ) strike += 360; strike *= deg_to_rad; amp_ = get_amplitude( p ); wvlength_ = get_wavelength( p ); // Channel cross-section is defined by a lower half ellipsoid // whose max radius equals channel width, med_radius = 1, // and min radius equals channel depth cdfType* cdf_hellipRot = new Dirac_cdf( 0.0 ); cdfType* cdf_hellipMaxr = new Dirac_cdf( half_width_ ); cdfType* cdf_hellipMedr = new Dirac_cdf( 1 ); cdfType* cdf_hellipMinr = new Dirac_cdf( depth_ ); int lower_half = 1; hellip_ = new HalfEllipsoid( grid_, geobody_index_, lower_half, cdf_hellipRot, cdf_hellipMaxr, cdf_hellipMedr, cdf_hellipMinr, objErosion_, objOverlap_ ); int node_id = gval.node_id(); Matrix_2D rot = get_rot_matrix( strike ); std::vector<std::vector<Geovalue> > gbRaster = rasterize( node_id, propTi, strike, rot ); rasterizedVol_ = 0; if ( accept_location( gbRaster, propTi ) ) { std::vector< std::vector<Geovalue> >::iterator sup_itr; std::vector<Geovalue>::iterator gv_itr; for ( sup_itr = gbRaster.begin(); sup_itr != gbRaster.end(); ++sup_itr ) { gv_itr = sup_itr->begin(); for ( ; gv_itr != sup_itr->end(); ++gv_itr ) { int cur_index = propTi->get_value( gv_itr->node_id() ); gstl_assert( ( cur_index >= 0 ) && ( cur_index < erosion_rules_.size() ) ); if ( cur_index != geobody_index_ ) { if ( erosion_rules_[cur_index] == 1 ) { // Decrease proportion of eroded index? propTi->set_value( geobody_index_, gv_itr->node_id() ); rasterizedVol_++; } } } } } delete hellip_; }
//! Generate a new item to visit based on the adjacent triangle at index next. boost::optional<edge_item> prepare_adjacent_traversal( std::size_t next, const edge_item& item ) { comparison_policy cmp( 0 ); bool allAround = get<0>( item.lo ) == constants::infinity<coordinate_type>() && get<0>( item.hi ) == constants::negative_infinity<coordinate_type>(); const std::size_t* fromIndices = m_mesh.get_triangle_indices( item.to ); const std::size_t* toIndices = m_mesh.get_triangle_indices( next ); std::size_t side = get_triangle_adjacent_side( fromIndices, toIndices ); auto pointLo = m_mesh.get_triangle_vertices( item.to )[side]; auto pointHi = m_mesh.get_triangle_vertices( item.to )[(side + 1) % 3]; if( exterior_product_area( pointHi - pointLo, m_origin - pointLo ) < constants::zero<decltype(std::declval<coordinate_type>() * std::declval<coordinate_type>())>() ) std::swap( pointLo, pointHi ); if (!is_segment_in_range_2d(make_segment(pointLo, pointHi), item.lo, item.hi, m_origin)) return boost::none; #if GEOMETRIX_TEST_ENABLED(GEOMETRIX_DEBUG_VISIBLE_VERTICES_MESH_SEARCH) //polygon2 pTri(mMesh.get_triangle_vertices(item.from), mMesh.get_triangle_vertices(item.from) + 3); typedef std::vector<point_t> polygon2; typedef segment<point_t> segment2; polygon2 cTri(m_mesh.get_triangle_vertices(item.to), m_mesh.get_triangle_vertices(item.to) + 3); polygon2 nTri(m_mesh.get_triangle_vertices(next), m_mesh.get_triangle_vertices(next) + 3); segment2 sLo{ m_origin, m_origin + item.lo }; segment2 sHi{ m_origin, m_origin + item.hi }; segment2 cLo{ m_origin, pointLo }; segment2 cHi{ m_origin, pointHi }; #endif vector_t vecLo, vecHi; if( !numeric_sequence_equals_2d(m_origin, pointLo, cmp) && !numeric_sequence_equals_2d(m_origin, pointHi, cmp) ) { assign( vecLo, pointLo - m_origin ); assign( vecHi, pointHi - m_origin ); if (!allAround) { vecLo = is_vector_between(item.lo, item.hi, vecLo, false, cmp) ? vecLo : item.lo; vecHi = is_vector_between(item.lo, item.hi, vecHi, false, cmp) ? vecHi : item.hi; } if (get_orientation(vecHi, vecLo, cmp) == geometrix::oriented_left) return boost::none; } else { assign( vecLo, constants::infinity<coordinate_type>(), constants::zero<coordinate_type>() ); assign( vecHi, constants::negative_infinity<coordinate_type>(), constants::zero<coordinate_type>() ); } #if GEOMETRIX_TEST_ENABLED(GEOMETRIX_DEBUG_VISIBLE_VERTICES_MESH_SEARCH) segment2 nLo{ m_origin, m_origin + vecLo }; segment2 nHi{ m_origin, m_origin + vecHi }; #endif return edge_item( item.to, next, vecLo, vecHi ); }
/* Exposed function to show one player's hand. */ void table_display_hand(int p, int write_to_screen) { int i; card_t table_card = table_cards[p]; int hand_size; #if 0 /* It looks like the server violates this, although it's probably a bug in the server. */ assert(table_ready && game_started); #endif /* The server may send out a hand of size 0 when we first connect, but we just want to ignore it. */ if (!table_ready) return; ggz_debug(DBG_TABLE, "Displaying hand for player %d.", p); /* redraw outer rectangle */ clear_card_area(p); draw_card_box(p); /* Draw the cards */ hand_size = preferences.collapse_hand ? ggzcards.players[p].hand.hand_size : ggzcards.players[p].u_hand_size; for (i = 0; i < hand_size; i++) { card_t card; int x, y; if (preferences.collapse_hand) card = ggzcards.players[p].hand.cards[i]; else { if (!ggzcards.players[p].u_hand[i].is_valid) continue; card = ggzcards.players[p].u_hand[i].card; } if (card.face >= 0 && card.face == table_card.face && card.suit >= 0 && card.suit == table_card.suit && card.deck >= 0 && card.deck == table_card.deck) /* if the player has a card on the table _and_ it matches this card, skip over it. */ continue; get_card_pos(p, i, p == ggzcards.play_hand && i == selected_card, &x, &y); draw_card(card, get_orientation(p), x, y, table_buf); } /* And refresh the on-screen image for card areas */ if (write_to_screen) show_card_area(p); }
bool splitter_window_impl::splitter_host_impl::request_resize(HWND wnd, unsigned flags, unsigned width, unsigned height) { bool rv = false; if (!(flags & (get_orientation() == horizontal ? ui_extension::size_height : uie::size_width))) { if (flags & (get_orientation() == vertical ? ui_extension::size_height : uie::size_width)) { unsigned index; if (m_this->m_panels.find_by_wnd_child(wnd, index)) { int delta = (get_orientation() == horizontal ? width : height) - m_this->m_panels[index]->m_size; m_this->override_size(index, delta); rv = true; } } else rv = true; } return rv; }
static void send_orientation(struct altcp_pcb *pcb) { uint8_t buf[5]; buf[0] = RES_ORIENTATION; int16_t *qdata = (int16_t *)&buf[1]; orientation my_orientation = get_orientation(); qdata[0] = my_orientation.sin_pitch / 2; qdata[1] = my_orientation.sin_roll / 2; httpd_websocket_write(pcb, buf, sizeof(buf), WS_BIN_MODE); }
void track_bar_impl::draw_channel (HDC dc, const RECT * rc) const { if (get_theme_handle()) { DrawThemeBackground(get_theme_handle(), dc, get_orientation() ? TKP_TRACKVERT : TKP_TRACK, TUTS_NORMAL, rc, 0); } else { RECT rc_temp = *rc; DrawEdge (dc, &rc_temp, EDGE_SUNKEN, BF_RECT); } }
bool splitter_window_impl::get_config_item(unsigned index, const GUID & p_type, stream_writer * p_out, abort_callback & p_abort) const { if (is_index_valid(index)) { if (p_type == uie::splitter_window::bool_show_caption) { p_out->write_object_t(m_panels[index]->m_show_caption, p_abort); return true; } else if (p_type == uie::splitter_window::bool_hidden) { p_out->write_object_t(m_panels[index]->m_hidden, p_abort); return true; } else if (p_type == uie::splitter_window::bool_autohide) { p_out->write_object_t(m_panels[index]->m_autohide, p_abort); return true; } else if (p_type == uie::splitter_window::bool_locked) { p_out->write_object_t(m_panels[index]->m_locked, p_abort); return true; } else if (p_type == uie::splitter_window::uint32_orientation) { p_out->write_object_t(m_panels[index]->m_caption_orientation, p_abort); return true; } else if (p_type == uie::splitter_window::uint32_size) { p_out->write_object_t(m_panels[index]->m_size, p_abort); return true; } else if (p_type == uie::splitter_window::bool_show_toggle_area && get_orientation() == horizontal) { p_out->write_object_t(m_panels[index]->m_show_toggle_area, p_abort); return true; } else if (p_type == uie::splitter_window::bool_use_custom_title) { p_out->write_object_t(m_panels[index]->m_use_custom_title, p_abort); return true; } else if (p_type == uie::splitter_window::string_custom_title) { p_out->write_string(m_panels[index]->m_custom_title, p_abort); return true; } return false; } return false; }
void trimesh::update() { double qx, qy, qz, qw, x, y, z; get_orientation(qx, qy, qz, qw); get_position(x, y, z); quaterniond quat(qx, qy, qz, qw); matrix_3dd matrix; quat.create_matrix(matrix); matrix.translate(x, y, z); dReal* matrix_data = (dReal*)matrix.raw_matrix(); dGeomTriMeshSetLastTransform(geom_id, matrix_data); }
void splitter_window_impl::on_size_changed(unsigned width, unsigned height) { pfc::list_t<unsigned> sizes; get_panels_sizes(width, height, sizes); unsigned count = m_panels.get_count(); RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE); HDWP dwp = BeginDeferWindowPos(m_panels.get_count()); if (dwp) { unsigned size_cumulative = 0, n; for (n = 0; n<count; n++) { if (m_panels[n]->m_child.is_valid() && m_panels[n]->m_wnd) { unsigned size = sizes[n]; unsigned x = get_orientation() == horizontal ? size_cumulative : 0; unsigned y = get_orientation() == horizontal ? 0 : size_cumulative; unsigned cx = get_orientation() == horizontal ? size - get_panel_divider_size(n) : width; unsigned cy = get_orientation() == horizontal ? height : size - get_panel_divider_size(n); dwp = DeferWindowPos(dwp, m_panels[n]->m_wnd, 0, x, y, cx, cy, SWP_NOZORDER); size_cumulative += size; } } EndDeferWindowPos(dwp); } RedrawWindow(get_wnd(), NULL, NULL, RDW_UPDATENOW); }
bool splitter_window_impl::get_config_item_supported(unsigned index, const GUID & p_type) const { if (is_index_valid(index)) { if (p_type == uie::splitter_window::bool_show_caption || p_type == uie::splitter_window::bool_locked || p_type == uie::splitter_window::bool_hidden || p_type == uie::splitter_window::uint32_orientation || p_type == uie::splitter_window::bool_autohide || (p_type == uie::splitter_window::bool_show_toggle_area && get_orientation() == horizontal) || p_type == uie::splitter_window::uint32_size || p_type == uie::splitter_window::bool_use_custom_title || p_type == uie::splitter_window::string_custom_title ) return true; } return false; }
static void gstyle_slidein_compute_child_allocation (GstyleSlidein *self, GtkAllocation parent_alloc, GtkAllocation *child_alloc) { GtkRequisition min_child_req, nat_child_req; gint slide_max_visible_size; gint margin; gint offset_x = 0; gint offset_y = 0; child_alloc->width = parent_alloc.width; child_alloc->height = parent_alloc.height; gtk_widget_get_preferred_size (self->overlay_child, &min_child_req, &nat_child_req); /* TODO: handle padding / margin */ if (get_orientation (self) == GTK_ORIENTATION_HORIZONTAL) { margin = MIN (self->slide_margin, parent_alloc.width); slide_max_visible_size = parent_alloc.width - margin; child_alloc->width = MAX (MAX (slide_max_visible_size * self->slide_fraction, 1), min_child_req.width); if (self->real_direction == GSTYLE_SLIDEIN_DIRECTION_TYPE_LEFT) offset_x = parent_alloc.width - (child_alloc->width * self->offset) + 0.5; else offset_x = (self->offset - 1) * child_alloc->width + 0.5; } else { margin = MIN (self->slide_margin, parent_alloc.height); slide_max_visible_size = parent_alloc.height - margin; child_alloc->height = MAX (MAX (slide_max_visible_size * self->slide_fraction, 1), min_child_req.height); if (self->direction_type == GSTYLE_SLIDEIN_DIRECTION_TYPE_UP) offset_y = parent_alloc.height - (child_alloc->height * self->offset) + 0.5; else offset_y = (self->offset - 1) * child_alloc->height + 0.5; } child_alloc->x = parent_alloc.x + offset_x; child_alloc->y = parent_alloc.y + offset_y; }
void third_person_cam::update(level_graph const& level, agent const& player, float_t dtime) { vec_t player_pos = level.get_agent_position(player); vec_t player_dir = level.get_agent_direction(player); orient_t player_orient = lookat_orientation(player_dir, player.up); vec_t ideal_pos = calc_ideal_position(player_pos, player_orient); orient_t ideal_orientation = calc_ideal_orientation(player_pos, player_orient); vec_t cur_pos = get_position(); // Let's try, moving proportionally to distance, such that in 1 second we would move the whole way (if happened in single step) float const cam_move = dtime * move_speed_factor; set_position(cur_pos + (ideal_pos - cur_pos) * std::min(cam_move, 1.0f)); orient_t cur_orientation = get_orientation(); float const cam_slerp = dtime * slerp_speed_factor; orient_t interpolated = cur_orientation.slerp(std::min(cam_slerp, 1.0f), ideal_orientation); set_orientation(interpolated); }
/** * gstyle_slidein_reveal_slide: * @reveal: %TRUE to reveal or %FALSE to close the slide * * Reveal or close the slide. * * Returns: #TRUE if the action can be executed, otherwise, %FALSE if the slide is already * in its final position, that is revealed or closed. */ gboolean gstyle_slidein_reveal_slide (GstyleSlidein *self, gboolean reveal) { GtkStyleContext *context; GtkStateFlags state; g_return_val_if_fail (GSTYLE_IS_SLIDEIN (self), FALSE); context = gtk_widget_get_style_context (GTK_WIDGET (self)); state = gtk_style_context_get_state (context); if (get_orientation (self) == GTK_ORIENTATION_HORIZONTAL) self->real_direction = (!!(state & GTK_STATE_FLAG_DIR_LTR)) ? self->direction_type : self->direction_type_reverse; else self->real_direction = self->direction_type; return animate (self, reveal ? 1.0 : 0.0); }
static gdouble compute_duration (GstyleSlidein *self) { GtkWidget *child; GtkRequisition min_req_size; GtkRequisition nat_req_size; gdouble duration = 0.0; g_assert (GSTYLE_IS_SLIDEIN (self)); child = gtk_bin_get_child (GTK_BIN (self)); gtk_widget_get_preferred_size (child, &min_req_size, &nat_req_size); if (get_orientation (self) == GTK_ORIENTATION_HORIZONTAL) duration = MAX (300, (nat_req_size.width - self->slide_margin) * self->slide_fraction * 1.2); else duration = MAX (300, (nat_req_size.height - self->slide_margin) * self->slide_fraction * 1.2); return duration; }
void track_bar_impl::get_thumb_rect(unsigned pos, unsigned range, RECT * rc) const { RECT rc_client; GetClientRect(get_wnd(), &rc_client); unsigned cx = calculate_thumb_size(); if (get_orientation()) { rc->left = 2; rc->right = rc_client.right - 2; rc->top = range ? MulDiv(get_direction() ? range-pos : pos, rc_client.bottom-cx, range) : get_direction() ? rc_client.bottom-cx : 0; rc->bottom = rc->top + cx; } else { rc->top = 2; rc->bottom = rc_client.bottom - 2; rc->left = range ? MulDiv(get_direction() ? range-pos : pos, rc_client.right-cx, range) : get_direction() ? rc_client.right-cx : 0; rc->right = rc->left + cx; } }
int main(int argc, char** argv){ //Node setup ros::init(argc, argv, "chad_laser_node"); ros::NodeHandle n;//global ros::NodeHandle nh("~");//local std::string pose_namespace, laser_namespace, pole_namespace; //read in params nh.param("ekf_namespace",pose_namespace,std::string("/redblade_ekf/2d_pose")); nh.param("laser_namespace",laser_namespace,std::string("/scan")); nh.param("pole_namespace",pole_namespace,std::string("/lidar/pole")); nh.param("survey_file",survey_file,std::string("/home/redblade/Documents/Redblade/config/survey_enu.csv")); nh.param("single_or_triple",single_i,true); //Subscribe to the EKF topic ros::Subscriber pose_sub = n.subscribe(pose_namespace, 1, poseCallback); //Subscribe to laser scan topic ros::Subscriber scan_pub = n.subscribe<sensor_msgs::LaserScan> (laser_namespace, 1, scanCallback); //Set up publisher for pole point pole_pub = n.advertise<geometry_msgs::PointStamped>(pole_namespace, 1); //lidar_file.open("/home/redblade/Documents/Redblade/lidar_collect.csv"); read_in_survey_points(); get_orientation(); //filter index filter_index = 0; ros::AsyncSpinner spinner(2); spinner.start(); while(ros::ok()){ //we can do other stuff in here if we need to usleep(50000); } spinner.stop(); }