Esempio n. 1
0
        public PolygonSegment JoinAdjoiningSegment(PolygonSegment segment)
        {
            if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Front
                )
            {
                this.BackPoint = segment.BackPoint;
            }
            else if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Back &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Nothing
                )
            {
                this.FrontPoint = segment.FrontPoint;
            }
            else
            {
                return(null);
            }

            return(this);
        }
Esempio n. 2
0
 public NeighborsSegment(
     PolygonSegment polygonSegment,
     TypeNeighbor typeNeighbor
     ) :
     base(polygonSegment.FrontPoint, polygonSegment.MediumPoint, polygonSegment.BackPoint)
 {
     this.TypeNeighbor = typeNeighbor;
 }
Esempio n. 3
0
        public ResultComparePolygonSegments CompareSegments(PolygonSegment polygonSegment)
        {
            if (polygonSegment == null)
            {
                return(new ResultComparePolygonSegments());
            }

            ResultComparePolygonSegments result = new ResultComparePolygonSegments();

            if (this.FrontPoint.GetDistanceTo(polygonSegment.FrontPoint) == 0)
            {
                result.FrontPoint = CoincidencePoints.Coincides_With_Front;
            }
            else if (this.FrontPoint.GetDistanceTo(polygonSegment.MediumPoint) == 0)
            {
                result.FrontPoint = CoincidencePoints.Coincides_With_Medium;
            }
            else if (this.FrontPoint.GetDistanceTo(polygonSegment.BackPoint) == 0)
            {
                result.FrontPoint = CoincidencePoints.Coincides_With_Back;
            }

            if (this.MediumPoint.GetDistanceTo(polygonSegment.FrontPoint) == 0)
            {
                result.MediumPoint = CoincidencePoints.Coincides_With_Front;
            }
            else if (this.MediumPoint.GetDistanceTo(polygonSegment.MediumPoint) == 0)
            {
                result.MediumPoint = CoincidencePoints.Coincides_With_Medium;
            }
            else if (this.MediumPoint.GetDistanceTo(polygonSegment.BackPoint) == 0)
            {
                result.MediumPoint = CoincidencePoints.Coincides_With_Back;
            }

            if (this.BackPoint.GetDistanceTo(polygonSegment.FrontPoint) == 0)
            {
                result.BackPoint = CoincidencePoints.Coincides_With_Front;
            }
            else if (this.BackPoint.GetDistanceTo(polygonSegment.MediumPoint) == 0)
            {
                result.BackPoint = CoincidencePoints.Coincides_With_Medium;
            }
            else if (this.BackPoint.GetDistanceTo(polygonSegment.BackPoint) == 0)
            {
                result.BackPoint = CoincidencePoints.Coincides_With_Back;
            }

            return(result);
        }
Esempio n. 4
0
        internal TypeNeighbor GetTypeNeighbor_OnlyOnePoint(PolygonSegment neighborSegmet)
        {
            double angle_base = ServiceGeodesy
                                .GetRightAngle(this.FrontPoint, this.MediumPoint, this.BackPoint);             // *180/Math.PI;
            double angle_front = ServiceGeodesy
                                 .GetRightAngle(this.FrontPoint, this.MediumPoint, neighborSegmet.FrontPoint); // * 180 / Math.PI;
            double angle_back = ServiceGeodesy
                                .GetRightAngle(this.FrontPoint, this.MediumPoint, neighborSegmet.BackPoint);   // * 180 / Math.PI;

            if (angle_base < angle_front && angle_base < angle_back)
            {
                return(TypeNeighbor.OnlyOnePoint_Inside);
            }
            else
            {
                return(TypeNeighbor.OnlyOnePoint_Outside);
            }
        }
Esempio n. 5
0
        public bool IsAdjoiningSegment(PolygonSegment segment)
        {
            if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Nothing &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Front
                )
            {
                return(true);
            }
            else if (
                this.CompareSegments(segment).FrontPoint == CoincidencePoints.Coincides_With_Back &&
                this.CompareSegments(segment).MediumPoint == CoincidencePoints.Coincides_With_Medium &&
                this.CompareSegments(segment).BackPoint == CoincidencePoints.Coincides_With_Nothing
                )
            {
                return(true);
            }

            return(false);
        }