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


C# C2DPoint.GetPointTo方法代码示例

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


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

示例1: SetMinimum

        /// <summary>
        /// Set to be the minimum bounding circle for the 2 points.
        /// </summary>
        /// <param name="Point1">The first point to include.</param> 
        /// <param name="Point2">The second point to include.</param> 
	    public void SetMinimum(C2DPoint Point1, C2DPoint Point2)
        {
	        C2DVector Vec = new C2DVector(Point1, Point2);
	        Vec.Multiply( 0.5);
	        Radius = Vec.GetLength();
	        _Centre.Set(Point1.GetPointTo(Vec));
        }
开发者ID:micrak,项目名称:rakomeister-attic,代码行数:12,代码来源:C2DCircle.cs

示例2: Reflect

 /// <summary>
 /// Reflects this through the point given.
 /// </summary>
 /// <param name="Other">The point to reflect this through.</param>
 public override void Reflect(C2DPoint Other)
 {
     // Set up a vector from this to the other
     C2DVector vec = new C2DVector(this, Other);
     // Now use the vector to find the reflection by continuing along it from the point given.
     this.Set(  Other.GetPointTo(vec) );
 }
开发者ID:nvankaam,项目名称:DelaunayTriangulation,代码行数:11,代码来源:C2DPoint.cs

示例3: Distance

        /// <summary>
        /// Distance to a circle, returns the closest point on both circles.
        /// </summary>
        /// <param name="Other">Circle to calculate the distance to.</param> 
        /// <param name="ptOnThis">Closest point on this circle to recieve the result.</param> 
        /// <param name="ptOnOther">Closest point on the other circle to recieve the result.</param> 
        public double Distance(C2DCircle Other,  C2DPoint ptOnThis,  C2DPoint ptOnOther)
        {
            double dCenCenDist = _Centre.Distance(Other.Centre);
            double dOtherRadius = Other.Radius;

            //    C2DPoint ptThis;
             //   C2DPoint ptOther;
            double dDist = dCenCenDist - Radius - dOtherRadius;

            if (dDist > 0 )
            {
                // they do not interect and they are outside each other.
                    C2DLine Line = new C2DLine(_Centre, Other.Centre);
                    Line.vector.SetLength( Radius);
                    ptOnThis.Set( Line.GetPointTo() );

                    Line.vector.Reverse();
                    Line.SetPointFrom(Other.Centre);
                    Line.vector.SetLength(Other.Radius);
                    ptOnOther.Set(Line.GetPointTo());
            }
            else
            {
                if ( (dCenCenDist + Radius) < dOtherRadius)
                {
                    // This is inside the other
                    dDist =  dCenCenDist + Radius  - dOtherRadius ; // -ve if inside
                        C2DVector vec = new C2DVector( Other.Centre, Centre);
                        vec.Multiply(   Radius   /dCenCenDist  ); // set the vector to be the length of my radius.
                        ptOnThis.Set( _Centre.GetPointTo( vec));
                        vec.Multiply(   dDist   /Radius  ); // set the vector to be the distance.
                        ptOnOther.Set(ptOnThis.GetPointTo( vec));

                }
                else if ( (dCenCenDist + dOtherRadius) < Radius)
                {
                    // The other is inside this.
                    dDist = dCenCenDist + dOtherRadius -  Radius; // -ve if inside
                        C2DVector vec = new C2DVector( _Centre, Other.Centre);
                        vec.Multiply (   dOtherRadius   /dCenCenDist  ); // set the vector to be the length of my radius.
                        ptOnOther.Set( Other.Centre.GetPointTo( vec));
                        vec.Multiply(   dDist   /  dOtherRadius  ); // set the vector to be the distance.
                        ptOnThis.Set(ptOnOther.GetPointTo( vec));

                }
                else
                {
                    // there is an intersection
                    dDist = 0;
                    List<C2DPoint> Ints = new List<C2DPoint>();
                    if (Crosses(Other,  Ints))
                    {
                        ptOnThis.Set(Ints[0]);
                        ptOnOther.Set(ptOnThis);
                    }
                    else
                    {
                        Debug.Assert(false);
                        return 0;
                    }
                }
            }

              //      if (ptOnThis)
            //        *ptOnThis = ptThis;
              //      if (ptOnOther)
            //        *ptOnOther = ptOther;

            return dDist;
        }
开发者ID:nvankaam,项目名称:DelaunayTriangulation,代码行数:76,代码来源:C2DCircle.cs

示例4: GetCircleCentre

        /// <summary>
        /// Returns the corresponding circle's centre.
        /// </summary>
        public C2DPoint GetCircleCentre() 
        {
	        if (!IsValid() ) 
		        return new C2DPoint(0, 0);

	        C2DPoint MidPoint = new C2DPoint(Line.GetMidPoint());
	        double dMinToStart = MidPoint.Distance( Line.point);

	        double dMidToCentre = Math.Sqrt( Radius * Radius - dMinToStart * dMinToStart);

	        C2DVector MidToCentre = new C2DVector(Line.vector);
	        if ( CentreOnRight) 
                MidToCentre.TurnRight();
	        else 
                MidToCentre.TurnLeft();

	        MidToCentre.SetLength(dMidToCentre);

	        return (MidPoint.GetPointTo(MidToCentre));
        }
开发者ID:micrak,项目名称:rakomeister-attic,代码行数:23,代码来源:C2DArc.cs


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