示例#1
0
            //public bool IsOtherEndClipped(PlanarEdge linkedEdge)
            //{
            //    var commonVert = GetCommonVertex(linkedEdge);
            //    if (PrevEdgeInfo != null && PrevEdgeInfo.CommonVertex != commonVert)
            //        return PrevEdgeInfo.IsObtuse;
            //    if (NextEdgeInfo != null && NextEdgeInfo.CommonVertex != commonVert)
            //        return NextEdgeInfo.IsObtuse;
            //    return false;
            //}

            public static float CalculateAngleBetween(PlanarEdge edge1, PlanarEdge edge2)
            {
                Vector3 commonVert;

                if (edge2.Contains(edge1.P1))
                {
                    commonVert = edge1.P1;
                }
                else if (edge2.Contains(edge1.P2))
                {
                    commonVert = edge1.P2;
                }
                else
                {
                    return(0);
                }

                var opp1 = edge1.GetOppositeVertex(commonVert);
                var dir1 = (opp1 - commonVert).Normalized();

                var avgNormal = Vector3.Avg(edge1.OutlineDirection, edge2.OutlineDirection).Normalized();

                var edgeAngleDiff = Vector3.AngleBetween(avgNormal, dir1);

                return(edgeAngleDiff * 2f);
            }
示例#2
0
            public bool Colinear(PlanarEdge other)
            {
                if (!(other.Contains(P1) || other.Contains(P2)))
                {
                    return(false);
                }

                float angleDiff = Vector3.AngleBetween(Direction, other.Direction);

                return(float.IsNaN(angleDiff) || angleDiff < 0.08);
            }
示例#3
0
 public Vector3 GetCommonVertex(PlanarEdge otherEdge)
 {
     if (otherEdge.Contains(P1))
     {
         return(P1);
     }
     else if (otherEdge.Contains(P2))
     {
         return(P2);
     }
     return(Vector3.Empty);
 }