本文整理汇总了C#中Segment.Subdivide方法的典型用法代码示例。如果您正苦于以下问题:C# Segment.Subdivide方法的具体用法?C# Segment.Subdivide怎么用?C# Segment.Subdivide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segment
的用法示例。
在下文中一共展示了Segment.Subdivide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubdivideRadialInGeometry
/// <summary>
/// Equally subdivides a segment with a startpoint at the origin, in the respective geometry.
/// </summary>
private static Vector3D[] SubdivideRadialInGeometry( Segment radial, int divisions, Geometry g )
{
List<Vector3D> result = new List<Vector3D>();
if( radial.Type != SegmentType.Line )
{
Debug.Assert( false );
return result.ToArray();
}
switch( g )
{
case Geometry.Spherical:
{
double eLength = radial.Length;
double sLength = Spherical2D.e2sNorm( eLength );
double divLength = sLength / divisions;
for( int i = 0; i <= divisions; i++ )
{
double temp = Spherical2D.s2eNorm( divLength * i );
result.Add( radial.P2 * temp / eLength );
}
break;
}
case Geometry.Euclidean:
return radial.Subdivide( divisions );
case Geometry.Hyperbolic:
{
double eLength = radial.Length;
double hLength = DonHatch.e2hNorm( eLength );
double divLength = hLength / divisions;
for( int i = 0; i <= divisions; i++ )
{
double temp = DonHatch.h2eNorm( divLength * i );
result.Add( radial.P2 * temp / eLength );
}
break;
}
}
return result.ToArray();
}