// You can't specify a boundary, intrastroke,
    // by using the Tablet SDK's NearestPoint method.
    public int FindClosestPointTo(Point p, int start, int finish)
    {
        FcptImpl fi = new FcptImpl(stroke,p);
        GoldenSectionDescender.F f = new GoldenSectionDescender.F(fi.F);
        GoldenSectionDescender gsd = new GoldenSectionDescender(f);

        return MathEx.Round(gsd.FindMinimumWithin(start,finish,1));
    }
예제 #2
0
    // You can't specify a boundary, intrastroke,
    // by using the Tablet SDK's NearestPoint method.
    public int FindClosestPointTo(Point p, int start, int finish)
    {
        FcptImpl fi = new FcptImpl(stroke, p);

        GoldenSectionDescender.F f   = new GoldenSectionDescender.F(fi.F);
        GoldenSectionDescender   gsd = new GoldenSectionDescender(f);

        return(MathEx.Round(gsd.FindMinimumWithin(start, finish, 1)));
    }
예제 #3
0
    private void QuantizeSegmentOrientations()
    {
        // Find the optimal rotation angle, to minimize segments' orientation from 0/30/45/60.
        Point   center = Geometry.EstimatePolygonCentroid(idealverts);
        QsoImpl fi     = new QsoImpl(idealverts, center);

        GoldenSectionDescender.F f   = new GoldenSectionDescender.F(fi.F);
        GoldenSectionDescender   gsd = new GoldenSectionDescender(f);

        double tolerance = 0.01;
        double optangle  = gsd.FindMinimumWithin(-12.0, +12.0, tolerance);

        // Now rotate them!
        using (Matrix m = new Matrix())
        {
            m.RotateAt((float)optangle, new PointF(center.X, center.Y));
            m.TransformPoints(idealverts);
        }
    }
    private void QuantizeSegmentOrientations()
    {
        // Find the optimal rotation angle, to minimize segments' orientation from 0/30/45/60.
        Point center = Geometry.EstimatePolygonCentroid(idealverts);
        QsoImpl fi = new QsoImpl(idealverts,center);
        GoldenSectionDescender.F f = new GoldenSectionDescender.F(fi.F);
        GoldenSectionDescender gsd = new GoldenSectionDescender(f);

        double tolerance = 0.01;
        double optangle = gsd.FindMinimumWithin(-12.0,+12.0,tolerance);

        // Now rotate them!
        using (Matrix m = new Matrix())
        {
            m.RotateAt((float)optangle, new PointF(center.X,center.Y));
            m.TransformPoints(idealverts);
        }
    }