void SCH_SHEET_PIN::SetEdge( int aEdge ) { SCH_SHEET* Sheet = (SCH_SHEET*) GetParent(); /* use -1 to adjust text orientation without changing edge*/ if( aEdge > -1 ) m_edge = aEdge; switch( m_edge ) { case 0: /* pin on left side*/ m_Pos.x = Sheet->m_pos.x; SetOrientation( 2 ); /* Orientation horiz inverse */ break; case 1: /* pin on right side*/ m_Pos.x = Sheet->m_pos.x + Sheet->m_size.x; SetOrientation( 0 ); /* Orientation horiz normal */ break; case 2: /* pin on top side*/ m_Pos.y = Sheet->m_pos.y; SetOrientation( 3 ); /* Orientation vert BOTTOM */ break; case 3: /* pin on bottom side*/ m_Pos.y = Sheet->m_pos.y + Sheet->m_size.y; SetOrientation( 1 ); /* Orientation vert UP */ break; } }
//***************************************************************************************** void CAnt::Process( //Process an ant for movement. //Params: const int /*nLastCommand*/, //(in) Last swordsman command. CCueEvents &CueEvents) //(in/out) Accepts pointer to a cues object that will be populated //with codes indicating events that happened that may correspond to //sound or graphical effects. { //If another monster has already got the player, don't move this one there too. if (CueEvents.HasOccurred(CID_MonsterKilledPlayer)) return; //Decide where to move to. UINT wSX, wSY; if (!GetTarget(wSX,wSY)) return; //If next to the target then jump out and kill it. //The ant is not killed, but is largely immobile out of water. if (abs(static_cast<int>(this->wX - wSX)) <= 1 && abs(static_cast<int>(this->wY - wSY)) <= 1) { bool bAttack = this->pCurrentGame->IsPlayerAt(wSX, wSY); if (!bAttack) { CMonster *pMonster = this->pCurrentGame->pRoom->GetMonsterAtSquare(wSX, wSY); if (pMonster && pMonster->IsAttackableTarget()) bAttack = true; } if (bAttack) { //Move onto target if possible. const int dx = wSX - this->wX; const int dy = wSY - this->wY; const UINT wOSquare = this->pCurrentGame->pRoom->GetOSquare(wSX,wSY); if (!(bIsWall(wOSquare) || bIsCrumblyWall(wOSquare) || bIsDoor(wOSquare) || DoesArrowPreventMovement(dx, dy) || this->pCurrentGame->pRoom->DoesSquarePreventDiagonal(this->wX, this->wY, dx, dy))) { MakeStandardMove(CueEvents, dx, dy); SetOrientation(dx, dy); return; } } } //Get movement offsets. int dxFirst, dyFirst, dx, dy; if (!GetDirectMovement(wSX, wSY, dxFirst, dyFirst, dx, dy)) return; //Move roach to new destination square. MakeStandardMove(CueEvents,dx,dy); SetOrientation(dxFirst, dyFirst); }
void TabBar::mouseDoubleClickEvent(QMouseEvent *) { if (orientation_ == Qt::Horizontal) { SetOrientation(Qt::Vertical); } else { SetOrientation(Qt::Horizontal); } }
void Node::SetGlobalOrientation(const Quaternion& q) { PNode parent = parent_.lock(); if (parent == nullptr) { SetOrientation(q); } else { SetOrientation(Normalize(Quaternion(parent->GetGlobalModelInvMatrix()) * q)); } }
void SCH_HIERLABEL::MirrorX( int aXaxis_position ) { switch( GetOrientation() ) { case 1: /* vertical text */ SetOrientation( 3 ); break; case 3: /* invert vertical text*/ SetOrientation( 1 ); break; } MIRROR( m_Pos.y, aXaxis_position ); }
void Notebook::OnRender(wxAuiManagerEvent &e) { if (m_aui) { wxAuiPaneInfo info = m_aui->GetPane( m_paneName ); if (info.IsOk()) { //we got the containing pane of the book, test its orientation if (info.dock_direction == wxAUI_DOCK_LEFT && m_style & wxVB_RIGHT) { SetOrientation(wxVB_LEFT); } else if (info.dock_direction == wxAUI_DOCK_RIGHT && m_style & wxVB_LEFT) { SetOrientation(wxVB_RIGHT); } } } e.Skip(); }
// |----------------------------------------------------------------------------| // | Logic() | // |----------------------------------------------------------------------------| bool Player::Logic() { DebugLog ("Player: Logic() called.", DB_LOGIC, 10); // If crashed, don't process if (m_crashed) return true; // Get time for this frame float time = TimerManager::GetRef()->GetTime() / 1000; // TODO: Get player input (Update direction, speed), set camera based on this // For now, keep using mouselookcamera and get it from the camera Camera* camera = GraphicsManager::GetRef()->GetCamera(); Coord cameraOrientation = camera->GetOrientation(); SetOrientation(Coord( 0.0f+cameraOrientation.y*3.14/180, -1*(3.14f/6.0f)+cameraOrientation.x*3.14/180, 0.0f+cameraOrientation.z*3.14/180)); // Ship just stays with the camera Coord localPos( 10.0f*sin(3.14/2-cameraOrientation.x*3.14/180-1*(3.14f/16.0f))*sin(cameraOrientation.y*3.14/180), -10.0f*cos(3.14/2-cameraOrientation.x*3.14/180-1*(3.14f/16.0f)), 10.0f*sin(3.14/2-cameraOrientation.x*3.14/180-1*(3.14f/16.0f))*cos(cameraOrientation.y*3.14/180) ); Coord unbounded = localPos + camera->GetPosition(); m_linearVelocity = unbounded - m_position; SetPosition(unbounded); localPos = Coord( 9.3f*sin(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f))*sin(cameraOrientation.y*3.14/180-0.6*(3.14f/32.0f)), -9.3f*cos(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f)), 9.3f*sin(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f))*cos(cameraOrientation.y*3.14/180-0.6*(3.14f/32.0f)) ); m_leftThruster->SetPosition(localPos+camera->GetPosition()); localPos = Coord( 9.3f*sin(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f))*sin(cameraOrientation.y*3.14/180+0.6*(3.14f/32.0f)), -9.3f*cos(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f)), 9.3f*sin(3.14/2-cameraOrientation.x*3.14/180-1.25*(3.14f/16.0f))*cos(cameraOrientation.y*3.14/180+0.6*(3.14f/32.0f)) ); m_rightThruster->SetPosition(localPos+camera->GetPosition()); // Alternate controlling method: //Coord unbounded(camera->GetPosition()+Coord(0.0f,-2.0f,10.0f)); // If the position gets too far from the camera direction vector, move it to that point. // Need bounding points to left, right, up, and down. // Need to keep ship a certain distance from camera... // TODO: Update velocity of thrusters to shoot backwards Coord thrusterVel = Coord( sin(3.14/2-camera->GetOrientation().x*3.14/180+1.25*(3.14f/16.0f))*sin(camera->GetOrientation().y*3.14/180), -1*cos(3.14/2-camera->GetOrientation().x*3.14/180+1.25*(3.14f/16.0f)), sin(3.14/2-camera->GetOrientation().x*3.14/180+1.25*(3.14f/16.0f))*cos(camera->GetOrientation().y*3.14/180) ); thrusterVel *= -2.0f; m_leftThruster->SetParticleVelocity(thrusterVel); m_rightThruster->SetParticleVelocity(thrusterVel); // Call logic functions for child objects m_ship->Logic(); m_leftThruster->Logic(); m_rightThruster->Logic(); return true; }
void AppearanceAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("AppearanceAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("useSystemDefault")) != 0) SetUseSystemDefault(node->AsBool()); if((node = searchNode->GetNode("background")) != 0) SetBackground(node->AsString()); if((node = searchNode->GetNode("foreground")) != 0) SetForeground(node->AsString()); if((node = searchNode->GetNode("fontName")) != 0) SetFontName(node->AsString()); if((node = searchNode->GetNode("style")) != 0) SetStyle(node->AsString()); if((node = searchNode->GetNode("orientation")) != 0) SetOrientation(node->AsInt()); if((node = searchNode->GetNode("defaultForeground")) != 0) SetDefaultForeground(node->AsString()); if((node = searchNode->GetNode("defaultBackground")) != 0) SetDefaultBackground(node->AsString()); if((node = searchNode->GetNode("defaultFontName")) != 0) SetDefaultFontName(node->AsString()); if((node = searchNode->GetNode("defaultStyle")) != 0) SetDefaultStyle(node->AsString()); if((node = searchNode->GetNode("defaultOrientation")) != 0) SetDefaultOrientation(node->AsInt()); }
void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle ) { wxPoint newpos = m_Pos; RotatePoint( &newpos, aRotCentre, aAngle ); SetPosition( newpos ); SetOrientation( GetOrientation() + aAngle ); }
Shock::Shock(class PlayerAI *player, Vector &direction){ mat = new Material("Textures/Shield/Shield",Texture::cARGB); mat->SetMode(MATERIAL_DEST_ADD_SOURCE); Geometry *g = new Geometry(); g->SetName(0,"Shock"); g->Apply(mat); g->Add(Vector(-25000, 25000,0)); g->Add(Vector( 25000, 25000,0)); g->Add(Vector( 25000,-25000,0)); g->Add(Vector(-25000,-25000,0)); g->Add(Vertex(0,0,0)); g->Add(Vertex(1,1,0)); g->Add(Vertex(2,1,1)); g->Add(Vertex(3,0,1)); IndexedPolygon *pol; pol = g->NewIndexedPolygon(); //new IndexedPolygon(g); pol->Add(0); pol->Add(1); pol->Add(2); pol->Add(3); Intelligence::Apply(g); g->Node::Apply(0,this); player->GetCreatorGeometry()->Node::Apply(0,g); SetPosition(Vector(0,0,0)); Quaternion dir = Quaternion(direction.X,-direction.Y,0,0); SetOrientation(Quaternion(dir)); Spawn = -1.0f; }
CRABEquippedEntity::CRABEquippedEntity(CComposableEntity* pc_parent, const std::string& str_id, size_t un_msg_size, Real f_range, const SAnchor& s_anchor, CEmbodiedEntity& c_entity_body, const CVector3& c_pos_offset, const CQuaternion& c_rot_offset) : CPositionalEntity(pc_parent, str_id), m_psAnchor(&s_anchor), m_cPosOffset(c_pos_offset), m_cRotOffset(c_rot_offset), m_cData(un_msg_size), m_fRange(f_range), m_pcEntityBody(&c_entity_body) { Disable(); SetCanBeEnabledIfDisabled(false); CVector3 cPos = c_pos_offset; cPos.Rotate(s_anchor.Orientation); cPos += s_anchor.Position; SetInitPosition(cPos); SetPosition(cPos); SetInitOrientation(s_anchor.Orientation * c_rot_offset); SetOrientation(GetInitOrientation()); }
bool PoolTeeBox::Load(File* pf) { // Get vertex. if (!pf->GetFloat(&m_teeVertex.x) || !pf->GetFloat(&m_teeVertex.y) || !pf->GetFloat(&m_teeVertex.z)) { pf->ReportError("Failed to load tee box vertex."); return false; } m_bs.SetCentre(m_teeVertex); m_bs.SetRadius(TEE_BOX_DECAL_SIZE); SetShadowSize(TEE_BOX_DECAL_SIZE); // TODO TEMP TEST CreateShadow(); Orientation o; o.SetVertex(m_teeVertex); SetOrientation(o); TEE_BOX_DECAL_SIZE = Engine::Instance()->GetConfigFloat("golf_tee_size"); return true; }
void Position::RelocateOffset(const Position & offset) { m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI))); m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation())); m_positionZ = GetPositionZ() + offset.GetPositionZ(); SetOrientation(GetOrientation() + offset.GetOrientation()); }
bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) { char Name1[256]; char Name2[256]; char Name3[256]; int thickness = 0, size = 0, orient = 0; Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; char* sline = (char*) aLine; while( ( *sline != ' ' ) && *sline ) sline++; // sline points the start of parameters int ii = sscanf( sline, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y, &orient, &size, Name2, Name3, &thickness ); if( ii < 4 ) { aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), aLine.LineNumber() ); return false; } if( !aLine.ReadLine() ) { aErrorMsg.Printf( wxT( "Eeschema file label load error atline %d" ), aLine.LineNumber() ); return false; } if( size == 0 ) size = DEFAULT_SIZE_TEXT; char* text = strtok( (char*) aLine, "\n\r" ); if( text == NULL ) { aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), aLine.LineNumber() ); return false; } m_Text = FROM_UTF8( text ); m_Size.x = m_Size.y = size; SetOrientation( orient ); if( isdigit( Name3[0] ) ) { thickness = atol( Name3 ); m_Bold = ( thickness != 0 ); m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0; } if( stricmp( Name2, "Italic" ) == 0 ) m_Italic = 1; return true; }
void HKWidgetLayoutLinear::SetProperty(const char *pProperty, const char *pValue) { if(!MFString_CaseCmp(pProperty, "orientation")) SetOrientation((Orientation)HKWidget_GetEnumValue(pValue, sOrientationKeys)); else HKWidgetLayout::SetProperty(pProperty, pValue); }
void SCH_TEXT::Rotate( wxPoint aPosition ) { int dy; RotatePoint( &m_Pos, aPosition, 900 ); SetOrientation( (GetOrientation() + 1) % 4 ); switch( GetOrientation() ) { case 0: // horizontal text dy = m_Size.y; break; case 1: // Vert Orientation UP dy = 0; break; case 2: // invert horizontal text dy = m_Size.y; break; case 3: // Vert Orientation BOTTOM dy = 0; break; default: dy = 0; break; } m_Pos.y += dy; }
void CRABEquippedEntity::Update() { CVector3 cPos = m_cPosOffset; cPos.Rotate(m_psAnchor->Orientation); cPos += m_psAnchor->Position; SetPosition(cPos); SetOrientation(m_psAnchor->Orientation * m_cRotOffset); }
void Node::ShowGUIProperties(Editor* editor) { std::string header = "Transform:" + GetName(); if (ImGui::TreeNode(header.c_str())) { auto position = GetPosition(); ImGui::DragFloat3("Position", &position[0], 0.1f); SetPosition(position); auto guiRotation = GetGUIRotation(); auto oldRotation = Radians(guiRotation); ImGui::DragFloat3("Rotation", &guiRotation[0], 1, 0, 360); auto rad = Radians(guiRotation); auto q = GetOrientation(); q *= Inverse(Quaternion(oldRotation)) * Quaternion(rad); SetOrientation(q); SetGUIRotation(guiRotation); auto scale = GetScale(); ImGui::DragFloat3("Scale", &scale[0], 0.1f); SetScale(scale); ImGui::TreePop(); } }
void D_PAD::ImportSettingsFromMaster( const D_PAD& aMasterPad ) { SetShape( aMasterPad.GetShape() ); SetLayerSet( aMasterPad.GetLayerSet() ); SetAttribute( aMasterPad.GetAttribute() ); // The pad orientation, for historical reasons is the // pad rotation + parent rotation. // So we have to manage this parent rotation double pad_rot = aMasterPad.GetOrientation(); if( aMasterPad.GetParent() ) pad_rot -= aMasterPad.GetParent()->GetOrientation(); if( GetParent() ) pad_rot += GetParent()->GetOrientation(); SetOrientation( pad_rot ); SetSize( aMasterPad.GetSize() ); SetDelta( wxSize( 0, 0 ) ); SetOffset( aMasterPad.GetOffset() ); SetDrillSize( aMasterPad.GetDrillSize() ); SetDrillShape( aMasterPad.GetDrillShape() ); SetRoundRectRadiusRatio( aMasterPad.GetRoundRectRadiusRatio() ); switch( aMasterPad.GetShape() ) { case PAD_SHAPE_TRAPEZOID: SetDelta( aMasterPad.GetDelta() ); break; case PAD_SHAPE_CIRCLE: // ensure size.y == size.x SetSize( wxSize( GetSize().x, GetSize().x ) ); break; default: ; } switch( aMasterPad.GetAttribute() ) { case PAD_ATTRIB_SMD: case PAD_ATTRIB_CONN: // These pads do not have hole (they are expected to be only on one // external copper layer) SetDrillSize( wxSize( 0, 0 ) ); break; default: ; } // Add or remove custom pad shapes: SetPrimitives( aMasterPad.GetPrimitives() ); SetAnchorPadShape( aMasterPad.GetAnchorPadShape() ); MergePrimitivesAsPolygon(); }
void TEXTE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle ) { // Used in footprint edition // Note also in module editor, m_Pos0 = m_Pos RotatePoint( &m_Pos, aRotCentre, aAngle ); SetOrientation( GetOrientation() + aAngle ); SetLocalCoord(); }
void Viewpoint::SetOrientation( double angle, Vector3 axis ) { Matrix3x3 m; SetRotationMatrix( m, ToRadians( angle ), axis ); SetOrientation( m ); }
void SCH_HIERLABEL::MirrorX( int aXaxis_position ) { switch( GetOrientation() ) { case 1: /* vertical text */ SetOrientation( 3 ); break; case 3: /* invert vertical text*/ SetOrientation( 1 ); break; } m_Pos.y -= aXaxis_position; NEGATE( m_Pos.y ); m_Pos.y += aXaxis_position; }
void OpenGLObject::SetOrientation( double angle, const Vector3 axis ) { Matrix3x3 m; SetRotationMatrix( m, ToRadians( angle ), axis ); SetOrientation( m ); }
BChannelSlider::BChannelSlider(BRect area, const char* name, const char* label, BMessage* model, enum orientation orientation, int32 channels, uint32 resizeMode, uint32 flags) : BChannelControl(area, name, label, model, channels, resizeMode, flags) { _InitData(); SetOrientation(orientation); }
BChannelSlider::BChannelSlider(const char* name, const char* label, BMessage* model, enum orientation orientation, int32 channels, uint32 flags) : BChannelControl(name, label, model, channels, flags) { _InitData(); SetOrientation(orientation); }
void CUIFrameLine::Init(LPCSTR base_name, float x, float y, float size, bool horizontal, DWORD align) { SetPos (x, y); SetSize (size); SetAlign (align); SetOrientation (horizontal); InitTexture(base_name); }
void Node::SetGlobalLookAtDirection(const Vertex3& direction) { float length = Length(direction); if (length > 0) { auto rot = QuaternionFromLookRotation(-direction, GetUpDirection()); PNode parent = parent_.lock(); if (parent) { Quaternion q = Inverse(parent->GetGlobalOrientation()); SetOrientation(q * rot); } else { SetOrientation(rot); } } }
void ItemView::Init(inventory::ItemPtr item) { SetOrientation(OrientationHorizontal); mItemIcon = IconPtr(new Icon(item->GetIcon())); mItemLabel = LabelPtr(new Label(item->GetTag())); mItemIcon->SetSize(32, 32); AddChild(mItemIcon); AddChild(mItemLabel); }
BChannelSlider::BChannelSlider(BMessage* archive) : BChannelControl(archive) { _InitData(); orientation orient; if (archive->FindInt32("_orient", (int32*)&orient) == B_OK) SetOrientation(orient); }
void WorldNode::SetDirection(const Vector3& Direction, const Mezzanine::TransformSpace& TS, const Vector3& LocalAxis) { static const Vector3 Zero(0,0,0); if(Direction == Zero) return; Vector3 NormalizedDir = Direction.GetNormal(); switch(TS) { default: case Mezzanine::TS_World: { // Do nothing break; } case Mezzanine::TS_Local: { NormalizedDir = GetOrientation() * NormalizedDir; break; } case Mezzanine::TS_Parent: { if(Parent) NormalizedDir = Parent->GetOrientation() * NormalizedDir; else return; /// @todo May want to change this to an exception, maybe. break; } } Quaternion FinalOrientation; if(FixedYaw) { Vector3 XVec = FixedYawAxis.CrossProduct(NormalizedDir); XVec.Normalize(); Vector3 YVec = NormalizedDir.CrossProduct(XVec); YVec.Normalize(); Quaternion ZToTarget(XVec,YVec,NormalizedDir); if(LocalAxis == Vector3::Neg_Unit_Z()) { FinalOrientation.SetValues(-ZToTarget.Y,-ZToTarget.Z,ZToTarget.W,ZToTarget.X); }else{ FinalOrientation = ZToTarget * (LocalAxis.GetRotationToAxis(Vector3::Unit_Z())); } }else{ Quaternion CurrOri = GetOrientation(); Vector3 CurrDir = CurrOri * LocalAxis; if( (CurrDir+NormalizedDir).SquaredLength() < 0.00005 ) { FinalOrientation.SetValues(-CurrOri.Y,-CurrOri.Z,CurrOri.W,CurrOri.X); }else{ FinalOrientation = (CurrDir.GetRotationToAxis(NormalizedDir)) * CurrOri; } } SetOrientation(FinalOrientation); }