public static IEnumerable <Term> Compute(CircleFeatureCurve item)
        {
            const int SAMPLE_SIZE = 20;
            var       sample      = CurveSampler.UniformSample(item.SnappedTo, SAMPLE_SIZE);

            return(Compute(item, sample));
        }
Beispiel #2
0
        protected IEnumerable <Term> ProjectionFit(CircleFeatureCurve item)
        {
            const int SAMPLE_SIZE = 10;
            var       sample      = CurveSampler.UniformSample(item.SnappedTo, SAMPLE_SIZE);

            return(ProjectionFit(item, sample));
        }
Beispiel #3
0
        /// <summary>
        /// Checks weather a points sequence is the top-part of a cylinder, by comparing the center of the ellipse that best fits the points
        /// sequence to the actual top center and bottom centers.
        /// </summary>
        /// <param name="points">The points sequence</param>
        /// <param name="cylinder">The cylinder data</param>
        /// <returns><c>true</c> if the best-fit-ellipse's center is closer to the top cylinder point than to the bottom.</returns>
        public static bool IsTop(PointsSequence points, SnappedCylindricalPrimitive cylinder)
        {
            var top    = new Point(cylinder.TopCenterResult.X, -cylinder.TopCenterResult.Y);
            var bottom = new Point(cylinder.BottomCenterResult.X, -cylinder.BottomCenterResult.Y);

            var samples = CurveSampler.UniformSample(points, 50);
            var ellipse = EllipseFitter.Fit(samples);

            // the points sequence is "top" if it is closer to the top center then it is to the bottom center.
            if ((top - ellipse.Center).Length < (bottom - ellipse.Center).Length)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }