protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
			out Vec3 up, ref Degree cameraFov )
        {
            position = Vec3.Zero;
            forward = Vec3.XAxis;
            up = Vec3.ZAxis;

            Unit unit = GetPlayerUnit();
            if( unit == null )
                return;

            PlayerIntellect.Instance.FPSCamera = false;

            //To use data about orientation the camera if the cut scene is switched on
            if( IsCutSceneEnabled() )
            {
                if( CutSceneManager.Instance.GetCamera( out position, out forward, out up, out cameraFov ) )
                    return;
            }

            float distance = 25;
            position = unit.GetInterpolatedPosition() + new Vec3( 0, -distance, 0 );
            forward = Vec3.YAxis;
            up = Vec3.ZAxis;
        }
Beispiel #2
0
        /**
         * @param margin Collision margin
         * @param switchingMode Determine the state of the camera when switching to this camera mode from another
         */
        public FreeCameraMode(CameraControlSystem cam
              , Vector3 initialPosition
              , Degree initialRotationX
              , Degree initialRotationY
              , SwitchingMode switchingMode = SwitchingMode.CurrentState
              , float margin = 0.1f)
            : base(cam)
        {
            CameraCS = cam;
            Margin = margin;

            _fixedAxis = Vector3.UNIT_Y;
            _moveFactor = 1;
            _rotationFactor = 0.13f;
            _rotX = initialRotationX;
            _rotY = initialRotationY;
            _initialPosition = initialPosition;
            _initialRotationX = initialRotationX;
            _initialRotationY = initialRotationY;
            _lastRotationX = initialRotationX;
            _lastRotationY = initialRotationY;
            _lastPosition = initialPosition;
            _switchingMode = switchingMode;

            CameraPosition = initialPosition;

            this.CollisionFunc = this.DefaultCollisionDetectionFunction;
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Teacher ta = new Teacher();
            Course cu = new Course("Programming with C#");
           
            for(int i = 1; i <= 3 ; i++){
                Student student = new Student("student"+i, "a" + i);
                for (int j = 0; j <= 4; j++) {
                    student.Grades.Push(100-(j*10));
                }
                   
                    cu.AddStudent(student);
            }

            cu.ListStudent();
            ta.FirstName = "ta";
            ta.LastName = "1";

            Degree dg = new Degree("Bachelor");

            UProgram up = new UProgram("Information Technology");

            Console.WriteLine("The {0} program contains the {1} of Science degree\r\n", up.ProgrameName, dg.DegreeName);
            Console.WriteLine("The {0} of Science degree contains the course {1}\r\n", dg.DegreeName, cu.CourseName);
            Console.WriteLine("The {0} course contain {1} studeent(s)", cu.CourseName, cu.countnum);
            Console.WriteLine("Press any key to continue....");
            Console.ReadKey();
        }
        public bool AddBulletAndHit(VanillaCharacter source, Vector3 decalage, VanillaCharacter target)
        {
            Vector3 sourcePoint = source.FeetPosition + (source.Size.y / 2) * Vector3.UNIT_Y + decalage;
            Vector3 targetPoint = target.FeetPosition + target.Size.y / 2 * Vector3.UNIT_Y;
            Vector3 diff = targetPoint - sourcePoint;
            if (Math.Abs(diff.y / Cst.CUBE_SIDE) > 6) { return false; }

            Degree pitch = -Math.ATan2(diff.y,  diff.z);
            Degree yaw = source.GetYaw();
            if (yaw.ValueAngleUnits > 90 && yaw.ValueAngleUnits < 270)
            {
                yaw *= -1;
                yaw += new Degree(180);
            }

            float targetDistance = diff.Length;
            Ray ray = new Ray(sourcePoint + Vector3.NEGATIVE_UNIT_Z, diff.NormalisedCopy);
            float blockDistance = VanillaBlock.getBlockOnRay(source.getIsland(), ray, Bullet.DEFAULT_RANGE, 30);
            if (targetDistance > blockDistance) { return false; }

            SceneNode pitchNode = this.SceneMgr.RootSceneNode.CreateChildSceneNode();
            pitchNode.Position = sourcePoint;
            pitchNode.Pitch(pitch);

            SceneNode yawNode = pitchNode.CreateChildSceneNode();
            yawNode.Yaw(yaw);
            yawNode.AttachObject(StaticRectangle.CreateLine(this.SceneMgr, Vector3.ZERO, new Vector3(0, 0, 15), ColoredMaterials.YELLOW));

            this.mBullets.Add(new Bullet(source, target, pitchNode, yawNode));
            return true;
        }
Beispiel #5
0
 /// <summary>Создаёт трапециевидную область, содержащую все указанные точки</summary>
 /// <param name="Points">Массив точек, вокруг которых должна быть описана область</param>
 public EarthArea(params EarthPoint[] Points)
     : this()
 {
     MostWesternLongitude = new Degree(Points.Min(p => p.Longitude));
     MostEasternLongitude = new Degree(Points.Max(p => p.Longitude));
     MostSouthernLatitude = new Degree(Points.Min(p => p.Latitude));
     MostNorthenLatitude = new Degree(Points.Max(p => p.Latitude));
 }
Beispiel #6
0
		public void DegreesFromComponents()
		{
			Degree degree = new Degree(10, 20, 30, CoordinateType.Latitude);
			Assert.AreEqual(degree.CoordinateType, CoordinateType.Latitude);
			Assert.AreEqual(degree.Degrees, 10);
			Assert.AreEqual(degree.Minutes, 20);
			Assert.AreEqual(degree.Seconds, 30);
		}
Beispiel #7
0
 /// <summary>Создаёт трапециевидную область с указанными границами</summary>
 /// <param name="MostWesternLongitude">Западная граница области</param>
 /// <param name="MostEasternLongitude">Восточная граница области</param>
 /// <param name="MostNorthenLatitude">Северная граница области</param>
 /// <param name="MostSouthernLatitude">Южная граница области</param>
 public EarthArea(Degree MostWesternLongitude, Degree MostEasternLongitude, Degree MostNorthenLatitude,
                  Degree MostSouthernLatitude)
     : this()
 {
     this.MostSouthernLatitude = MostSouthernLatitude;
     this.MostNorthenLatitude = MostNorthenLatitude;
     this.MostEasternLongitude = MostEasternLongitude;
     this.MostWesternLongitude = MostWesternLongitude;
 }
 /// <summary>
 /// Creates a new instance of the LocRecord class.
 /// </summary>
 /// <param name="name">Name of the record.</param>
 /// <param name="timeToLive">Seconds the record should be cached at most.</param>
 /// <param name="version">Version number of representation.</param>
 /// <param name="size">Size of location in centimeters.</param>
 /// <param name="horizontalPrecision">Horizontal precision in centimeters.</param>
 /// <param name="verticalPrecision">Vertical precision in centimeters.</param>
 /// <param name="latitude">Latitude of the geographical position.</param>
 /// <param name="longitude">Longitude of the geographical position.</param>
 /// <param name="altitude">Altitude of the geographical position.</param>
 public LocRecord(string name, int timeToLive, byte version, double size, double horizontalPrecision, double verticalPrecision, Degree latitude, Degree longitude, double altitude)
     : base(name, RecordType.Loc, RecordClass.INet, timeToLive)
 {
     this.Version = version;
     this.Size = size;
     this.HorizontalPrecision = horizontalPrecision;
     this.VerticalPrecision = verticalPrecision;
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.Altitude = altitude;
 }
Beispiel #9
0
        // return between -1 and 1
        public static float GetFactor(Degree diffYaw)
        {
            float diffYawFloat = diffYaw.ValueAngleUnits;
            while (diffYawFloat > 180)   { diffYawFloat -= 360; }
            while (diffYawFloat <= -180) { diffYawFloat += 360; }
            int sign = System.Math.Sign(diffYawFloat);
            diffYawFloat *= sign;    // Take the abs value

            float factor = A * diffYawFloat * diffYawFloat + B * diffYawFloat; // Here factor is between 0 and 1
            return (factor > 1 ? 1 : factor) * sign;
        }
Beispiel #10
0
 public CMS(AEvent aDevice, CategoryType type, System.Collections.Hashtable ht, DeviceType devType, System.Collections.Hashtable DevRange, Degree degree)
 {
     Initialize(aDevice, type, ht, devType, DevRange, degree);
     this.GetMessRuleData += new GetMessRuleDataHandler(CMS_GetMessRuleData);
     List<object> messColors = (List<object>)com.select(DBConnect.DataType.MessColor, Command.GetSelectCmd.getMessColor());
     messColorsHT = new System.Collections.Hashtable();
     foreach (object obj in messColors)
     {
         MessColor mess = (MessColor)obj;
         messColorsHT.Add(mess.ID, mess);
     }
 }
        static void Main(string[] args)
        {
            // Creating three student objects, since it's at least three.

            Student stud1 = new Student("Surya", "Raman", "*****@*****.**");
            Student stud2 = new Student("Narendra", "Mdoi","*****@*****.**");
            Student stud3 = new Student("Barack", "Obama", "*****@*****.**");

            //Now creating the course object with dev204X

            Course course = new Course("DEV204X", 5);

            //Using the method at the end of this code to add students to course

            course.addStudent(stud1);
            course.addStudent(stud2);
            course.addStudent(stud3);

            // Creating one teacher object since that's the minimum number

            Teacher teacher = new Teacher("Bruce", "Wayne", "*****@*****.**");

            // Using the method at the end of this code to add teacher to course

            course.addTeacher(teacher);

            // Creating Degree object, assuming Computer Science and Engineering degree

            Degree degree = new Degree("Computer Science and Engineering", 250, null);

            // Adding Course object to the Degree object

            degree.Course = course;

            //Creating UProgram object with Bachelor of Engineering

            UProgram uProgram = new UProgram("Bachelor of Engineering", "Lex Luthor", null);

            // Adding the Degree object to the UProgram object

            uProgram.Degree = degree;

            // Printing everything as per the Assignment instructions

            Console.WriteLine("The {0} program contains the {1} degree\n", uProgram.ProgramName, degree.DegreeName);

            Console.WriteLine("The {0} degree contains the course {1}\n", degree.DegreeName, course.CourseName);
            
            Console.WriteLine("The {0} course contains {1} student(s)\n", course.CourseName, course.studentNumber);
            Console.ReadKey();
        }
