當前位置: 首頁>>代碼示例>>C#>>正文


C# Vector3d.TransformCoordinate方法代碼示例

本文整理匯總了C#中TerraViewer.Vector3d.TransformCoordinate方法的典型用法代碼示例。如果您正苦於以下問題:C# Vector3d.TransformCoordinate方法的具體用法?C# Vector3d.TransformCoordinate怎麽用?C# Vector3d.TransformCoordinate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TerraViewer.Vector3d的用法示例。


在下文中一共展示了Vector3d.TransformCoordinate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MakePosition

        public Vector3d MakePosition(float centerX, float centerY, float offsetX, float offsetY, float angle)
        {
            centerX -= 960;
            centerY -= 558;

            if (this.Anchor == OverlayAnchor.Screen)
            {
                Vector3d point = new Vector3d(centerX + offsetX, centerY + offsetY, 1347);

                if (domeMatX != 0 || domeMatY != 0 || domeAngle != angle)
                {
                    domeMatX = centerX;
                    domeMatY = centerY;
                    domeMatrix = Matrix3d.Translation(new Vector3d(-centerX, -centerY, 0)) * Matrix3d.RotationZ((float)(angle / 180 * Math.PI)) * Matrix3d.Translation(new Vector3d(centerX, centerY, 0));
                }
                point.TransformCoordinate(domeMatrix);

                return point;
            }
            else
            {
                centerX /=1350;
                centerY /=1350;
                Vector3d point = new Vector3d(offsetX, offsetY, 1347);

                if (domeMatX != centerX || domeMatY != centerY || domeAngle != angle)
                {
                    domeMatX = centerX;
                    domeMatY = centerY;
                    domeMatrix =  Matrix3d.RotationZ((float)(angle/180*Math.PI)) * Matrix3d.RotationX(-centerY) * Matrix3d.RotationY(centerX);
                }
                point.TransformCoordinate(domeMatrix);

                return point;

            }
        }
開發者ID:ngonzalezromero,項目名稱:wwt-windows-client,代碼行數:37,代碼來源:Overlay.cs

示例2: QueueThread

        public static void QueueThread()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
            bool fileOnly = fileOnlyThreadID == Thread.CurrentThread.ManagedThreadId;
            while (running)
            {
                if (queue.Count < 1)
                {
                    System.Threading.Thread.Sleep(50);
                }
                else
                {
                    System.Threading.Thread.Sleep(1);
                }

                double minDistance = 1000000000000000000;
                bool overlayTile = false;
                long maxKey = 0;
                int level = 1000;

                queueMutex.WaitOne();
                foreach (Tile t in queue.Values )
                {

                    if (!t.RequestPending ) // && t.InViewFrustum)
                    {
                        Vector3d vectTemp = new Vector3d(t.SphereCenter);

                        vectTemp.TransformCoordinate(Earth3d.WorldMatrix);

                        if (Earth3d.MainWindow.Space)
                        {
                            vectTemp.Subtract(new Vector3d(0.0f, 0.0f, -1.0f));
                        }
                        else
                        {
                            vectTemp.Subtract(Earth3d.MainWindow.RenderContext11.CameraPosition);
                        }

                        double distTemp = Math.Max(0,vectTemp.Length()-t.SphereRadius);

                        bool thisIsOverlay = (t.Dataset.Projection == ProjectionType.Tangent) || (t.Dataset.Projection == ProjectionType.SkyImage);
                        if (distTemp < minDistance && (!overlayTile || thisIsOverlay))
                        {

                            Tile test = (Tile)queue[t.Key];

                            if (!test.FileChecked)
                            {

                                test.FileExists = File.Exists(test.FileName);
                                test.FileChecked = true;
                                if (test.Volitile)
                                {
                                    test.FileExists = false;
                                }
                            }

                            if (test.FileExists || (!test.FileExists && !fileOnly))
                            {
                                minDistance = distTemp;
                                maxKey = t.Key;
                                level = t.Level;
                                overlayTile = thisIsOverlay;
                            }
                        }
                    }

                }
                if (maxKey != 0)
                {
                    Tile workTile = (Tile)queue[maxKey];
                    workTile.RequestPending = true;
                    TileCache.RequestCount++;
                    queueMutex.ReleaseMutex();
                    TileCache.GetTileFromWeb(workTile, true);
                    queueMutex.WaitOne();
                    TileCache.RequestCount--;
                    workTile.RequestPending = false;
                    queue.Remove(workTile.Key);
                }

                queueMutex.ReleaseMutex();
            }
            return;
        }
