当前位置: 首页>>代码示例>>C#>>正文


C# Vector3D.Dist方法代码示例

本文整理汇总了C#中Vector3D.Dist方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.Dist方法的具体用法?C# Vector3D.Dist怎么用?C# Vector3D.Dist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector3D的用法示例。


在下文中一共展示了Vector3D.Dist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GreatCirclePole

        /// <summary>
        /// Calculates the two poles of a great circle defined by two points.
        /// </summary>
        public static void GreatCirclePole( Vector3D sphereCenter, Vector3D p1, Vector3D p2,
			out Vector3D pole1, out Vector3D pole2 )
        {
            double sphereRadius = p1.Dist( sphereCenter );
            Debug.Assert( Tolerance.Equal( sphereRadius, p2.Dist( sphereCenter ) ) );

            Vector3D v1 = p1 - sphereCenter;
            Vector3D v2 = p2 - sphereCenter;
            pole1 = v1.Cross( v2 ) + sphereCenter;
            pole2 = v2.Cross( v1 ) + sphereCenter;
        }
开发者ID:roice3,项目名称:Honeycombs,代码行数:14,代码来源:Spherical2D.cs

示例2: LODThin

 public static void LODThin( Vector3D e1, Vector3D e2, out int div )
 {
     int maxHit = 12;
     //Vector3D avg = ( e1 + e2 ) / 2;
     //int hit = (int)( avg.Abs() * maxHit );
     double dist = e1.Dist( e1 );
     int hit = (int)dist * 20 * maxHit;
     div = 20 - hit;
 }
开发者ID:roice3,项目名称:Honeycombs,代码行数:9,代码来源:H3Utils.cs

示例3: LOD_Ideal

            public static void LOD_Ideal( Vector3D e1, Vector3D e2, out int div1, out int div2, H3.Settings settings )
            {
                if( settings.Halfspace )
                    throw new System.NotImplementedException();

                div1 = 13;
                div2 = (int)( 5 + Math.Sqrt( e1.Dist( e2 ) ) * 10 );
            }
开发者ID:roice3,项目名称:Honeycombs,代码行数:8,代码来源:H3Utils.cs

示例4: GeodesicIdealEndpoints

            /// <summary>
            /// Given two points (in the UHS model), find the endpoints 
            /// of the associated geodesic that lie on the z=0 plane.
            /// </summary>
            public static void GeodesicIdealEndpoints( Vector3D v1, Vector3D v2, out Vector3D z1, out Vector3D z2 )
            {
                // We have to special case when geodesic is vertical (parallel to z axis).
                Vector3D diff = v2 - v1;
                Vector3D diffFlat = new Vector3D( diff.X, diff.Y );
                if( Tolerance.Zero( diffFlat.Abs() ) )	// Vertical
                {
                    Vector3D basePoint = new Vector3D( v1.X, v1.Y );
                    z1 = diff.Z > 0 ? basePoint : Infinity.InfinityVector;
                    z2 = diff.Z < 0 ? basePoint : Infinity.InfinityVector;
                }
                else
                {
                    if( Tolerance.Zero( v1.Z ) && Tolerance.Zero( v2.Z ) )
                    {
                        z1 = v1;
                        z2 = v2;
                        return;
                    }

                    // If one point is ideal, we need to not reflect that one!
                    bool swapped = false;
                    if( Tolerance.Zero( v1.Z ) )
                    {
                        Utils.SwapPoints( ref v1, ref v2 );
                        swapped = true;
                    }

                    Vector3D v1_reflected = v1;
                    v1_reflected.Z *= -1;
                    Circle3D c = new Circle3D( v1_reflected, v1, v2 );
                    Vector3D radial = v1 - c.Center;
                    radial.Z = 0;
                    if( !radial.Normalize() )
                    {
                        radial = v2 - c.Center;
                        radial.Z = 0;
                        if( !radial.Normalize() )
                            System.Diagnostics.Debugger.Break();
                    }

                    radial *= c.Radius;
                    z1 = c.Center + radial;
                    z2 = c.Center - radial;

                    // Make sure the order will be right.
                    // (z1 closest to v1 along arc).
                    if( v1.Dist( z1 ) > v2.Dist( z1 ) )
                        Utils.SwapPoints( ref z1, ref z2 );
                    if( swapped )
                        Utils.SwapPoints( ref z1, ref z2 );
                }
            }
开发者ID:roice3,项目名称:Honeycombs,代码行数:57,代码来源:H3Utils.cs


注:本文中的Vector3D.Dist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。