Beispiel #12
0
        public Kart(ThingBlock block, ThingDefinition def)
            : base(block, def)
        {
            DefaultMaxSpeed = MaxSpeed = def.GetFloatProperty("maxspeed", 180f);
            MaxReverseSpeed = def.GetFloatProperty("maxreversespeed", 4f);

            MaxSpeedSquared = MaxSpeed * MaxSpeed;
            MaxReverseSpeedSquared = MaxReverseSpeed * MaxReverseSpeed;

            IsInAir = false;

            FrontDriftAngle = new Degree(def.GetFloatProperty("FrontDriftAngle", 46)).ValueRadians;
            BackDriftAngle = new Degree(def.GetFloatProperty("BackDriftAngle", 55)).ValueRadians;
            DriftTransitionAngle = new Degree(def.GetFloatProperty("DriftTransitionAngle", 40));
        }
Beispiel #13
0
		public void DegreesTest()
		{
			Degree target = new Degree(20.5);
			Assert.AreEqual(20, target.Degrees);
			Assert.AreEqual(30, target.Minutes);
			Assert.AreEqual(0, target.Seconds);

			target = new Degree(-(10 + 21.0 / 60 + 34.22 / 3600));
			Assert.AreEqual(-10, target.Degrees);
			Assert.AreEqual(21, target.Minutes);
			Assert.AreEqual(34, target.Seconds);
			Assert.AreEqual(34.22, Math.Round(target.TotalSeconds, 3));

			target = new Degree(37.85);
			Assert.AreEqual(37, target.Degrees);
		}
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
			out Vec3 up, ref Degree cameraFov )
        {
            position = Vec3.Zero;
            forward = Vec3.XAxis;
            up = Vec3.ZAxis;

            MapCamera mapCamera = Entities.Instance.GetByName( "MapCamera_0" ) as MapCamera;
            if( mapCamera != null )
            {
                position = mapCamera.Position;
                forward = mapCamera.Rotation * new Vec3( 1, 0, 0 );
                up = mapCamera.Rotation * new Vec3( 0, 0, 1 );
                if( mapCamera.Fov != 0 )
                    cameraFov = mapCamera.Fov;
            }
        }
Beispiel #15
0
 static void Main(string[] args)
 {
     string[] atts = { "Sophie", "Greene", "1/12/1991", "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK","Student" };
     string[] att = { "Manual", "Zu", "1/12/1937", "30 Other Street", "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK","Teacher" };
     Person student = new Person(atts);
     student.print();
     Person teacher = new Person(att);
     teacher.print();
     //ensure console window stays open
     string[] pAtt = {"Intro to Computer Science","Some Guy","BSc. blah blah" };
     UProgram prog = new UProgram(pAtt);
     prog.print();
     Degree deg = new Degree("Bsc. A M", 72);
     deg.print();
     Course cour = new Course("Intro hbla", 3, 9, "Mr blah Person");
     cour.print();
     Console.Read();
 }
Beispiel #16
0
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward, out Vec3 up,
            ref Degree cameraFov)
        {
            //camera management for demo mode
            if( demoMode && !FreeCameraEnabled )
            {
                MapCameraCurve curve;
                float curveTime;
                GetDemoModeMapCurve( out curve, out curveTime );
                if( curve != null )
                {
                    curve.CalculateCameraPositionByTime( curveTime, out position, out forward, out up,
                        out cameraFov );
                    return;
                }
            }

            base.OnGetCameraTransform( out position, out forward, out up, ref cameraFov );
        }
Beispiel #17
0
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
            out Vec3 up, ref Degree cameraFov)
        {
            if( ball != null && !ball.IsSetDeleted )
            {
                Vec3 lookAt = ball.GetInterpolatedPosition();
                Vec3 cameraPos = lookAt - cameraDirection.GetVector() * cameraDistance;

                position = cameraPos;
                forward = ( lookAt - position ).GetNormalize();
                up = Vec3.ZAxis;
            }
            else
            {
                position = Vec3.Zero;
                forward = Vec3.XAxis;
                up = Vec3.ZAxis;
            }
        }
Beispiel #18
0
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward, out Vec3 up,
			ref Degree cameraFov )
        {
            MapCamera mapCamera = FindFirstMapCamera();

            if( mapCamera != null )
            {
                position = mapCamera.Position;
                forward = mapCamera.Rotation.GetForward();
                up = mapCamera.Rotation.GetUp();
                cameraFov = mapCamera.Fov;
            }
            else
            {
                position = Vec3.Zero;
                forward = new Vec3( 1, 0, 0 );
                up = new Vec3( 0, 0, 1 );
                //fov = 90;
            }
        }
        //indexers
        //explicit and implicit conversion

         //just for the sake of programming
        //Degree to Radian is implicit
        //Radian to Degree is explicit
        public void execute()
        {
            
            ClassA X = new ClassA();
            X[3] = 10;
            Debug.Log(X);
            
            Radian x = new Radian();
            x.value = Math.PI * 2;

            Degree degree = (Degree)x;
            Debug.Log(degree.value);

            Degree degree360 = new Degree();
            degree360.value = 360;

            Radian radian360 = degree360;//implicit
            Debug.Log(radian360.value);//2 Pi


        }
Beispiel #20
0
        public static ICommand getDisplyDevTypes(Degree degree, int alarmClass, string sectionid)
        {
            SelectCommand com = new SelectCommand();
            if (degree == Degree.L)
                com.FiledNames += string.Format(" Ruleid,devicetype ,lowdevicestart as devStart,lownormal as normal,lowsystem as system,lowisextend as isextend ");
            else if (degree == Degree.M)
                com.FiledNames += string.Format(" Ruleid,devicetype ,middevicestart as devStart,midnormal as normal,midsystem as system,midisextend as isextend ");
            else if (degree == Degree.H)
                com.FiledNames += string.Format(" Ruleid,devicetype ,highdevicestart as devStart,highnormal as normal,highsystem as system,highisextend as isextend ");
            else if (degree == Degree.S)
                com.FiledNames += string.Format(" Ruleid,devicetype ,superdevicestart as devStart,supernormal as normal,supersystem as system,superisextend as isextend ");
            else
                com.FiledNames += string.Format(" Ruleid,devicetype ");

            com.TblNames += string.Format(" {0}.{1} ", schema, DB2TableName.tblRSPDeviceRange);

            com.WhereCon += string.Format(" Ruleid in (select Ruleid from {0}.{1} where RUNING='Y') ", schema, DB2TableName.tblRSPRule);
            com.WhereCon += string.Format(" and ALARMCLASS={0} ", alarmClass);
            com.WhereCon += string.Format(" and SECTIONID='{0}' and devicetype = 'CMS' ", sectionid);

            return com;
        }
Beispiel #21
0
 public static Degree degrees_to(this Quaternion from, Quaternion to)
 {
     //return (((to.eulerAngles.z - from.eulerAngles.z) + 180f) % 360f) - 180f;
     return(Degree.from_quaternion(from).angle_to(to).use_minus());
 }
Beispiel #22
0
        public void ToRegExp_Ok()
        {
            Variable kVariable = new Variable('k', Sign.MoreThanOrEqual, 0);
            Variable mVariable = new Variable('m', Sign.MoreThan, 0);

            Degree degree1 =
                new Degree(
                    new Degree(
                        new Union(
                            EnumerateHelper.Sequence(
                                new Symbol('a'),
                                new Symbol('b')
                                )
                            ),
                        kVariable
                        ),
                    new Quantity(2)
                    );

            Degree degree2 =
                new Degree(
                    new Degree(
                        new Concat(
                            EnumerateHelper.Sequence(
                                new Symbol('b'),
                                new Symbol('a')
                                )
                            ),
                        new Quantity(2)
                        ),
                    mVariable
                    );

            Concat concat1 =
                new Concat(
                    EnumerateHelper.Sequence <Entity>(
                        new Degree(
                            new Symbol('c'),
                            kVariable
                            ),
                        new Symbol('d')
                        )
                    );

            Union union1 =
                new Union(
                    EnumerateHelper.Sequence <Entity>(
                        new Degree(
                            new Symbol('e'),
                            mVariable
                            ),
                        new Symbol('f')
                        )
                    );

            Degree degree3 =
                new Degree(
                    new Symbol('m'),
                    mVariable
                    );

            Degree degree4 =
                new Degree(
                    new Symbol('z'),
                    kVariable
                    );

            Concat concat2 = new Concat(
                EnumerateHelper.Sequence <Entity>(
                    degree3,
                    degree4
                    )
                );

            Symbol symbol1 = new Symbol('y');

            Entity entity =
                new Union(
                    EnumerateHelper.Sequence <Entity>(
                        degree1,
                        degree2,
                        concat1,
                        union1,
                        concat2,
                        symbol1
                        )
                    );

            Quantity quantity = new Quantity(1);

            quantity.ToRegExp(entity);
        }
        public override void LoadPage(PageInfo page)
        {
            //Calculate x/z indexes for the grid array
            page.XIndex -= (int)System.Math.Floor(mGridBounds.Left / mPageSize);
            page.ZIndex -= (int)System.Math.Floor(mGridBounds.Top / mPageSize);

            //Check if the requested page is in bounds
            if (page.XIndex < 0 || page.ZIndex < 0 || page.XIndex >= mPageGridX || page.ZIndex >= mPageGridZ)
                return;

            //For each tree type...
            foreach (KeyValuePair<Entity, List<List<TreeDef>>> it in mPageGridList)
            {
                //Get the appropriate tree list for the specified page
                List<List<TreeDef>> pageGrid = it.Value;
                List<TreeDef> treeList = GetGridPage(pageGrid, page.XIndex, page.ZIndex);
                Entity entity = it.Key;

                //Load the listed trees into the page
                foreach (TreeDef o in treeList)
                {
                    //Get position
                    Vector3 pos = Vector3.Zero;
                    pos.x = page.Bounds.Left + ((float)o.XPos / 65535) * mPageSize;
                    pos.z = page.Bounds.Top + ((float)o.ZPos / 65535) * mPageSize;

                    //Calculate terrain height at pos.x / pos.z to get pos.y
                    if (mHeightFunction != null)
                        pos.y = mHeightFunction.GetHeightAt(pos.x, pos.z, mHeightFunctionUserData);
                    else
                        pos.y = 0.0f;

                    //Get rotation
                    Degree angle = new Degree((Real)o.Rotation * (360.0f / 255));
                    Quaternion rot = Quaternion.FromAngleAxis((float)angle.InRadians, Vector3.UnitY);

                    //Get scale
                    Vector3 scale = Vector3.Zero;
                    scale.y = (float)(o.Scale * (mMaximumScale / 255) + mMinimumScale);
                    scale.x = scale.y;
                    scale.z = scale.y;

                    //Get color
                    ColorEx col = ColorEx.White;
                    if (mColorMap != null)
                        col = mColorMap.GetColorAtUnpacked(pos.x, pos.z);

                    AddEntity(entity, pos, rot, scale, col);
                }
            }
        }
 /// <summary>
 /// Set a parameter value
 /// </summary>
 /// <param name="paramter">Parameter qualified name</param>
 /// <param name="value">a <see cref="Degree"/> value for the parameter</param>
 /// <returns>Not all parameters return a value after edit</returns>
 internal string SetParameter(string paramter, Degree value)
 {
     return(SetParameter(paramter, value.Value));
 }