開發者ID:china-vo,項目名稱:wwt-windows-client,代碼行數:86,代碼來源:TileCache.cs

示例3: SetupMatricesVideoOverlayMultiChannel

        private void SetupMatricesVideoOverlayMultiChannel(double localZoomFactor)
        {

            RenderContext11.LightingEnabled = false;

            Vector3d lookAt = new Vector3d(-1, 0, 0);

            RenderContext11.CameraPosition = new Vector3d(0, 0, 0);
            Vector3d lookUp = new Vector3d(0, 1, 0);

            Matrix3d lookAtAdjust = Matrix3d.Identity;

            WorldMatrix = Matrix3d.Identity;

            RenderContext11.World = WorldMatrix;
            RenderContext11.WorldBase = WorldMatrix;



            lookAt.TransformCoordinate(lookAtAdjust);
            Matrix3d matHeadingPitchRoll;

            if (DomePreviewPopup.Active)
            {
                matHeadingPitchRoll =

                      Matrix3d.RotationY((DomePreviewPopup.Az / 180 * Math.PI)) *
                      Matrix3d.RotationX((DomePreviewPopup.Alt / 180 * Math.PI));
            }
            else
            {
                matHeadingPitchRoll =
                      Matrix3d.RotationZ((config.Roll / 180 * Math.PI)) *
                      Matrix3d.RotationY((config.Heading / 180 * Math.PI)) *
                      Matrix3d.RotationX(((config.Pitch) / 180 * Math.PI));
            }


            RenderContext11.View = Matrix3d.LookAtLH(RenderContext11.CameraPosition, lookAt, lookUp) * DomeMatrix * matHeadingPitchRoll;


            m_nearPlane = .000000001;
            back = 12;
            double aspect = config.Aspect;
            double top = m_nearPlane * 2 / ((1 / Math.Tan(config.UpFov / 180 * Math.PI))) / 2;
            double bottom = m_nearPlane * 2 / -(1 / Math.Tan(config.DownFov / 180 * Math.PI)) / 2;
            double right = m_nearPlane * 2 / (1 / Math.Tan((config.UpFov + config.DownFov) / 2 / 180 * Math.PI)) * aspect / 2;
            double left = -right;


            if (config.MultiChannelDome1)
            {
                ProjMatrix = Matrix3d.PerspectiveOffCenterLH(
                    left,
                    right,
                    bottom,
                    top,
                    m_nearPlane,
                    back);
            }
            else
            {
                RenderContext11.View = RenderContext11.View * config.ViewMatrix;
 
                ProjMatrix = Matrix3d.PerspectiveFovLH((75f / 180f) * Math.PI, 1.777778, m_nearPlane, back);

            }

            RenderContext11.Projection = ProjMatrix;

            ViewMatrix = RenderContext11.View;
            RenderContext11.ViewBase = RenderContext11.View;
            MakeFrustum();
        }
開發者ID:keenedge,項目名稱:wwt-windows-client,代碼行數:74,代碼來源:3dWIndow.cs

