コード例 #1
0
        /////////////INSIDE_BELONGS_METHODS////////////
        ///////////////////////////////////////////////
        ///////////////ADDITIONAL_METHODS//////////////

        public float getDistance(GlPointR2 P)
        {
            if (P == null || this.pointOfLine.isNullPoint() || P.isNullPoint())
            {
                return(float.NaN);
            }

            if (GlPointR2.Equals(P, this.pointOfLine))
            {
                return(0);
            }

            if (this.DirectVector.isNullVector())
            {
                return(P.getDistance(this.PointOfLine));
            }

            GlVectorR2 directVector = new GlVectorR2(this.DirectVector.deltaX, this.DirectVector.deltaY);

            return((new GlVectorR2(P.X - this.pointOfLine.X, P.Y - this.pointOfLine.Y) ^ directVector) / (float)directVector.Length);
        }