Beispiel #25
0
 public void setCameraLightDirectionThreshold(Degree angle)
 {
     OgrePINVOKE.LiSPSMShadowCameraSetupPtr_setCameraLightDirectionThreshold(swigCPtr, Degree.getCPtr(angle));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #26
0
        void GetFireParameters( out Vec3 pos, out Quat rot, out float speed )
        {
            Camera camera = RendererWorld.Instance.DefaultCamera;

            pos = catapult.Position + new Vec3( 0, 0, .7f );

            Radian verticalAngle = new Degree( 30 ).InRadians();

            rot = Quat.Identity;
            speed = 0;

            if( catapultFiring )
            {
                Ray startRay = camera.GetCameraToViewportRay( catapultFiringMouseStartPosition );
                Ray ray = camera.GetCameraToViewportRay( MousePosition );

                Plane plane = Plane.FromPointAndNormal( pos, Vec3.ZAxis );

                Vec3 startRayPos;
                if( !plane.RayIntersection( startRay, out startRayPos ) )
                {
                    //must never happen
                }

                Vec3 rayPos;
                if( !plane.RayIntersection( ray, out rayPos ) )
                {
                    //must never happen
                }

                Vec2 diff = rayPos.ToVec2() - startRayPos.ToVec2();

                Radian horizonalAngle = MathFunctions.ATan( diff.Y, diff.X ) + MathFunctions.PI;

                SphereDir dir = new SphereDir( horizonalAngle, verticalAngle );
                rot = Quat.FromDirectionZAxisUp( dir.GetVector() );

                float distance = diff.Length();

                //3 meters clamp
                MathFunctions.Clamp( ref distance, .001f, 3 );

                speed = distance * 10;
            }
        }
Beispiel #27
0
        private void OnUpdate()
        {
            bool isOrtographic = camera.ProjectionType == ProjectionType.Orthographic;

            if (inputEnabled)
            {
                bool goingForward = VirtualInput.IsButtonHeld(moveForwardBtn);
                bool goingBack    = VirtualInput.IsButtonHeld(moveBackwardBtn);
                bool goingLeft    = VirtualInput.IsButtonHeld(moveLeftBtn);
                bool goingRight   = VirtualInput.IsButtonHeld(moveRightBtn);
                bool goingUp      = VirtualInput.IsButtonHeld(moveUpBtn);
                bool goingDown    = VirtualInput.IsButtonHeld(moveDownBtn);
                bool fastMove     = VirtualInput.IsButtonHeld(fastMoveBtn);
                bool camActive    = VirtualInput.IsButtonHeld(activeBtn);
                bool isPanning    = VirtualInput.IsButtonHeld(panBtn);

                bool hideCursor = camActive || isPanning;
                if (hideCursor != lastHideCursorState)
                {
                    if (hideCursor)
                    {
                        Cursor.Hide();

                        Rect2I clipRect;
                        clipRect.x      = Input.PointerPosition.x - 2;
                        clipRect.y      = Input.PointerPosition.y - 2;
                        clipRect.width  = 4;
                        clipRect.height = 4;

                        Cursor.ClipToRect(clipRect);
                    }
                    else
                    {
                        Cursor.Show();
                        Cursor.ClipDisable();
                    }

                    lastHideCursorState = hideCursor;
                }

                float frameDelta = Time.FrameDelta;
                if (camActive)
                {
                    float horzValue = VirtualInput.GetAxisValue(horizontalAxis);
                    float vertValue = VirtualInput.GetAxisValue(verticalAxis);

                    float rotationAmount = RotationalSpeed * EditorSettings.MouseSensitivity * frameDelta;

                    yaw   += new Degree(horzValue * rotationAmount);
                    pitch += new Degree(vertValue * rotationAmount);

                    yaw   = MathEx.WrapAngle(yaw);
                    pitch = MathEx.WrapAngle(pitch);

                    Quaternion yRot = Quaternion.FromAxisAngle(Vector3.YAxis, yaw);
                    Quaternion xRot = Quaternion.FromAxisAngle(Vector3.XAxis, pitch);

                    Quaternion camRot = yRot * xRot;
                    camRot.Normalize();

                    SceneObject.Rotation = camRot;

                    // Handle movement using movement keys
                    Vector3 direction = Vector3.Zero;

                    if (goingForward)
                    {
                        direction += SceneObject.Forward;
                    }
                    if (goingBack)
                    {
                        direction -= SceneObject.Forward;
                    }
                    if (goingRight)
                    {
                        direction += SceneObject.Right;
                    }
                    if (goingLeft)
                    {
                        direction -= SceneObject.Right;
                    }
                    if (goingUp)
                    {
                        direction += SceneObject.Up;
                    }
                    if (goingDown)
                    {
                        direction -= SceneObject.Up;
                    }

                    if (direction.SqrdLength != 0)
                    {
                        direction.Normalize();

                        float multiplier = 1.0f;
                        if (fastMove)
                        {
                            multiplier = FastModeMultiplier;
                        }

                        currentSpeed  = MathEx.Clamp(currentSpeed + Acceleration * frameDelta, StartSpeed, TopSpeed);
                        currentSpeed *= multiplier;
                    }
                    else
                    {
                        currentSpeed = 0.0f;
                    }

                    const float tooSmall = 0.0001f;
                    if (currentSpeed > tooSmall)
                    {
                        Vector3 velocity = direction * currentSpeed;
                        SceneObject.Move(velocity * frameDelta);
                    }
                }

                // Pan
                if (isPanning)
                {
                    float horzValue = VirtualInput.GetAxisValue(horizontalAxis);
                    float vertValue = VirtualInput.GetAxisValue(verticalAxis);

                    Vector3 direction = new Vector3(horzValue, -vertValue, 0.0f);
                    direction = camera.SceneObject.Rotation.Rotate(direction);

                    SceneObject.Move(direction * PanSpeed * frameDelta);
                }
            }
            else
            {
                if (lastHideCursorState)
                {
                    Cursor.Show();
                    Cursor.ClipDisable();

                    lastHideCursorState = false;
                }
            }

            SceneWindow sceneWindow = EditorWindow.GetWindow <SceneWindow>();

            if ((sceneWindow.Active && sceneWindow.HasFocus) || sceneWindow.IsPointerHovering)
            {
                Rect2I bounds = sceneWindow.Bounds;

                // Move using scroll wheel
                if (bounds.Contains(Input.PointerPosition))
                {
                    float scrollAmount = VirtualInput.GetAxisValue(scrollAxis);
                    if (!isOrtographic)
                    {
                        SceneObject.Move(SceneObject.Forward * scrollAmount * ScrollSpeed);
                    }
                    else
                    {
                        float orthoHeight = MathEx.Max(1.0f, camera.OrthoHeight - scrollAmount);
                        camera.OrthoHeight = orthoHeight;
                    }
                }
            }

            UpdateAnim();
        }
Beispiel #28
0
 public EduInstitute(string title, Degree minimumDegree)
 {
     this._Title         = title;
     this._MinimumDegree = minimumDegree;
 }
 // this is a function created specifically for this vehicle to allow control of it.
 public void setTorqueSteering(float torque, Degree steering)
 {
     mTorque = torque; mSteering = steering;
 }
Beispiel #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OsmSharp.iOS.UI.MapView"/> class.
 /// </summary>
 /// <param name="mapCenter">Map center.</param>
 /// <param name="map">Map.</param>
 /// <param name="mapTilt">Map tilt.</param>
 /// <param name="defaultZoom">Default zoom.</param>
 public MapView(GeoCoordinate mapCenter, Map map, Degree mapTilt, float defaultZoom)
 {
     this.Initialize(mapCenter, map, mapTilt, defaultZoom);
 }
Beispiel #31
0
        /// <summary>
        /// Initialize the specified defaultMapCenter, defaultMap, defaultMapTilt and defaultMapZoom.
        /// </summary>
        /// <param name="defaultMapCenter">Default map center.</param>
        /// <param name="defaultMap">Default map.</param>
        /// <param name="defaultMapTilt">Default map tilt.</param>
        /// <param name="defaultMapZoom">Default map zoom.</param>
        public void Initialize(GeoCoordinate defaultMapCenter, Map defaultMap, Degree defaultMapTilt, float defaultMapZoom)
        {
            // set clip to bounds to prevent objects from being rendered/show outside of the mapview.
            this.ClipsToBounds = true;

            _mapCenter = defaultMapCenter;
            _map       = defaultMap;
            _mapTilt   = defaultMapTilt;
            _mapZoom   = defaultMapZoom;

            _doubleTapAnimator = new MapViewAnimator(this);

            this.BackgroundColor        = UIColor.White;
            this.UserInteractionEnabled = true;

            _markers = new List <MapMarker> ();

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                var panGesture = new UIPanGestureRecognizer(Pan);
                panGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => {
                    return(true);
                };
                // TODO: workaround for xamarin bug, remove later!
                panGesture.ShouldRequireFailureOf   = (a, b) => { return(false); };
                panGesture.ShouldBeRequiredToFailBy = (a, b) => { return(false); };
                this.AddGestureRecognizer(panGesture);

                var pinchGesture = new UIPinchGestureRecognizer(Pinch);
                pinchGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => {
                    return(true);
                };
                // TODO: workaround for xamarin bug, remove later!
                pinchGesture.ShouldRequireFailureOf   = (a, b) => { return(false); };
                pinchGesture.ShouldBeRequiredToFailBy = (a, b) => { return(false); };
                this.AddGestureRecognizer(pinchGesture);

                var rotationGesture = new UIRotationGestureRecognizer(Rotate);
                rotationGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => {
                    return(true);
                };
                // TODO: workaround for xamarin bug, remove later!
                rotationGesture.ShouldRequireFailureOf   = (a, b) => { return(false); };
                rotationGesture.ShouldBeRequiredToFailBy = (a, b) => { return(false); };
                this.AddGestureRecognizer(rotationGesture);

                var singleTapGesture = new UITapGestureRecognizer(SingleTap);
                singleTapGesture.NumberOfTapsRequired = 1;
                // TODO: workaround for xamarin bug, remove later!
//				singleTapGesture.ShouldRequireFailureOf = (a, b) => { return false; };
//				singleTapGesture.ShouldBeRequiredToFailBy = (a, b) => { return false; };

                var doubleTapGesture = new UITapGestureRecognizer(DoubleTap);
                doubleTapGesture.NumberOfTapsRequired = 2;
                // TODO: workaround for xamarin bug, remove later!
//				doubleTapGesture.ShouldRequireFailureOf = (a, b) => { return false; };
//				doubleTapGesture.ShouldBeRequiredToFailBy = (a, b) => { return false; };

                //singleTapGesture.RequireGestureRecognizerToFail (doubleTapGesture);
                this.AddGestureRecognizer(singleTapGesture);
                this.AddGestureRecognizer(doubleTapGesture);
            }
            else
            {
                var panGesture = new UIPanGestureRecognizer(Pan);
                panGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => { return(true); };
                this.AddGestureRecognizer(panGesture);

                var pinchGesture = new UIPinchGestureRecognizer(Pinch);
                pinchGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => { return(true); };
                this.AddGestureRecognizer(pinchGesture);

                var rotationGesture = new UIRotationGestureRecognizer(Rotate);
                rotationGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) => { return(true); };
                this.AddGestureRecognizer(rotationGesture);

                var singleTapGesture = new UITapGestureRecognizer(SingleTap);
                singleTapGesture.NumberOfTapsRequired = 1;
                //singleTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneouslySingle;
                //singleTapGesture.ShouldBeRequiredToFailBy += ShouldRecognizeSimultaneouslySingle;

                var doubleTapGesture = new UITapGestureRecognizer(DoubleTap);
                doubleTapGesture.NumberOfTapsRequired = 2;
                //doubleTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneouslySingle;
                //doubleTapGesture.ShouldBeRequiredToFailBy += ShouldRecognizeSimultaneouslyDouble;

                singleTapGesture.RequireGestureRecognizerToFail(doubleTapGesture);
                this.AddGestureRecognizer(singleTapGesture);
                this.AddGestureRecognizer(doubleTapGesture);
            }

            // set scalefactor.
            _scaleFactor = this.ContentScaleFactor;

            // create the cache renderer.
            _cacheRenderer = new MapRenderer <CGContextWrapper> (
                new CGContextRenderer(_scaleFactor));
            _cachedScene           = new Scene2DSimple();
            _cachedScene.BackColor = SimpleColor.FromKnownColor(KnownColor.White).Value;
        }
