Example #1
0
 public Vector2f GetVector()
 {
     if (this.JointB != null)
     {
         return(JointB.OriginalJointPos - JointA.OriginalJointPos);
     }
     else if (this.TipEdge != null)
     {
         return(TipEdge.GetMidPoint() - JointA.OriginalJointPos);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Example #2
0
        public Bone(Joint a, EdgeLine tipEdge)
        {
            JointA  = a;
            TipEdge = tipEdge;
            Vector2f midPoint = tipEdge.GetMidPoint();

            _len = Math.Sqrt(a.CalculateSqrDistance(midPoint));
            EvaluateSlope();
        }
Example #3
0
        void AnalyzeOutsideEdge(EdgeLine d, float centroidX, float centroidY)
        {
            //check if edge slope
            if (!d.IsOutside)
            {
                return;
            }
            //---------------------------
            switch (d.SlopeKind)
            {
            case LineSlopeKind.Horizontal:

                //check if upper or lower
                //compare mid point with the centroid
                d.IsUpper = d.GetMidPoint().Y > centroidY;
                break;

            case LineSlopeKind.Vertical:
                d.IsLeftSide = d.GetMidPoint().X < centroidX;
                break;
            }
        }
Example #4
0
        static void FindPerpendicular(EdgeLine outsideEdge, EdgeLine inside)
        {
            Vector2f m0 = inside.GetMidPoint();

            if (MyMath.FindPerpendicularCutPoint(outsideEdge, new Vector2f(m0.X, m0.Y), out Vector2f cut_fromM0))
            {
                ((OutsideEdgeLine)outsideEdge).SetControlEdge(inside);
            }
            else
            {
            }
            outsideEdge._earlyInsideAnalysis = inside._earlyInsideAnalysis = true;
        }