Error message here!

Hide Error message here!

Error message here!

Hide Error message here!

Error message here!

Close

## objectarx 批量倒角

HelloLLLLL 2020-02-14 15:31:00 阅读数:40 评论数:0 点赞数:0 收藏数:0

```/// <summary>
/// 倒圆角。生成两点，按左右上下序。
/// </summary>
/// <param name="vertex">要被倒角的点</param>
/// <param name="vec1">角两边的向量，向量的起点是vertex</param>
/// <param name="vec2"></param>
/// <returns>生成的点</returns>
public static Point2d[] Fillet(Point2d vertex,
Vector2d vec1, Vector2d vec2, double radius)
{
var uvec1 = vec1.GetNormal();
var uvec2 = vec2.GetNormal();
var vecToCenterUnit = (uvec1 + uvec2).GetNormal();
var vecToCenter = vecToCenterUnit * radius /
Math.Sin(Math.Min(vecToCenterUnit.GetAngleTo(uvec1),
vecToCenterUnit.GetAngleTo(uvec2)));
var projVec1 = uvec1 * uvec1.DotProduct(vecToCenter);
var projVec2 = uvec2 * uvec2.DotProduct(vecToCenter);
return new[] { vertex + projVec1, vertex + projVec2 }
.OrderBy(p => p.X)
.ThenBy(p => p.Y)
.ToArray();
}```

凸度的计算：
bulge = tan((CMathUtil::PI() - vec2.angleTo(vec1)) / 4);

https://www.cnblogs.com/HelloQLQ/p/12307614.html