Beispiel #32
0
 private static extern void Internal_DrawWireArc(ref Vector3 position, ref Vector3 normal, float radius, ref Degree startAngle, ref Degree amountAngle, float size);
Beispiel #33
0
 /// <summary>
 /// Draws a wireframe arc.
 /// </summary>
 /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
 /// <param name="normal">Normal towards which to orient the arc.</param>
 /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
 /// <param name="startAngle">Angle at which the arc starts.</param>
 /// <param name="amountAngle">Length of the arc.</param>
 /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
 ///                    handle size regardless of distance from camera.</param>
 public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle,
                                Degree amountAngle, float size = 1.0f)
 {
     Internal_DrawWireArc(ref position, ref normal, radius, ref startAngle, ref amountAngle, size);
 }
Beispiel #34
0
        public async Task <IActionResult> PostAsync([FromBody] Degree value)
        {
            await _degreeService.AddAsync(value);

            return(Ok());
        }
Beispiel #35
0
        int n_device = 3; //���ƥ��I�̻�N��LCS����V�T��

        #endregion Fields

        #region Constructors

        public LCS(AEvent aDevice, CategoryType type, System.Collections.Hashtable ht, DeviceType devType, System.Collections.Hashtable DevRange, Degree degree)
        {
            Initialize(aDevice, type, ht, devType, DevRange, degree);
            this.GetMessRuleData += new GetMessRuleDataHandler(LCS_GetMessRuleData);
        }
        public static void Initialize(ApplicationDbContext context)
        {
            //context.Database.EnsureCreated();

            // Look for any Degrees.
            if (context.Degrees.Any())
            {
                Console.WriteLine("Degrees already exist.");
            }
            else
            {
                var degrees = new Degree[]
                {
                    new Degree {
                        DegreeId = 1, DegreeAbv = "ACS+2", DegreeName = "MS ACS +2", NumberOfTerms = 6
                    },
                    new Degree {
                        DegreeId = 2, DegreeAbv = "ACS+DB", DegreeName = "MS ACS+ DB", NumberOfTerms = 6
                    },
                    new Degree {
                        DegreeId = 3, DegreeAbv = "ACS+NF", DegreeName = "MS ACS + NF", NumberOfTerms = 6
                    },
                    new Degree {
                        DegreeId = 4, DegreeAbv = "ACS", DegreeName = "MS ACS", NumberOfTerms = 6
                    },
                };
                Console.WriteLine($"Inserted {degrees.Length} new degrees.");
                foreach (Degree d in degrees)
                {
                    context.Degrees.Add(d);
                }
                context.SaveChanges();
            }
            if (context.Credits.Any())
            {
                Console.WriteLine("Credits already exist.");
            }
            else
            {
                var credits = new Credit[]
                {
                    new Credit {
                        CreditId = 460, DegreeId = 1, CreditAbv = "DB", CreditName = "Database", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 356, DegreeId = 1, CreditAbv = "NF", CreditName = "Network Fundamentals", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 542, DegreeId = 1, CreditAbv = "542", CreditName = "OOP with java", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 563, DegreeId = 1, CreditAbv = "563", CreditName = "Web apps", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 560, DegreeId = 1, CreditAbv = "560", CreditName = "Advanced Database", IsSummer = 1, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 664, DegreeId = 1, CreditAbv = "664-UX", CreditName = "User Experience Design", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 618, DegreeId = 1, CreditAbv = "618-PM", CreditName = "Project management", IsSummer = 1, IsSpring = 0, IsFall = 0
                    },
                    new Credit {
                        CreditId = 555, DegreeId = 1, CreditAbv = "555-NS", CreditName = "Network Security", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 691, DegreeId = 1, CreditAbv = "691-GDP1", CreditName = "GDP1", IsSummer = 1, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 692, DegreeId = 1, CreditAbv = "692-GDP2", CreditName = "GDP2", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 64, DegreeId = 1, CreditAbv = "Mobile", CreditName = "643 or 644 mobile", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 10, DegreeId = 1, CreditAbv = "E1", CreditName = "Elective1", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                    new Credit {
                        CreditId = 20, DegreeId = 1, CreditAbv = "E2", CreditName = "Elective2", IsSummer = 0, IsSpring = 1, IsFall = 1
                    },
                };
                Console.WriteLine($"Inserted {credits.Length} new credits.");
                foreach (Credit d in credits)
                {
                    context.Credits.Add(d);
                }
                context.SaveChanges();
            }
            if (context.DegreeCredits.Any())
            {
                Console.WriteLine("DegreeCredits already exist.");
            }
            else
            {
                var degreecredits = new DegreeCredit[]
                {
                    new DegreeCredit {
                        DegreeCreditId = 1, DegreeId = 1, CreditId = 460
                    },
                    new DegreeCredit {
                        DegreeCreditId = 2, DegreeId = 1, CreditId = 356
                    },
                    new DegreeCredit {
                        DegreeCreditId = 3, DegreeId = 1, CreditId = 542
                    },
                    new DegreeCredit {
                        DegreeCreditId = 4, DegreeId = 1, CreditId = 563
                    },
                    new DegreeCredit {
                        DegreeCreditId = 5, DegreeId = 1, CreditId = 560
                    },
                    new DegreeCredit {
                        DegreeCreditId = 6, DegreeId = 1, CreditId = 664
                    },
                    new DegreeCredit {
                        DegreeCreditId = 7, DegreeId = 1, CreditId = 618
                    },
                    new DegreeCredit {
                        DegreeCreditId = 8, DegreeId = 1, CreditId = 555
                    },
                    new DegreeCredit {
                        DegreeCreditId = 9, DegreeId = 1, CreditId = 691
                    },
                    new DegreeCredit {
                        DegreeCreditId = 10, DegreeId = 1, CreditId = 692
                    },
                    new DegreeCredit {
                        DegreeCreditId = 11, DegreeId = 1, CreditId = 64
                    },
                    new DegreeCredit {
                        DegreeCreditId = 12, DegreeId = 1, CreditId = 10
                    },
                    new DegreeCredit {
                        DegreeCreditId = 13, DegreeId = 1, CreditId = 20
                    },
                };

                Console.WriteLine($"Inserted {degreecredits.Length} new degree credits.");
                foreach (DegreeCredit d in degreecredits)
                {
                    context.DegreeCredits.Add(d);
                }
                context.SaveChanges();
            }
            if (context.Students.Any())
            {
                Console.WriteLine("Students already exist.");
            }
            else
            {
                var students = new Student[]
                {
                    new Student {
                        StudentId = 533619, FamilyName = "Cheekoti", GivenName = "Vennela", SID = "S533619", CatPawsID = 919568817
                    },
                    new Student {
                        StudentId = 533907, FamilyName = "Gade", GivenName = "Susritha", SID = "S533907", CatPawsID = 919570703
                    },
                    new Student {
                        StudentId = 533623, FamilyName = "Gone", GivenName = "Sathwika", SID = "S533623", CatPawsID = 919568816
                    },
                };
                Console.WriteLine($"Inserted {students.Length} new students.");
                foreach (Student d in students)
                {
                    context.Students.Add(d);
                }
                context.SaveChanges();
            }
            if (context.DegreePlans.Any())
            {
                Console.WriteLine("DegreePlans already exist.");
            }
            else
            {
                var degreeplans = new Degreeplan[]
                {
                    new Degreeplan {
                        DegreeplanId = 7251, StudentId = 533619, DegreePlanAbv = "Super Fast", DegreePlanName = "As Fast as I can", DegreeId = 1
                    },
                    new Degreeplan {
                        DegreeplanId = 7258, StudentId = 533619, DegreePlanAbv = "slow and Easy", DegreePlanName = "As slow as I can", DegreeId = 1
                    },
                    new Degreeplan {
                        DegreeplanId = 7253, StudentId = 533623, DegreePlanAbv = "Super Fast", DegreePlanName = "As Fast as I can", DegreeId = 1
                    },
                    new Degreeplan {
                        DegreeplanId = 7255, StudentId = 533907, DegreePlanAbv = "Slow and Easy", DegreePlanName = "As slow as I can", DegreeId = 1
                    },
                    new Degreeplan {
                        DegreeplanId = 7257, StudentId = 533907, DegreePlanAbv = "Super Fast", DegreePlanName = "As Fast as I can", DegreeId = 1
                    },
                    new Degreeplan {
                        DegreeplanId = 7254, StudentId = 533623, DegreePlanAbv = "Slow and Easy", DegreePlanName = "As slow as I can", DegreeId = 1
                    },
                };
                Console.WriteLine($"Inserted {degreeplans.Length} new students.");
                foreach (Degreeplan d in degreeplans)
                {
                    context.DegreePlans.Add(d);
                }
                context.SaveChanges();
            }
            if (context.StudentTerms.Any())
            {
                Console.WriteLine("StudentTerm already exist.");
            }
            else
            {
                var Studentterms = new StudentTerm[]
                {
                    new StudentTerm {
                        StudentTermId = 1, Term = 1, TermAbv = "S18 ", TermName = "Spring 2018", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 2, Term = 2, TermAbv = "Su18", TermName = "Summer 2018", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 3, Term = 3, TermAbv = "F18", TermName = "Fall 2018", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 4, Term = 4, TermAbv = "S19", TermName = "Spring 2019", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 5, Term = 5, TermAbv = "Su19", TermName = "Summer 2019", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 6, Term = 6, TermAbv = "F19", TermName = "Fall 2019", DegreeplanId = 7258
                    },
                    new StudentTerm {
                        StudentTermId = 7, Term = 1, TermAbv = "F19", TermName = "Fall 2019", DegreeplanId = 7255
                    },
                    new StudentTerm {
                        StudentTermId = 8, Term = 2, TermAbv = "S20", TermName = "Spring 2020", DegreeplanId = 7255
                    },
                    new StudentTerm {
                        StudentTermId = 9, Term = 3, TermAbv = "Su20", TermName = "Summer 2020", DegreeplanId = 7255
                    },
                    new StudentTerm {
                        StudentTermId = 10, Term = 4, TermAbv = "F20", TermName = "Fall 2020", DegreeplanId = 7255
                    },
                    new StudentTerm {
                        StudentTermId = 11, Term = 5, TermAbv = "S21", TermName = "Spring 2021", DegreeplanId = 7255
                    },
                    new StudentTerm {
                        StudentTermId = 12, Term = 1, TermAbv = "F18", TermName = "Fall2018", DegreeplanId = 7254
                    },
                    new StudentTerm {
                        StudentTermId = 13, Term = 2, TermAbv = "S19", TermName = "Spring2019", DegreeplanId = 7254
                    },
                    new StudentTerm {
                        StudentTermId = 14, Term = 3, TermAbv = "SU19", TermName = "Summer2019", DegreeplanId = 7254
                    },
                    new StudentTerm {
                        StudentTermId = 15, Term = 4, TermAbv = "F20", TermName = "Fall2019", DegreeplanId = 7254
                    },
                    new StudentTerm {
                        StudentTermId = 16, Term = 5, TermAbv = "S20", TermName = "Spring2020", DegreeplanId = 7254
                    },
                };
                Console.WriteLine($"Inserted {Studentterms.Length} new degrees.");
                foreach (StudentTerm d in Studentterms)
                {
                    context.StudentTerms.Add(d);
                }
                context.SaveChanges();
            }
            if (context.Slots.Any())
            {
                Console.WriteLine("Slot already exist.");
            }
            else
            {
                var Slots = new Slot[]
                {
                    new Slot {
                        SlotId = 1, DegreePlanId = 7255, Term = 1, CreditId = 356, Status = "C"
                    },
                    new Slot {
                        SlotId = 2, DegreePlanId = 7255, Term = 1, CreditId = 542, Status = "C"
                    },
                    new Slot {
                        SlotId = 3, DegreePlanId = 7255, Term = 1, CreditId = 563, Status = "C"
                    },
                    new Slot {
                        SlotId = 4, DegreePlanId = 7255, Term = 1, CreditId = 460, Status = "C"
                    },
                    new Slot {
                        SlotId = 5, DegreePlanId = 7255, Term = 2, CreditId = 560, Status = "A"
                    },
                    new Slot {
                        SlotId = 6, DegreePlanId = 7255, Term = 2, CreditId = 664, Status = "A"
                    },
                    new Slot {
                        SlotId = 7, DegreePlanId = 7255, Term = 2, CreditId = 64, Status = "A"
                    },
                    new Slot {
                        SlotId = 8, DegreePlanId = 7255, Term = 3, CreditId = 618, Status = "P"
                    },
                    new Slot {
                        SlotId = 9, DegreePlanId = 7255, Term = 3, CreditId = 691, Status = "P"
                    },
                    new Slot {
                        SlotId = 10, DegreePlanId = 7255, Term = 4, CreditId = 10, Status = "P"
                    },
                    new Slot {
                        SlotId = 11, DegreePlanId = 7255, Term = 4, CreditId = 555, Status = "P"
                    },
                    new Slot {
                        SlotId = 12, DegreePlanId = 7255, Term = 5, CreditId = 20, Status = "P"
                    },
                    new Slot {
                        SlotId = 13, DegreePlanId = 7255, Term = 5, CreditId = 692, Status = "P"
                    },
                };
                Console.WriteLine($"Inserted {Slots.Length} new degrees.");
                foreach (Slot d in Slots)
                {
                    context.Slots.Add(d);
                }
                context.SaveChanges();
            }
        }
Beispiel #37
0
 public static Degree to_degree(this Quaternion quaternion)
 {
     return(Degree.from_quaternion(quaternion));
 }
Beispiel #38
0
 /// <summary>
 /// Calculate straight line distance between two coordinates
 /// </summary>
 /// <param name="latitude1">Latitude of first point</param>
 /// <param name="longitude1">Logitude of first point</param>
 /// <param name="latitude2">Latitude of second point</param>
 /// <param name="longitude2">Logitude of second point</param>
 /// <returns>Distance between the two points</returns>
 public static DistanceSpan Distance(Degree latitude1, Degree longitude1, Degree latitude2, Degree longitude2)
 {
     return(Distance(latitude1.TotalSeconds, longitude1.TotalSeconds, latitude2.TotalSeconds, longitude1.TotalSeconds));
 }
Beispiel #39
0
 // Second constructor so you can also define degree
 // : this(...) allows you to call other constructor so either can be used
 public UniProgram(string programme, string degree) : this(programme)
 {
     this.Degree = new Degree(degree);
 }
 /// <summary>
 /// Snaps an angle value to the specified increments.
 /// </summary>
 /// <param name="value">Value to snap.</param>
 /// <param name="snapAmount">Increment to which to snap the value to.</param>
 /// <returns>Value snapped to the provided increments.</returns>
 public static Degree SnapValue(Degree value, Degree snapAmount)
 {
     return((Degree)SnapValue(value.Degrees, snapAmount.Degrees));
 }
Beispiel #41
0
        public static void Initialize(ApplicationDbContext context)
        {
            //context.Database.EnsureCreated();

            // Look for any Degrees.
            if (context.Degrees.Any())
            {
                Console.WriteLine("Degrees already exist.");
            }
            else
            {
                var degrees = new Degree[]
                {
                    new Degree {
                        DegreeId = 1, DegreeAbrrev = "ACS+2", DegreeName = "MS ACS +2"
                    },
                    new Degree {
                        DegreeId = 2, DegreeAbrrev = "ACS+DB", DegreeName = "MS ACS + DB"
                    },
                    new Degree {
                        DegreeId = 3, DegreeAbrrev = "ACS+NF", DegreeName = "MS ACS+  NF"
                    },
                    new Degree {
                        DegreeId = 4, DegreeAbrrev = "ACS", DegreeName = "MS ACS"
                    }
                };

                Console.WriteLine($"Inserted {degrees.Length} new degrees.");


                foreach (Degree d in degrees)
                {
                    context.Degrees.Add(d);
                }
                context.SaveChanges();
            }



            if (context.Requirements.Any())
            {
                Console.WriteLine("Requirements already exist.");
            }
            else
            {
                var requirements = new Requirement[]
                {
                    new Requirement {
                        RequirementID = 460, DegreeId = 3, RequirementAbbrev = "DB", CourseName = "44-460 Database"
                    },
                    new Requirement {
                        RequirementID = 356, DegreeId = 3, RequirementAbbrev = "NF", CourseName = "44-356 Network Fundamentals"
                    },
                    new Requirement {
                        RequirementID = 542, DegreeId = 3, RequirementAbbrev = "OOP", CourseName = "44-542 Object Oriented Programming"
                    },
                    new Requirement {
                        RequirementID = 563, DegreeId = 3, RequirementAbbrev = "Web apps", CourseName = "44-563 Web apps"
                    },
                    new Requirement {
                        RequirementID = 560, DegreeId = 3, RequirementAbbrev = "ADB", CourseName = "44-560 Advance Database topics"
                    },
                    new Requirement {
                        RequirementID = 555, DegreeId = 3, RequirementAbbrev = "NS", CourseName = "44-555 Network Security"
                    },
                    new Requirement {
                        RequirementID = 618, DegreeId = 3, RequirementAbbrev = "PM", CourseName = "44-618 Project Management"
                    },
                    new Requirement {
                        RequirementID = 1, DegreeId = 3, RequirementAbbrev = "Mobile Computing", CourseName = "Mobile Computing"
                    },
                    new Requirement {
                        RequirementID = 664, DegreeId = 3, RequirementAbbrev = "HCI", CourseName = "44-664  User Experience Design"
                    },
                    new Requirement {
                        RequirementID = 10, DegreeId = 3, RequirementAbbrev = "E1", CourseName = "Elective 1"
                    },
                    new Requirement {
                        RequirementID = 20, DegreeId = 3, RequirementAbbrev = "E2", CourseName = "Elective 2"
                    },
                    new Requirement {
                        RequirementID = 691, DegreeId = 3, RequirementAbbrev = "GDP1", CourseName = "GDP1"
                    },
                    new Requirement {
                        RequirementID = 692, DegreeId = 3, RequirementAbbrev = "GDP2", CourseName = "GDP2"
                    }
                };
                Console.WriteLine($"Inserted {requirements.Length} new reuirements.");
                foreach (Requirement d in requirements)
                {
                    context.Requirements.Add(d);
                }
                context.SaveChanges();
            }

            if (context.Students.Any())
            {
                Console.WriteLine("Students already exist.");
            }
            else
            {
                var student = new Student[]
                {
                    new Student {
                        StudentId = 531369, First = "Girish", Last = "Guntuku", Snumber = "S531369", _919 = 919534222
                    },
                    new Student {
                        StudentId = 531495, First = "Chaithanya", Last = "Cherukuru", Snumber = "S531495", _919 = 919531369
                    },
                    new Student {
                        StudentId = 531333, First = "Midhun", Last = "Kumar", Snumber = "S531333", _919 = 919531495
                    },
                    new Student {
                        StudentId = 534222, First = "Pappu", Last = "Sah", Snumber = "S534222", _919 = 919531333
                    },
                };


                Console.WriteLine($"Inserted {student.Length} new student.");
                foreach (Student d in student)
                {
                    context.Students.Add(d);
                }
                context.SaveChanges();
            }

            if (context.DegreePlans.Any())
            {
                Console.WriteLine("Degree Plans already exist.");
            }
            else
            {
                var degreeplan = new DegreePlan[]
                {
                    new DegreePlan {
                        DegreePlanId = 10, DegreeID = 3, StudentID = 531369, DegreePlanAbbrev = "NS", DegreePlanName = "No Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 11, DegreeID = 3, StudentID = 531369, DegreePlanAbbrev = "S", DegreePlanName = "Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 12, DegreeID = 3, StudentID = 531495, DegreePlanAbbrev = "NS", DegreePlanName = "No Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 13, DegreeID = 3, StudentID = 531495, DegreePlanAbbrev = "S", DegreePlanName = "Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 14, DegreeID = 3, StudentID = 531333, DegreePlanAbbrev = "NS", DegreePlanName = "No Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 15, DegreeID = 3, StudentID = 531333, DegreePlanAbbrev = "S", DegreePlanName = "Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 16, DegreeID = 3, StudentID = 534222, DegreePlanAbbrev = "NS", DegreePlanName = "No Summer"
                    },
                    new DegreePlan {
                        DegreePlanId = 17, DegreeID = 3, StudentID = 534222, DegreePlanAbbrev = "S", DegreePlanName = "Summer"
                    },
                };
                Console.WriteLine($"Inserted {degreeplan.Length} new degree plans.");
                foreach (DegreePlan d in degreeplan)
                {
                    context.DegreePlans.Add(d);
                }
                context.SaveChanges();
            }

            if (context.DegreePlanTermRequirements.Any())
            {
                Console.WriteLine("DegreePlan Term Requirements already exist.");
            }
            else
            {
                var degreeplantermrequirement = new DegreePlanTermRequirement[]
                {
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 1, DegreePlanID = 10, TermID = 1, RequirementID = 560
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 2, DegreePlanID = 10, TermID = 1, RequirementID = 356
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 3, DegreePlanID = 10, TermID = 1, RequirementID = 542
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 4, DegreePlanID = 10, TermID = 1, RequirementID = 563
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 5, DegreePlanID = 10, TermID = 2, RequirementID = 664
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 6, DegreePlanID = 10, TermID = 2, RequirementID = 1
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 7, DegreePlanID = 10, TermID = 2, RequirementID = 10
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 8, DegreePlanID = 10, TermID = 3, RequirementID = 618
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 9, DegreePlanID = 10, TermID = 3, RequirementID = 691
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 10, DegreePlanID = 10, TermID = 4, RequirementID = 555
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 11, DegreePlanID = 10, TermID = 4, RequirementID = 20
                    },
                    new DegreePlanTermRequirement {
                        DegreePlanTermRequirementId = 12, DegreePlanID = 10, TermID = 4, RequirementID = 692
                    }
                };
                Console.WriteLine($"Inserted {degreeplantermrequirement.Length} new student terms.");
                foreach (DegreePlanTermRequirement d in degreeplantermrequirement)
                {
                    context.DegreePlanTermRequirements.Add(d);
                }
                context.SaveChanges();
            }


            if (context.DegreeRequirements.Any())
            {
                Console.WriteLine("Degree Requirements already exist.");
            }
            else
            {
                var degreerequirement = new DegreeRequirement[]
                {
                    new DegreeRequirement {
                        DegreeRequirementId = 1, DegreeId = 3, RequirementId = 356
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 2, DegreeId = 3, RequirementId = 542
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 3, DegreeId = 3, RequirementId = 563
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 4, DegreeId = 3, RequirementId = 560
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 5, DegreeId = 3, RequirementId = 555
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 6, DegreeId = 3, RequirementId = 618
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 7, DegreeId = 3, RequirementId = 1
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 8, DegreeId = 3, RequirementId = 664
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 9, DegreeId = 3, RequirementId = 10
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 10, DegreeId = 3, RequirementId = 20
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 11, DegreeId = 3, RequirementId = 691
                    },
                    new DegreeRequirement {
                        DegreeRequirementId = 12, DegreeId = 3, RequirementId = 692
                    }
                };
                Console.WriteLine($"Inserted { degreerequirement.Length} new student terms.");
                foreach (DegreeRequirement d in degreerequirement)
                {
                    context.DegreeRequirements.Add(d);
                }
                context.SaveChanges();
            }



            if (context.StudentTerms.Any())
            {
                Console.WriteLine("Student Terms already exist.");
            }
            else
            {
                var studentterm = new StudentTerm[]
                {
                    new StudentTerm {
                        StudentTermId = 1, Term = 1, TermLabel = "Fall 2017", DegreePlanId = 10
                    },
                    new StudentTerm {
                        StudentTermId = 2, Term = 2, TermLabel = "Spring 2018", DegreePlanId = 10
                    },
                    new StudentTerm {
                        StudentTermId = 3, Term = 3, TermLabel = "Summer 2018", DegreePlanId = 10
                    },
                    new StudentTerm {
                        StudentTermId = 4, Term = 4, TermLabel = "Fall 2018", DegreePlanId = 10
                    },
                    new StudentTerm {
                        StudentTermId = 5, Term = 1, TermLabel = "Spring 2018", DegreePlanId = 12
                    },
                    new StudentTerm {
                        StudentTermId = 6, Term = 2, TermLabel = "Summer 2018", DegreePlanId = 12
                    },
                    new StudentTerm {
                        StudentTermId = 7, Term = 3, TermLabel = "Fall 2018", DegreePlanId = 12
                    },
                    new StudentTerm {
                        StudentTermId = 8, Term = 4, TermLabel = "Spring 2019", DegreePlanId = 12
                    },
                    new StudentTerm {
                        StudentTermId = 9, Term = 1, TermLabel = "Spring 2018", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 10, Term = 2, TermLabel = "Summer 2018", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 11, Term = 3, TermLabel = "Fall 2018", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 12, Term = 4, TermLabel = "Spring 2019", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 13, Term = 5, TermLabel = "Summer 2019", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 14, Term = 6, TermLabel = "Fall 2019", DegreePlanId = 14
                    },
                    new StudentTerm {
                        StudentTermId = 15, Term = 1, TermLabel = "Fall 2018", DegreePlanId = 16
                    },
                    new StudentTerm {
                        StudentTermId = 16, Term = 2, TermLabel = "Spring 2019", DegreePlanId = 16
                    },
                    new StudentTerm {
                        StudentTermId = 17, Term = 3, TermLabel = "Summer 2019", DegreePlanId = 16
                    },
                    new StudentTerm {
                        StudentTermId = 18, Term = 4, TermLabel = "Fall 2019", DegreePlanId = 16
                    },
                    new StudentTerm {
                        StudentTermId = 19, Term = 1, TermLabel = "Fall2018", DegreePlanId = 18
                    },
                    new StudentTerm {
                        StudentTermId = 20, Term = 2, TermLabel = "Spring2019", DegreePlanId = 18
                    },
                    new StudentTerm {
                        StudentTermId = 21, Term = 3, TermLabel = "Summer 2019", DegreePlanId = 18
                    },
                    new StudentTerm {
                        StudentTermId = 22, Term = 4, TermLabel = "Fall2019", DegreePlanId = 18
                    },
                    new StudentTerm {
                        StudentTermId = 23, Term = 5, TermLabel = "Spring 2020", DegreePlanId = 18
                    },
                    new StudentTerm {
                        StudentTermId = 24, Term = 6, TermLabel = "Summer 2020", DegreePlanId = 18
                    }
                };
                Console.WriteLine($"Inserted {studentterm.Length} new student terms.");
                foreach (StudentTerm d in studentterm)
                {
                    context.StudentTerms.Add(d);
                }
                context.SaveChanges();
            }
        }
