コード例 #1
0
ファイル: Float3.cs プロジェクト: adrianj/Direct3D-Testing
 public static Float3 ConvertCartesianToPolar(Float3 cartesian)
 {
     Vector3 vec = cartesian.AsVector3();
     double radius = vec.Length();
     double azimuth = Math.Atan2(cartesian.X, cartesian.Z);
     if (azimuth < 0) azimuth += Math.PI * 2;
     double elevation = Math.Asin(cartesian.Y / radius);
     return new Float3(radius, azimuth, elevation);
 }
コード例 #2
0
        private void UpdateMapTerrainThread(object o, DoWorkEventArgs e)
        {
            while (!terrainWorker.CancellationPending)
            {
                if (TerrainToProcess.Count > 0)
                {
                    try
                    {
                        MapDescriptor desc = TerrainToProcess.Peek();
                        Shape target = desc.Tag as CombinedMapData;
                        Shape shape = null;
                        shapeFactory.BottomLeftLatitude = desc.Latitude;
                        shapeFactory.BottomLeftLongitude = desc.Longitude;
                        shapeFactory.LatitudeDelta = desc.Delta;
                        shapeFactory.LongitudeDelta = desc.Delta;
                        if (!UseTerrainData)
                            shape = shapeFactory.GenerateNullShape();
                        else
                        {
                            shape = GenerateShapeFromFile(desc);
                        }
                        Float3 location = new Float3((float)(desc.Longitude * UnitsPerDegreeLatitude), 0, (float)(desc.Latitude * UnitsPerDegreeLatitude));
                        shape.Location = location.AsVector3();
                        target.CopyShapeFrom(shape);
                        FireMapUpdateCompletedEvent(new ShapeChangeEventArgs(target, ShapeChangeEventArgs.ChangeAction.Add));
                        TerrainToProcess.Dequeue();
                    }
                    catch (InvalidOperationException) { }
                }
                System.Threading.Thread.Sleep(10);

            }
        }
コード例 #3
0
ファイル: Float3.cs プロジェクト: adrianj/Direct3D-Testing
 public Float3(Float3 original)
     : this(original.AsVector3())
 {
 }
コード例 #4
0
ファイル: Cone.cs プロジェクト: adrianj/Direct3D-Testing
 private void SetBroadLocation(Float3 value)
 {
     Vector3 broad = value.AsVector3();
     float dist = Vector3.Distance(broad, Location);
     mScale = new Vector3(mScale.X, dist, mScale.Z);
     Vector3 diff = Vector3.Subtract(broad, this.Location);
     double y = diff.Y;
     double x = diff.X;
     double z = diff.Z;
     Elevation = (float)(Math.Asin(y / dist));
     Azimuth = (float)(Math.Atan2(x, z));
 }