本文整理汇总了C#中Point3d.IsEqualTo方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.IsEqualTo方法的具体用法?C# Point3d.IsEqualTo怎么用?C# Point3d.IsEqualTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3d
的用法示例。
在下文中一共展示了Point3d.IsEqualTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contains
/// <summary>
/// Gets a value indicating whether the specified point belongs to the collection.
/// </summary>
/// <param name="pts">The instance to which the method applies.</param>
/// <param name="pt">The point to search.</param>
/// <param name="tol">The tolerance to use in comparisons.</param>
/// <returns>true if the point is found; otherwise, false.</returns>
public static bool Contains(this Point3dCollection pts, Point3d pt, Tolerance tol)
{
for (int i = 0; i < pts.Count; i++)
{
if (pt.IsEqualTo(pts[i], tol))
return true;
}
return false;
}
示例2: GetInsertionPointOfBlockReference
///////////the below has proven obsolete
//////public static BlockReference GetBlockReference(ObjectId BRid)
//////{
////// Document doc = Application.DocumentManager.MdiActiveDocument;
////// Editor ed = doc.Editor;
////// Database db = doc.Database;
////// BlockReference br;
////// // check the current value of the br and see if it is null - it should not be
////// using (Transaction tr = doc.TransactionManager.StartTransaction())
////// {
////// br = BRid.GetObject(OpenMode.ForRead) as BlockReference;
////// if (br != null)
////// {
////// return br;
////// }
////// // throws an exception if the point does not have any value
////// else
////// {
////// throw new Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.NullObjectId, "The block reference returned is null - probably because the objectID you passed into the GetBlockReference method was not a blockReference.");
////// }
////// }
////// return br;
//////}
public static Point3d GetInsertionPointOfBlockReference(ObjectId BRid)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
Point3d insertionPoint = new Point3d();
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
BlockReference br = BRid.GetObject(OpenMode.ForRead) as BlockReference;
if (br != null)
{
insertionPoint = br.Position;
}
}
// throws an exception if the point does not have any value
if (insertionPoint.IsEqualTo(new Point3d()))
{
throw new Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.InvalidDxf3dPoint, "The block reference does not have an insertion point. Probably the objectID you passed into the GetInsertionPointOfBlockReference method is not in fact a blockReference id.");
}
return insertionPoint;
}
示例3: BreakAtPoint
/// <summary>
/// Breaks the polyline at specified point.
/// </summary>
/// <param name="pline">The polyline this method applies to.</param>
/// <param name="brkPt">The point where to break the polyline.</param>
/// <returns>An array of the two resullting polylines.</returns>
public static Polyline[] BreakAtPoint(this Polyline pline, Point3d brkPt)
{
brkPt = pline.GetClosestPointTo(brkPt, false);
// le point spécifié est sur le point de départ de la polyligne
if (brkPt.IsEqualTo(pline.StartPoint))
return new Polyline[2] { null, (Polyline)pline.Clone() };
// le point spécifié est sur le point de fin de la polyligne
if (brkPt.IsEqualTo(pline.EndPoint))
return new Polyline[2] { (Polyline)pline.Clone(), null };
double param = pline.GetParameterAtPoint(brkPt);
int index = (int)param;
int num = pline.NumberOfVertices;
Polyline pl1 = (Polyline)pline.Clone();
if (pline.Closed)
{
pl1.AddVertexAt(
pline.NumberOfVertices,
pline.GetPoint2dAt(0),
pline.GetStartWidthAt(num - 1),
pline.GetEndWidthAt(num - 1),
pline.GetBulgeAt(num - 1));
pl1.Closed = false;
}
Polyline pl2 = (Polyline)pl1.Clone();
// le point spécifié est sur un sommet de la polyligne
if (Math.Round(param, 6) == index)
{
for (int i = pl1.NumberOfVertices - 1; i > index; i--)
{
pl1.RemoveVertexAt(i);
}
for (int i = 0; i < index; i++)
{
pl2.RemoveVertexAt(0);
}
return new Polyline[2] { pl1, pl2 };
}
// le point spécifié est sur un segment
Point2d pt = brkPt.Convert2d(new Plane(Point3d.Origin, pline.Normal));
for (int i = pl1.NumberOfVertices - 1; i > index + 1; i--)
{
pl1.RemoveVertexAt(i);
}
pl1.SetPointAt(index + 1, pt);
for (int i = 0; i < index; i++)
{
pl2.RemoveVertexAt(0);
}
pl2.SetPointAt(0, pt);
if (pline.GetBulgeAt(index) != 0.0)
{
double bulge = pline.GetBulgeAt(index);
pl1.SetBulgeAt(index, MultiplyBulge(bulge, param - index));
pl2.SetBulgeAt(0, MultiplyBulge(bulge, index + 1 - param));
}
return new Polyline[2] { pl1, pl2 };
}
示例4: FindNode
/// <summary>
/// Поиск узла по координатам точки
/// </summary>
/// <param name="point">Точка, в которой должен находится узел</param>
/// <returns>Узел, удовлетворяющий условию поиска, либо null, если не найден</returns>
Node FindNode(Point3d point)
{
return Nodes.FirstOrDefault(n => point.IsEqualTo(n.Point));
}