示例4: SetupMatricesSolarSystem11

        private void SetupMatricesSolarSystem11(bool forStars, RenderTypes renderType)
        {
            if (SandboxMode)
            {
                if (SolarSystemTrack != SolarSystemObjects.Custom && SolarSystemTrack != SolarSystemObjects.Undefined)
                {
                    viewCamera.ViewTarget = new Vector3d();
                }
            }
            else
            {
                if (SolarSystemTrack != SolarSystemObjects.Custom && SolarSystemTrack != SolarSystemObjects.Undefined)
                {
                    viewCamera.ViewTarget = Planets.GetPlanetTargetPoint(SolarSystemTrack, ViewLat, ViewLong, 0);
                }
            }



            double cameraDistance = SolarSystemCameraDistance;

            Matrix3d trackingMatrix = Matrix3d.Identity;
            cameraDistance -= 0.000001;

            bool activeTrackingFrame = false;
            if (SolarSystemTrack == SolarSystemObjects.Custom && !string.IsNullOrEmpty(TrackingFrame))
            {
                activeTrackingFrame = true;
                viewCamera.ViewTarget = LayerManager.GetFrameTarget(RenderContext11, TrackingFrame, out trackingMatrix);
            }
            else if (!string.IsNullOrEmpty(TrackingFrame))
            {
                TrackingFrame = "";
            }


            Vector3d center = viewCamera.ViewTarget;
            Vector3d lightPosition = -center;

            double localZoom = ZoomFactor * 20;
            Vector3d lookAt = new Vector3d(0, 0, 0);

            Matrix3d viewAdjust = Matrix3d.Identity;
            viewAdjust.Multiply(Matrix3d.RotationX(((-this.ViewLat) / 180f * Math.PI)));
            viewAdjust.Multiply(Matrix3d.RotationY(((-this.ViewLong) / 180f * Math.PI)));

            Matrix3d lookAtAdjust = Matrix3d.Identity;


            bool dome = false;

            Vector3d lookUp;





            if (useSolarSystemTilt && !SandboxMode)
            {
                double angle = CameraAngle;
                if (cameraDistance > 0.0008)
                {
                    angle = 0;
                }
                else if (cameraDistance > 0.00001)
                {
                    double val = Math.Min(1.903089987, Math.Log(cameraDistance, 10) + 5) / 1.903089987;

                    angle = angle * Math.Max(0, 1 - val);
                }



                RenderContext11.CameraPosition = new Vector3d(
                (Math.Sin(-CameraRotate) * Math.Sin(angle) * cameraDistance),
                (Math.Cos(-CameraRotate) * Math.Sin(angle) * cameraDistance),
                ((Math.Cos(angle) * cameraDistance)));
                lookUp = new Vector3d(Math.Sin(-CameraRotate), Math.Cos(-CameraRotate), 0.00001f);
            }
            else
            {
                RenderContext11.CameraPosition = new Vector3d(0, 0, ((cameraDistance)));

                lookUp = new Vector3d(Math.Sin(-CameraRotate), Math.Cos(-CameraRotate), 0.0001f);
            }


            RenderContext11.CameraPosition.TransformCoordinate(viewAdjust);

            cameraOffset = RenderContext11.CameraPosition;

            cameraOffset.TransformCoordinate(Matrix3d.Invert(trackingMatrix));



            lookUp.TransformCoordinate(viewAdjust);



            switch (renderType)
//.........這裏部分代碼省略.........
開發者ID:keenedge,項目名稱:wwt-windows-client,代碼行數:101,代碼來源:3dWIndow.cs

示例5: SetupMatricesSpaceMultiChannel

        private void SetupMatricesSpaceMultiChannel(double localZoomFactor, RenderTypes renderType)
        {
            bool faceSouth = false;

            if ((Settings.Active.LocalHorizonMode && !Settings.Active.GalacticMode) && CurrentImageSet.DataSetType == ImageSetType.Sky)
            {
                faceSouth = !Properties.Settings.Default.FaceNorth;
                Coordinates currentRaDec = Coordinates.HorizonToEquitorial(Coordinates.FromLatLng(0, 0), SpaceTimeController.Location, SpaceTimeController.Now);

                alt = 0;
                az = 0;
                config.DomeTilt = 0;
                if (Properties.Settings.Default.DomeTilt != 0)
                {
                    Properties.Settings.Default.DomeTilt = 0;
                }

                TargetLat = ViewLat = currentRaDec.Dec;
                TargetLong = ViewLong = RAtoViewLng(currentRaDec.RA);

            }

            if (SolarSystemTrack != SolarSystemObjects.Custom && SolarSystemTrack != SolarSystemObjects.Undefined)
            {
                viewCamera.ViewTarget = Planets.GetPlanetTargetPoint(SolarSystemTrack, ViewLat, ViewLong, 0);
            }

            RenderContext11.LightingEnabled = false;

            double localZoom = ZoomFactor * 20;
            Vector3d lookAt = new Vector3d(0, 0, -1);
            FovAngle = ((ZoomFactor/**16*/) / FOVMULT) / Math.PI * 180;

            // for constellations
            ViewPoint = Coordinates.RADecTo3d(this.RA, -this.Dec, 1.0);


            double distance = (Math.Min(1, (.5 * (ZoomFactor / 180)))) - 1 + 0.0001;

            RenderContext11.CameraPosition = new Vector3d(0, 0, distance);
            Vector3d lookUp = new Vector3d(Math.Sin(CameraRotate), Math.Cos(CameraRotate), 0.0001f);

            Matrix3d lookAtAdjust = Matrix3d.Identity;

            if ((Settings.Active.GalacticMode && !Settings.Active.LocalHorizonMode) && CurrentImageSet.DataSetType == ImageSetType.Sky)
            {
                if (!galMatInit)
                {
                    galacticMatrix = Matrix3d.Identity;
                    galacticMatrix.Multiply(Matrix3d.RotationY(-(90 - (17.7603329867975 * 15)) / 180.0 * Math.PI));
                    galacticMatrix.Multiply(Matrix3d.RotationX(-((-28.9361739586894)) / 180.0 * Math.PI));
                    galacticMatrix.Multiply(Matrix3d.RotationZ(((31.422052860102041270114993238783) - 90) / 180.0 * Math.PI));
                    galMatInit = true;
                }

                WorldMatrix = galacticMatrix;
                WorldMatrix.Multiply(Matrix3d.RotationY(((az)) / 180.0 * Math.PI));
                WorldMatrix.Multiply(Matrix3d.RotationX(-((alt)) / 180.0 * Math.PI));


                double[] gPoint = Coordinates.GalactictoJ2000(az, alt);

                this.RA = gPoint[0] / 15;
                this.Dec = gPoint[1];
                targetViewCamera.Lat = viewCamera.Lat;
                targetViewCamera.Lng = viewCamera.Lng;
            }
            else
            {
                // Show in Ecliptic

                WorldMatrix = Matrix3d.RotationY(-((this.ViewLong + 90) / 180.0 * Math.PI));
                WorldMatrix.Multiply(Matrix3d.RotationX(((-this.ViewLat) / 180.0 * Math.PI)));
            }


            RenderContext11.World = WorldMatrix;
            RenderContext11.WorldBase = WorldMatrix;



            lookAt.TransformCoordinate(lookAtAdjust);
            Matrix3d matHeadingPitchRoll;

            if (DomePreviewPopup.Active)
            {
                matHeadingPitchRoll =

                      Matrix3d.RotationY((DomePreviewPopup.Az / 180 * Math.PI)) *
                      Matrix3d.RotationX((DomePreviewPopup.Alt / 180 * Math.PI));
            }
            else
            {
                matHeadingPitchRoll =
                      Matrix3d.RotationZ((config.Roll / 180 * Math.PI)) *
                      Matrix3d.RotationY((config.Heading / 180 * Math.PI)) *
                      Matrix3d.RotationX(((config.Pitch) / 180 * Math.PI));
            }

            if (rift)
//.........這裏部分代碼省略.........
開發者ID:keenedge,項目名稱:wwt-windows-client,代碼行數:101,代碼來源:3dWIndow.cs


注:本文中的TerraViewer.Vector3d.TransformCoordinate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。