本文整理汇总了C#中System.Edge.get_Face方法的典型用法代码示例。如果您正苦于以下问题:C# Edge.get_Face方法的具体用法?C# Edge.get_Face怎么用?C# Edge.get_Face使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Edge
的用法示例。
在下文中一共展示了Edge.get_Face方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsTrapezoid
/// <summary>
/// Check if the given bottom edge was shared by a trapezoid face with left edge vertical.
/// </summary>
/// <param name="hostNormal">Corbel Host face Normal</param>
/// <param name="corbelBottomFace">Bottom Face of Corbel</param>
/// <param name="bottomEdge">Given bottom edge to test</param>
/// <param name="trapezoidFace">Output the trapezoid Face</param>
/// <param name="topEdge">Output trapezoid top edge</param>
/// <param name="leftEdge">Output trapezoid left edge</param>
/// <param name="rightEdge">Output trapezoid right edge</param>
/// <returns>True if there is a trapezoid face share the given bottom edge, otherwise false.</returns>
private static bool IsTrapezoid(
XYZ hostNormal, PlanarFace corbelBottomFace, Edge bottomEdge,
out PlanarFace trapezoidFace, out Edge topEdge,
out Edge leftEdge, out Edge rightEdge)
{
PlanarFace face1 = bottomEdge.get_Face(0) as PlanarFace;
PlanarFace face2 = bottomEdge.get_Face(1) as PlanarFace;
trapezoidFace = face1 == corbelBottomFace ? face2 : face1;
EdgeArray trapezoidFaceEdges = trapezoidFace.EdgeLoops.get_Item(0);
XYZ bottomEdgeDir = (bottomEdge.Evaluate(1.0) - bottomEdge.Evaluate(0.0)).Normalize();
int bottomEdgeIndex = -1;
topEdge = null;
for (int i = 0; i < trapezoidFaceEdges.Size; i++)
{
Edge edge = trapezoidFaceEdges.get_Item(i);
XYZ edgeDir = (edge.Evaluate(1.0) - edge.Evaluate(0.0)).Normalize();
if (edgeDir.IsAlmostEqualTo(bottomEdgeDir) ||
edgeDir.IsAlmostEqualTo(-bottomEdgeDir))
{
if (edge.Evaluate(0.0).IsAlmostEqualTo(bottomEdge.Evaluate(0.0)))
{
bottomEdge = edge;
bottomEdgeIndex = i;
}
else
{
topEdge = edge;
}
}
}
leftEdge = trapezoidFaceEdges.get_Item((trapezoidFaceEdges.Size + bottomEdgeIndex - 1) % trapezoidFaceEdges.Size);
rightEdge = trapezoidFaceEdges.get_Item((bottomEdgeIndex + 1) % trapezoidFaceEdges.Size);
XYZ leftEdgeDir = (leftEdge.Evaluate(1.0) - leftEdge.Evaluate(0.0)).Normalize();
bool isLeftEdgeVertical = false;
if (leftEdgeDir.IsAlmostEqualTo(hostNormal) ||
leftEdgeDir.IsAlmostEqualTo(-hostNormal))
{
isLeftEdgeVertical = true;
}
XYZ rightEdgeDir = (rightEdge.Evaluate(1.0) - rightEdge.Evaluate(0.0)).Normalize();
bool rightEdgeIsVertical = false;
if (rightEdgeDir.IsAlmostEqualTo(hostNormal) ||
rightEdgeDir.IsAlmostEqualTo(-hostNormal))
{
rightEdgeIsVertical = true;
}
return isLeftEdgeVertical && !rightEdgeIsVertical;
}