本文整理汇总了C#中Point2d.DivideBy方法的典型用法代码示例。如果您正苦于以下问题:C# Point2d.DivideBy方法的具体用法?C# Point2d.DivideBy怎么用?C# Point2d.DivideBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2d
的用法示例。
在下文中一共展示了Point2d.DivideBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Centroid2d
/// <summary>
/// Gets the centroid of the polyline.
/// </summary>
/// <param name="pl">The instance to which the method applies.</param>
/// <returns>The centroid of the polyline (OCS coordinates).</returns>
public static Point2d Centroid2d(this Polyline pl)
{
Point2d cen = new Point2d();
Triangle2d tri = new Triangle2d();
CircularArc2d arc = new CircularArc2d();
double tmpArea;
double area = 0.0;
int last = pl.NumberOfVertices - 1;
Point2d p0 = pl.GetPoint2dAt(0);
double bulge = pl.GetBulgeAt(0);
if (bulge != 0.0)
{
arc = pl.GetArcSegment2dAt(0);
area = arc.AlgebricArea();
cen = arc.Centroid() * area;
}
for (int i = 1; i < last; i++)
{
tri.Set(p0, pl.GetPoint2dAt(i), pl.GetPoint2dAt(i + 1));
tmpArea = tri.AlgebricArea;
cen += (tri.Centroid * tmpArea).GetAsVector();
area += tmpArea;
bulge = pl.GetBulgeAt(i);
if (bulge != 0.0)
{
arc = pl.GetArcSegment2dAt(i);
tmpArea = arc.AlgebricArea();
area += tmpArea;
cen += (arc.Centroid() * tmpArea).GetAsVector();
}
}
bulge = pl.GetBulgeAt(last);
if ((bulge != 0.0) && (pl.Closed == true))
{
arc = pl.GetArcSegment2dAt(last);
tmpArea = arc.AlgebricArea();
area += tmpArea;
cen += (arc.Centroid() * tmpArea).GetAsVector();
}
return cen.DivideBy(area);
}
开发者ID:vildar82,项目名称:AcadLib,代码行数:47,代码来源:PolylineExtensions.cs本文标签属性:
示例:示例的拼音
代码:代码编程
Point2d:Point2d
DivideBy:DivideBy