当前位置:网站首页>AutoCAD C # Polyline Small Sharp angle Detection
AutoCAD C # Polyline Small Sharp angle Detection
2022-06-28 06:03:00 【Soupe d'agneau de Wolfberry Angelica】

#region Détection de petits angles aigus
public static bool AcuteAngleDetect(Polyline pPolyline, double toloranceAngle, out List<Point3d> listPoint3Ds, out Exception error)
{
error = null;
listPoint3Ds = new List<Point3d>();
try
{
List<double> angles = new List<double>();
int vertexNum = pPolyline.NumberOfVertices;
Point3d pointFirst = new Point3d();
Point3d pointSecond = new Point3d();
// Traverser pour obtenir les coordonnées du Sommet de la polyligne
for (int i = 0; i < vertexNum-1; i++)
{
pointFirst = pPolyline.GetPoint3dAt(i);
pointSecond = pPolyline.GetPoint3dAt(i + 1);
double angle = GetAngleByTwoPoint(pointFirst, pointSecond);
if (i>0)
{
double preAngle = angles[i-1];
if (DetectAcuteAngleUsingVectorAngle(toloranceAngle, preAngle, angle))
{
listPoint3Ds.Add(pointFirst);
}
}
angles.Add(angle);
}
if (pPolyline.Closed)
{
// Calculer l'avant - dernier angle
pointFirst = pPolyline.GetPoint3dAt(vertexNum - 1);
pointSecond = pPolyline.GetPoint3dAt(0);
double angle = GetAngleByTwoPoint(pointFirst, pointSecond);
double preAngle = angles[angles.Count-1];
if (DetectAcuteAngleUsingVectorAngle(toloranceAngle, preAngle, angle))
{
listPoint3Ds.Add(pointFirst);
}
// Calculer le dernier angle
angle = angles[angles.Count - 1];
preAngle = angles[0];
if (DetectAcuteAngleUsingVectorAngle(toloranceAngle, preAngle, angle))
{
listPoint3Ds.Add(pPolyline.GetPoint3dAt(0));
}
}
return true;
}
catch (Exception ex)
{
error = ex;
return false;
}
}
public static double GetAngleByTwoPoint(Point3d first, Point3d second)
{
return Math.Atan2(second.Y - first.Y, second.X - first.X) * 180 / Math.PI;
}
public static bool DetectAcuteAngleUsingVectorAngle(double toloranceAngle, double angleFirst, double angleSecond)
{
return Math.Abs(Math.Abs(angleSecond - angleFirst) - 180) < toloranceAngle;
}
#endregion边栏推荐
- idea根据数据库表生成实体类
- Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]]
- CSI以及本地盘的相关实现记录
- 5G网络整体架构
- 原动力×云原生正发声 降本增效大讲堂
- Select trigger event from easyUI drop-down box
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
- Deep learning 19 loss functions
- 猿粉猿动力-开发者活动袭!
- Ape pink ape power - Developer activity attack!
猜你喜欢

Independent station sellers are using the five e-mail marketing skills, do you know?

YYGH-7-用户管理

Slow content advertising: the long-term principle of brand growth

Jenkins continues integration 2
![A full set of excellent SEO tutorials worth 300 yuan [159 lessons]](/img/d7/7e522143b1e6b3acf14a0894f50d26.jpg)
A full set of excellent SEO tutorials worth 300 yuan [159 lessons]

Prime mover × Cloud primordial is making sound, reducing cost and increasing efficiency lecture hall

Data middle office: six questions data middle office

cocoapod中的第三方库怎么引用本地头文件

【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images

What are the advantages of e-mail marketing? Why do sellers of shopline independent station attach so much importance to it?
随机推荐
Development trend of mobile advertising: Leveraging stock and fine marketing
ES9023音频解码芯片的工作原理
MR-WordCount
V4l2 driver layer analysis
How the third-party libraries in cocoapod reference local header files
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]]
easyui下拉框选中触发事件
全球国家(和地区)信息JSON数据
使用SSM框架,配置多个数据库连接
6. graduation design temperature and humidity monitoring system (esp8266 + DHT11 +oled real-time upload temperature and humidity data to the public network server and display the real-time temperature
基本类型和包装类的区别
ThreadLocal
Ethereum Classic的难度计算|猿创征文
YYGH-BUG-02
猿粉猿动力-开发者活动袭!
Differences between basic types and packaging classes
Yolact++ Pytorch环境
Mosaic data enhanced mosaic
Ape pink ape power - Developer activity attack!
mysql常用函数