当前位置:网站首页>AutoCAD C polyline self intersection detection
AutoCAD C polyline self intersection detection
2022-06-28 06:03:00 【Wolfberry Angelica mutton soup】
Mainly through Self and self “IntersectWith” operation , The end point and intersection point will be returned .
Source of ideas :How do I know whether the polyline overlap itself? - Autodesk Community - AutoCAD
IntersectWith Result chart :

#region Polyline self intersection detection
/// <summary>
/// Polyline self intersection detection
/// </summary>
/// <param name="pPolyline"> Polyline to be tested </param>
/// <param name="intersectPoint3Ds"> Returns the set of self intersection points </param>
/// <param name="error"></param>
/// <returns></returns>
public static bool SelfIntersectDetect(Polyline pPolyline, out List<Point3d> intersectPoint3Ds, out Exception error)
{
error = null;
intersectPoint3Ds = new List<Point3d>();
try
{
// The result of self intersecting with itself ( Contains vertices and intersections )
var intersectWithResult = new Point3dCollection();
pPolyline.IntersectWith(pPolyline, Intersect.OnBothOperands, intersectWithResult, IntPtr.Zero, IntPtr.Zero);
// Store vertices
HashSet<Point3d> vertices = new HashSet<Point3d>();
int count = pPolyline.NumberOfVertices;
for (int j = 0; j < count; j++)
{
Autodesk.AutoCAD.Geometry.Point2d vertexd = pPolyline.GetPoint2dAt(j);
vertices.Add(new Point3d(vertexd.X, vertexd.Y, 0.0));
}
count = intersectWithResult.Count;
for (int j = 0; j < intersectWithResult.Count; j++)
{
Point3d tempPoint3D = intersectWithResult[j];
// Weeding vertices , Get the real intersection
if (!vertices.Contains(tempPoint3D))
{
intersectPoint3Ds.Add(tempPoint3D);
}
}
return true;
}
catch (Exception ex)
{
error = ex;
return false;
}
}
#endregion边栏推荐
- The length of pytorch dataloader the difference between epoch and iteration
- Scripting and programming languages
- ThreadLocal
- Install fmpefg
- [MySQL] all query tables contain 20million data -- how to optimize SQL
- API learning of OpenGL (2006) glclientactivetexture
- What is the e-commerce conversion rate so abstract?
- API learning of OpenGL (2007) gltexcoordpointer
- 若依实现下拉框
- Slow content advertising: the long-term principle of brand growth
猜你喜欢

Xcode13.3.1 项目执行pod install后报错

Difficulty calculation of Ethereum classic

Development trend of mobile advertising: Leveraging stock and fine marketing

Yygh-6-wechat login

Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes

函数栈帧的创建和销毁

socke.io長連接實現推送、版本控制、實時活躍用戶量統計

Openharmony gnawing paper growth plan -- json-rpc

Common basic functions of Oracle

What are the advantages of e-mail marketing? Why do sellers of shopline independent station attach so much importance to it?
随机推荐
Use of JDBC
Taobao seo training video course [22 lectures]
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance
OpenSCAP 简介
MR-WordCount
Install redis on windows and permanently change the password, and integrate redis with the SSM framework
Cryptography notes
ES9023音频解码芯片的工作原理
At first glance, I can see several methods used by motionlayout
pkg打包node工程(express)
Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics
Caused by: com. fasterxml. jackson. databind. Exc.invalidformatexception: exception resolution
Filecoin hacker song developer competition
The length of pytorch dataloader the difference between epoch and iteration
Jenkins continues integration 2
Differences between basic types and packaging classes
AutoCAD C# 多段线自相交检测
Introduction to openscap
Maskrcnn,fast rcnn, faster rcnn优秀视频
ipvs 导致syn 重传问题