当前位置:网站首页>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边栏推荐
- Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException:异常解决
- 【无标题】
- Pre training model parameter mismatch
- 移动广告发展动向:撬动存量,精细营销
- 19 fonctions de perte d'apprentissage profond
- Install redis on windows and permanently change the password, and integrate redis with the SSM framework
- @The reason why the Autowired annotation is empty
- Independent station sellers are using the five e-mail marketing skills, do you know?
- SQL and list de duplication
- 借助nz-pagination中的let-total解析ng-template
猜你喜欢

AutoCAD C # Polyline Small Sharp angle Detection

Yygh-6-wechat login

What is the e-commerce conversion rate so abstract?

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

Use of JDBC

Small ball playing

慢内容广告:品牌增长的长线主义

death_ satan/hyperf-validate

自定义 cube-ui 弹出框dialog支持多个且多种类型的input框

YYGH-BUG-03
随机推荐
Main functions of 5ggnb and ng ENB
重载,重写的区别,抽象类,接口的区别
How to add live chat in your Shopify store?
Openharmony gnawing paper growth plan -- json-rpc
Common basic functions of Oracle
YYGH-6-微信登录
Apple MDM Bypass 免越狱绕过MDM配置锁 免费
Configure multiple database connections using the SSM framework
cocoapod中的第三方库怎么引用本地头文件
Yygh-7-user management
Apple MDM bypass jailfree bypass MDM configuration lock free
V4l2 driver layer analysis
socke. IO long connection enables push, version control, and real-time active user statistics
Example of MVVM framework based on kotlin+jetpack
Data middle office: an article that takes you to understand data middle office in simple terms
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]]
Filecoin hacker song developer competition
SQL and list de duplication
Binder interview: memory management unit
easyui下拉框选中触发事件