本文整理汇总了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));
}
示例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) );
}
示例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;
}
示例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));
}