Beispiel #42
0
 private void TestDegree()
 {
     Degree g1       = new Degree(30.047666, 103.053256);
     Degree g2       = new Degree(30.0475, 103.052768);
     var    distance = ExDegree.GetDistance(g1, g2) / 1000;
 }
Beispiel #43
0
        public ShadowCameraSetupPtr create(float n, bool useSimpleNOpt, Degree angle)
        {
            ShadowCameraSetupPtr ret = new ShadowCameraSetupPtr(OgrePINVOKE.LiSPSMShadowCameraSetupPtr_create__SWIG_0(swigCPtr, n, useSimpleNOpt, Degree.getCPtr(angle)), true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="position"></param>
 /// <param name="yaw"></param>
 /// <param name="scale"></param>
 public void AddTree(Entity entity, Vector3 position, Degree yaw,float scale)
 {
     AddTree(entity, position, yaw, scale, null);
 }
Beispiel #45
0
 private static extern void Internal_getPointInArc(IntPtr thisPtr, ref Degree angle, out Vector2 __output);
Beispiel #46
0
 public void YawBody(Degree degree)
 {
     entityNode.Yaw(degree);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="position"></param>
 /// <param name="yaw"></param>
 public void AddTree(Entity entity, Vector3 position, Degree yaw)
 {
     AddTree(entity, position, yaw, 1.0f, null);
 }
Beispiel #48
0
 private static extern void Internal_getPointInArcShell(IntPtr thisPtr, ref Degree angle, float thickness, out Vector2 __output);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="position"></param>
        /// <param name="yaw"></param>
        /// <param name="scale"></param>
        /// <param name="userData"></param>
        public void AddTree(Entity entity, Vector3 position, Degree yaw, float scale, object userData)
        {
            //First convert the coordinate to PagedGeometry's local system
            Vector3 pos = mGeom.ConvertToLocal(position);

            //If the tree is slightly out of bounds (due to imprecise coordinate conversion), fix it
            if (pos.x < mActualBounds.Left)
                pos.x = mActualBounds.Left;
            else if (pos.x > mActualBounds.Right)
                pos.x = mActualBounds.Right;

            if (pos.z < mActualBounds.Top)
                pos.z = mActualBounds.Top;
            else if (pos.z > mActualBounds.Bottom)
                pos.z = mActualBounds.Bottom;

            float x = pos.x;
            float z = pos.z;

            //Check that the tree is within bounds (DEBUG)
            float smallVal = 0.01f;
            if (pos.x < mActualBounds.Left - smallVal || pos.x > mActualBounds.Right + smallVal || pos.z < mActualBounds.Top - smallVal || pos.z > mActualBounds.Bottom + smallVal)
                throw new Exception("Tree position is out of bounds");
            if (scale < mMinimumScale || scale > mMaximumScale)
                throw new Exception("Tree scale out of range");

            //Find the appropriate page grid for the entity
            List<List<TreeDef>> pageGrid = null;
            if (!mPageGridList.TryGetValue(entity, out pageGrid))
            {
                //If it does not exist, create a new page grid
                pageGrid = new List<List<TreeDef>>();
                for (int i = 0; i < (mPageGridX * mPageGridZ); i++)
                    pageGrid.Add(new List<TreeDef>());

                //Register the new page grid in the pageGridList for later retrieval
                mPageGridList.Add(entity, pageGrid);
            }

            //Calculate the gridbounds-relative position of the tree
            float xrel = x - mGridBounds.Left;
            float zrel = z - mGridBounds.Top;

            //Get the appropriate grid element based on the new tree's position
            int pageX = (int)System.Math.Floor(xrel / mPageSize);
            int pageZ = (int)System.Math.Floor(zrel / mPageSize);
            List<TreeDef> treeList = GetGridPage(pageGrid, pageX, pageZ);

            //Create the new tree
            TreeDef tree = new TreeDef();
            tree.XPos = (short)(65535 * (xrel - (pageX * mPageSize)) / mPageSize);
            tree.ZPos = (short)(65535 * (zrel - (pageZ * mPageSize)) / mPageSize);
            tree.Rotation = (byte)(255 * ((Real)yaw / 360.0f));
            tree.Scale = (byte)(255 * ((scale - mMinimumScale) / mMaximumScale));
            tree.UserData = userData;

            //Add it to the tree list
            treeList.Add(tree);

            //Rebuild geometry if necessary
            mGeom.ReloadGeometryPage(new Vector3(x, 0, z));
        }
Beispiel #50
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="coordinate">Coordinate to duplicate</param>
 public Coordinate(Coordinate coordinate)
 {
     _latitude       = coordinate.Latitude;
     _longitude      = coordinate.Longitude;
     _altitudeMeters = 0;
 }
Beispiel #51
0
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
            out Vec3 up, ref Degree cameraFov)
        {
            Vec3 offset;
            {
                Quat rot = new Angles( 0, 0, MathFunctions.RadToDeg(
                    cameraDirection.Horizontal ) ).ToQuat();
                rot *= new Angles( 0, MathFunctions.RadToDeg( cameraDirection.Vertical ), 0 ).ToQuat();
                offset = rot * new Vec3( 1, 0, 0 );
                offset *= cameraDistance;
            }
            Vec3 lookAt = new Vec3( cameraPosition.X, cameraPosition.Y, 0 );

            position = lookAt + offset;
            forward = -offset;
            up = new Vec3( 0, 0, 1 );
        }
Beispiel #52
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="latitude">latitude of pair</param>
 /// <param name="longitude">longitude of pair</param>
 public Coordinate(double latitude, double longitude)
 {
     _latitude       = new Degree(latitude, Degree.AxisType.Latitude);
     _longitude      = new Degree(longitude, Degree.AxisType.Longitude);
     _altitudeMeters = 0;
 }
Beispiel #53
0
            public Vector3 GetPoint()
            {
                int nbPossibleAngles = this.mPossibleAngles.Count;
                if (nbPossibleAngles <= 0) { return -Vector3.UNIT_SCALE; }

                Random random = new Random();
                int n = nbPossibleAngles == 1 ? 0 : random.Next(0, nbPossibleAngles - 1);
                this.mLastAngle = this.mPossibleAngles[n];
                this.mPossibleAngles.Remove(this.mLastAngle);

                this.mLastAngle = new Degree(this.mLastAngle.ValueDegrees + random.Next(-5, 5));
                return this.mCenter + new Vector3(Mogre.Math.Cos(this.mLastAngle) * this.mRadius, 0, Mogre.Math.Sin(this.mLastAngle) * this.mRadius);
            }
Beispiel #54
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="latitude">latitude of pair</param>
 /// <param name="longitude">longitude of pair</param>
 public Coordinate(Degree latitude, Degree longitude)
 {
     _latitude       = latitude;
     _longitude      = longitude;
     _altitudeMeters = 0;
 }
Beispiel #55
0
            void TestEffectCreate_Click( Button sender )
            {
                if( selectedJoystick == null )
                    return;
                if( selectedJoystick.ForceFeedbackController == null )
                    return;

                ForceFeedbackEffectTypes effectType = ForceFeedbackEffectTypes.ConstantForce;
                JoystickAxes[] axes = null;
                {
                    ComboBox typeComboBox = (ComboBox)PageControl.Controls[ "TestEffectType" ];
                    ComboBox axisComboBox = (ComboBox)PageControl.Controls[ "TestEffectAxis" ];
                    if( typeComboBox.SelectedIndex != -1 && axisComboBox.SelectedIndex != -1 )
                    {
                        effectType = (ForceFeedbackEffectTypes)typeComboBox.SelectedItem;
                        axes = ( (TestEffectAxisItem)axisComboBox.SelectedItem ).axes;
                    }
                }

                if( axes == null )
                    return;

                //create effect
                ForceFeedbackEffect effect = selectedJoystick.ForceFeedbackController.CreateEffect( effectType, axes );
                if( effect != null )
                {
                    //you can set duration in seconds.
                    //effect.Duration = 3;

                    if( axes.Length == 2 )
                    {
                        Radian angle = new Degree( 30 ).InRadians();
                        float x = MathFunctions.Cos( angle );
                        float y = MathFunctions.Sin( angle );
                        effect.SetDirection( new float[] { x, y } );
                    }

                    //ConstantForce type
                    ForceFeedbackConstantForceEffect constantForce = effect as ForceFeedbackConstantForceEffect;
                    if( constantForce != null )
                    {
                        constantForce.Magnitude = 1;
                    }

                    //SawtoothDown, SawtoothUp, Sine, Square, Triangle types.
                    ForceFeedbackPeriodicEffect periodic = effect as ForceFeedbackPeriodicEffect;
                    if( periodic != null )
                    {
                        periodic.Magnitude = 1.0f;
                        periodic.Offset = 0.0f;
                        periodic.Phase = 0.5f;
                        periodic.Period = 2;
                    }

                    //Spring, Damper, Friction, Inertia types.
                    ForceFeedbackConditionEffect condition = effect as ForceFeedbackConditionEffect;
                    if( condition != null )
                    {
                        condition.Offset = 0.5f;
                        condition.PositiveSaturation = 1.0f;
                        condition.NegativeSaturation = 1.0f;
                        condition.PositiveCoefficient = 1.0f;
                        condition.NegativeCoefficient = -1.0f;
                        condition.DeadBand = 0.0f;
                    }

                    //Ramp type
                    ForceFeedbackRampEffect ramp = effect as ForceFeedbackRampEffect;
                    if( ramp != null )
                    {
                        ramp.StartForce = -1.0f;
                        ramp.EndForce = 1.0f;
                    }

                    effect.Start();
                }
            }
Beispiel #56
0
            /// <summary>
            /// Reads an &lt;coord&gt; element and parses contained value
            /// </summary>
            /// <param name="reader"></param>
            public void ReadXml(XmlReader reader)
            {
                string str = reader.ReadElementContentAsString().Trim();

                this.TotalSeconds = Degree.Parse(str).TotalSeconds;
            }
Beispiel #57
0
 public CCTV(AEvent aDevice, CategoryType type, System.Collections.Hashtable ht, DeviceType devType, System.Collections.Hashtable DevRange, Degree degree)
 {
     Initialize(aDevice, type, ht, devType, DevRange, degree);
 }
        private bool register(AnimationType animationType, float duration)
        {
            string animationName = getNameByType(animationType);

            switch (animationType)
            {
                #region IDLE

            case AnimationType.IDLE:
            {
                this[animationName] = new SinRotateNodeAnimation(
                    planeView.IdleNode,
                    (duration <= 0 ? 1.0f : duration),
                    new Degree(2),
                    Math.TWO_PI,
                    Vector3.UNIT_Z,
                    animationName
                    );
            }
            break;

                #endregion

                #region BLADE

            case AnimationType.BLADE:
            {
                float airscrewSpeed = 1000;         // 1000 RPM
                if (planeView.Plane != null)
                {
                    airscrewSpeed = planeView.Plane.AirscrewSpeed;
                }
                List <SceneNode> nodes = new List <SceneNode>();
                if (planeView.BladeNode != null)
                {
                    nodes.Add(planeView.BladeNode);
                }
                if (planeView.BladeNodeL != null)
                {
                    nodes.Add(planeView.BladeNodeL);
                }
                if (planeView.BladeNodeR != null)
                {
                    nodes.Add(planeView.BladeNodeR);
                }

                this[animationName] = new ConstRotateNodeAnimation(
                    nodes,
                    airscrewSpeed,
                    Vector3.UNIT_Z,
                    animationName
                    );
                this[animationName].Looped = true;
            }
            break;

                #endregion

                #region TURN

            case AnimationType.INNERTURN:
            {
                float turningDuration = planeView.Plane != null?planeView.Plane.GetConsts().TurningDuration : GameConsts.GenericPlane.CurrentUserPlane.TurningDuration;

                this[animationName] = new GaussRotateNodeAnimation(
                    planeView.InnerNode,
                    (duration <= 0 ? turningDuration : duration),
                    new Degree(60),
                    10.0f,
                    Vector3.UNIT_Z,
                    animationName
                    );
                this[animationName].Looped = false;
            }
            break;

            case AnimationType.OUTERTURN:
            {
                float turningDuration = planeView.Plane != null?planeView.Plane.GetConsts().TurningDuration : GameConsts.GenericPlane.CurrentUserPlane.TurningDuration;

                this[animationName] = new SinRotateNodeAnimation(
                    planeView.OuterNode,
                    (duration <= 0 ? turningDuration : duration),
                    new Degree(180),
                    Math.HALF_PI,
                    Vector3.UNIT_Y,
                    animationName
                    );
                this[animationName].Looped = false;
                (this[animationName] as SinRotateNodeAnimation).ReturnToInitialOrientation = true;
            }
            break;

            case AnimationType.TURN_ON_CARRIER:
            {
                this[animationName] = new SinRotateNodeAnimation(
                    planeView.OuterSteeringNode,
                    (duration <= 0 ? 5.0f : duration),
                    new Degree(180),
                    Math.HALF_PI,
                    Vector3.UNIT_Y,
                    animationName
                    );
                this[animationName].Looped = false;
                (this[animationName] as SinRotateNodeAnimation).ReturnToInitialOrientation = true;
            }
            break;

                #endregion

                #region GEARS_UP

            case AnimationType.L_GEAR_UP:
            {
                if (planeView is P47PlaneView)
                {
                    Degree deg = new Degree(90);
                    if (planeView is B25PlaneView)
                    {
                        deg = 120;
                    }
                    this[animationName] = new SinRotateNodeAnimation(
                        (planeView as P47PlaneView).LWheelInnerNode,
                        (duration <= 0 ? 2.0f : duration),
                        deg,
                        Math.HALF_PI,
                        Vector3.NEGATIVE_UNIT_Z,
                        animationName
                        );
                    this[animationName].Looped = false;
                }
            }
            break;

            case AnimationType.R_GEAR_UP:
            {
                if (planeView is P47PlaneView)
                {
                    Degree deg = new Degree(90);
                    if (planeView is B25PlaneView)
                    {
                        deg = 120;
                    }
                    this[animationName] = new SinRotateNodeAnimation(
                        (planeView as P47PlaneView).RWheelInnerNode,
                        (duration <= 0 ? 2.0f : duration),
                        deg,
                        Math.HALF_PI,
                        Vector3.NEGATIVE_UNIT_Z,
                        animationName
                        );
                    this[animationName].Looped = false;
                }
            }
            break;

            case AnimationType.REAR_GEAR_UP:
            {
                if (planeView is P47PlaneView)
                {
                    Degree deg = new Degree(45);
                    if (planeView is B25PlaneView)
                    {
                        deg = 120;
                    }
                    this[animationName] = new SinRotateNodeAnimation(
                        (planeView as P47PlaneView).RearWheelInnerNode,
                        (duration <= 0 ? 2.0f : duration),
                        deg,
                        Math.HALF_PI,
                        Vector3.NEGATIVE_UNIT_X,
                        animationName
                        );
                    this[animationName].Looped = false;
                }
            }
            break;

                #endregion

            case AnimationType.SPIN_PHASE_ONE:
            {
                this[animationName] = new AccRotateNodeAnimation(
                    planeView.OuterNode,
                    1.0f,
                    new Degree(90),
                    1,
                    Vector3.UNIT_Z,
                    animationName
                    );

                /*    this[animationName] = new HalfSinRotateNodeAnimation(
                 *                                      planeView.OuterNode,
                 *                                      1.2f,
                 *                                      new Degree(90),
                 *                                      Math.PI,
                 *                                      Vector3.UNIT_Z,
                 *                                      animationName,
                 *                                      true
                 *                                      );
                 */
                this[animationName].Looped = false;
            }
            break;

            case AnimationType.SPIN_PHASE_TWO:
            {
                this[animationName] = new Acc2RotateNodeAnimation(
                    planeView.OuterNode,
                    1.0f,
                    new Degree(90),
                    1,
                    Vector3.UNIT_Z,
                    animationName
                    );

                /*this[animationName] = new HalfSinRotateNodeAnimation(
                 *                                  planeView.OuterNode,
                 *                                  1.2f,
                 *                                  new Degree(90),
                 *                                  Math.PI,
                 *                                  Vector3.UNIT_Z,
                 *                                  animationName,
                 *                                  false
                 *                                  );
                 */
                this[animationName].Looped = false;
            }
            break;

            case AnimationType.DEATH_SPIN:
            {
                this[animationName] = new AccRotateNodeAnimation(
                    planeView.OuterNode,
                    9,
                    new Degree(360 * 3),
                    new Radian(Mogre.Math.Sqrt(3)),
                    Vector3.UNIT_Z,
                    animationName
                    );
                this[animationName].Looped = true;
            }
            break;



            default:
                return(false);
            }

            if (animations.Count == 1)
            {
                currentName = animationName;
            }
            return(true);
        }
Beispiel #59
0
 void IMapView.SetMapView(GeoCoordinate center, Degree mapTilt, float mapZoom)
 {
 }
Beispiel #60
0
        private void WriteSeventh(StringBuilder builder, Mode mode, Degree degree)
        {
            var chord = mode.Intervals.GetSeventhChord(Root, degree);

            builder.Append($"{chord}".PadRight(20));
        }