// verify_circle - check if we have circled the point enough bool Copter::ModeAuto::verify_circle(const AP_Mission::Mission_Command& cmd) { // check if we've reached the edge if (mode() == Auto_CircleMoveToEdge) { if (wp_nav->reached_wp_destination()) { const Vector3f curr_pos = _copter.inertial_nav.get_position(); Vector3f circle_center = _copter.pv_location_to_vector(cmd.content.location); // set target altitude if not provided if (is_zero(circle_center.z)) { circle_center.z = curr_pos.z; } // set lat/lon position if not provided if (cmd.content.location.lat == 0 && cmd.content.location.lng == 0) { circle_center.x = curr_pos.x; circle_center.y = curr_pos.y; } // start circling circle_start(); } return false; } // check if we have completed circling return fabsf(circle_nav->get_angle_total()/M_2PI) >= LOWBYTE(cmd.p1); }
void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& aData ) { DRAWSEGMENT* segm = ( m_useModuleItems ) ? static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT; segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetShape( S_CIRCLE ); wxPoint center( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) ); segm->SetCenter( center ); wxPoint circle_start( mapX( aData.basePoint.x + aData.radious ), mapY( aData.basePoint.y ) ); segm->SetArcStart( circle_start ); segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) ); m_newItemsList.push_back( segm ); }
/* * Import Circle entities. */ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); segm->SetLayer( m_brdLayer ); segm->SetShape( S_CIRCLE ); wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); segm->SetCenter( center ); wxPoint circle_start( mapX( data.basePoint.x + data.radious ), mapY( data.basePoint.y ) ); segm->SetArcStart( circle_start ); segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) ); appendToBoard( segm ); }