当前位置:网站首页>AutoCAD C polyline small acute angle detection
AutoCAD C polyline small acute angle detection
2022-06-28 06:03:00 【Wolfberry Angelica mutton soup】

#region Small acute angle detection
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();
// Traverse to obtain the vertex coordinates of the polyline
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)
{
// Calculate the penultimate 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);
}
// Calculate the last 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边栏推荐
猜你喜欢

Filecoin hacker song developer competition

What are the advantages of e-mail marketing? Why do sellers of shopline independent station attach so much importance to it?

AutoCAD C# 多段线小锐角检测

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

YYGH-BUG-03

Valueerror: iterative over raw text documents expected, string object received

Working principle of es9023 audio decoding chip

Yygh-6-wechat login

深度学习19种损失函数
![RL practice (0) - and the platform xinchou winter season [rule based policy]](/img/dc/10d615c64123475fea180e035095ff.png)
RL practice (0) - and the platform xinchou winter season [rule based policy]
随机推荐
Important basis for ERP software company selection
Difficulty calculation of Ethereum classic
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException:异常解决
函数栈帧的创建和销毁
How to add live chat in your Shopify store?
Prime mover × Cloud primordial is making sound, reducing cost and increasing efficiency lecture hall
慢内容广告:品牌增长的长线主义
JQ picture amplifier
移动广告发展动向:撬动存量,精细营销
Simple handwritten debounce function
Enum
Data midrange: implementation and summary of AI midrange
Configure multiple database connections using the SSM framework
@Autowired注解为空的原因
Small ball playing
easyui 重置多条件查询
Maskrcnn, fast RCNN, fast RCNN excellent video
bash install.sh ********错误
5G网络整体架构
death_satan/hyperf-validate