• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AForge.IntPoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AForge.IntPoint的典型用法代码示例。如果您正苦于以下问题:C# IntPoint类的具体用法?C# IntPoint怎么用?C# IntPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IntPoint类属于AForge命名空间,在下文中一共展示了IntPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetBoundingRectangle

        /// <summary>
        /// Get bounding rectangle of the specified list of points.
        /// </summary>
        /// 
        /// <param name="cloud">Collection of points to get bounding rectangle for.</param>
        /// <param name="minXY">Point comprised of smallest X and Y coordinates.</param>
        /// <param name="maxXY">Point comprised of biggest X and Y coordinates.</param>
        /// 
        public static void GetBoundingRectangle( IEnumerable<IntPoint> cloud, out IntPoint minXY, out IntPoint maxXY )
        {
            int minX = int.MaxValue;
            int maxX = int.MinValue;
            int minY = int.MaxValue;
            int maxY = int.MinValue;

            foreach ( IntPoint pt in cloud )
            {
                int x = pt.X;
                int y = pt.Y;

                // check X coordinate
                if ( x < minX )
                    minX = x;
                if ( x > maxX )
                    maxX = x;

                // check Y coordinate
                if ( y < minY )
                    minY = y;
                if ( y > maxY )
                    maxY = y;
            }

            if ( minX > maxX ) // if no point appeared to set either minX or maxX
                throw new ArgumentException( "List of points can not be empty." );

            minXY = new IntPoint( minX, minY );
            maxXY = new IntPoint( maxX, maxY );
        }
开发者ID:tetradog,项目名称:Aforge.Drawing,代码行数:39,代码来源:PointsCloud.cs


示例2: RoundTest

        public void RoundTest( double x, double y, int expectedX, int expectedY )
        {
            DoublePoint dPoint = new DoublePoint( x, y );
            IntPoint    iPoint = new IntPoint( expectedX, expectedY );

            Assert.AreEqual( iPoint, dPoint.Round( ) );
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:7,代码来源:DoublePointTest.cs


示例3: AddWarpEffect

        private Bitmap AddWarpEffect(ref Bitmap image)
        {
            // build warp map
            int width = image.Width;
            int height = image.Height;

            IntPoint[,] warpMap = new IntPoint[height, width];

            int size = 8;
            int maxOffset = -size + 1;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    int dx = (x / size) * size - x;
                    int dy = (y / size) * size - y;

                    if (dx + dy <= maxOffset)
                    {
                        dx = (x / size + 1) * size - 1 - x;
                    }

                    warpMap[y, x] = new IntPoint(dx, dy);
                }
            }
            // create filter
            ImageWarp filter = new ImageWarp(warpMap);
            // apply the filter
            Bitmap newImage = filter.Apply(image);
            return newImage;
        }
开发者ID:ajoskows,项目名称:TaskImageConverter,代码行数:32,代码来源:MainWindow.xaml.cs


示例4: Shift

 /// <summary>
 /// Shift cloud by adding specified value to all points in the collection.
 /// </summary>
 /// 
 /// <param name="cloud">Collection of points to shift their coordinates.</param>
 /// <param name="shift">Point to shift by.</param>
 /// 
 public static void Shift( IList<IntPoint> cloud, IntPoint shift )
 {
     for ( int i = 0, n = cloud.Count; i < n; i++ )
     {
         cloud[i] = cloud[i] + shift;
     }
 }
开发者ID:tetradog,项目名称:Aforge.Drawing,代码行数:14,代码来源:PointsCloud.cs


示例5: DistanceTo

        /// <summary>
        /// Calculate Euclidean distance between two points.
        /// </summary>
        /// 
        /// <param name="anotherPoint">Point to calculate distance to.</param>
        /// 
        /// <returns>Returns Euclidean distance between this point and
        /// <paramref name="anotherPoint"/> points.</returns>
        /// 
        public float DistanceTo( IntPoint anotherPoint )
        {
            int dx = X - anotherPoint.X;
            int dy = Y - anotherPoint.Y;

            return (float) System.Math.Sqrt( dx * dx + dy * dy );
        }
开发者ID:CanerPatir,项目名称:framework,代码行数:16,代码来源:IntPoint.cs


示例6: RoundTest

        public void RoundTest( float x, float y, int expectedX, int expectedY )
        {
            Point point = new Point( x, y );
            IntPoint iPoint = new IntPoint( expectedX, expectedY );

            Assert.AreEqual( iPoint, point.Round( ) );
        }
开发者ID:RevDevBev,项目名称:aforge.net,代码行数:7,代码来源:PointTest.cs


示例7: GridInPlace

        public static void GridInPlace(Bitmap img, uint rows, uint cols, Color colour)
        {
            //Lock image for read write so we can alter it
            BitmapData imgData = img.LockBits(new Rectangle(0, 0, img.Width, img.Height),
                ImageLockMode.ReadWrite, img.PixelFormat);

            //Draw lines at regular intervals along the image both vertically & horizontally
            //TODO: Fix bug where sometimes draws a line at the end, other times doesn't (because of double precision)
            double colWidth = img.Width / (double)cols;
            for (double i = colWidth; i < img.Width; i += colWidth)
            {
                IntPoint p1 = new IntPoint((int)i, 0);
                IntPoint p2 = new IntPoint((int)i, img.Height);
                Drawing.Line(imgData, p1, p2, colour);
            }

            double rowHeight = img.Height / (double)rows;
            for (double i = rowHeight; i < img.Height; i += rowHeight)
            {
                IntPoint p1 = new IntPoint(0, (int)i);
                IntPoint p2 = new IntPoint(img.Width, (int)i);
                Drawing.Line(imgData, p1, p2, colour);
            }

            img.UnlockBits(imgData);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:26,代码来源:DrawGrid.cs


示例8: DistanceTo

        /// <summary>
        /// Calculate Euclidean distance between two points.
        /// </summary>
        /// 
        /// <param name="anotherPoint">Point to calculate distance to.</param>
        /// 
        /// <returns>Returns Euclidean distance between this point and
        /// <paramref name="anotherPoint"/> points.</returns>
        /// 
        public double DistanceTo( IntPoint anotherPoint )
        {
            int dx = X - anotherPoint.X;
            int dy = Y - anotherPoint.Y;

            return System.Math.Sqrt( dx * dx + dy * dy );
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:16,代码来源:IntPoint.cs


示例9: InequalityOperatorTest

        public void InequalityOperatorTest( int x1, int y1, int x2, int y2, bool areNotEqual )
        {
            IntPoint point1 = new IntPoint( x1, y1 );
            IntPoint point2 = new IntPoint( x2, y2 );

            Assert.AreEqual( point1 != point2, areNotEqual );
        }
开发者ID:Kenneth-Posey,项目名称:aforge-clone,代码行数:7,代码来源:IntPointTest.cs


示例10: Add

 public void Add(IntPoint point)
 {
     if (Points.Count != 0)
     {
         Length += point.DistanceTo(Points.Last());
     }
     Points.Add(point);
 }
开发者ID:619Code,项目名称:DSVision,代码行数:8,代码来源:DataStructures.cs


示例11: TestEuclideanDistance5

        public void TestEuclideanDistance5()
        {
            //0 distance / points equal
            IntPoint a = new IntPoint(0, 0);
            IntPoint b = new IntPoint(0, 0);

            double distance = Geometry.EuclideanDistance(a, b);
            Assert.AreEqual(0, distance);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:GeometryTests.cs


示例12: TestEuclideanDistance4

        public void TestEuclideanDistance4()
        {
            //Negative coordinates
            IntPoint a = new IntPoint(-1, -1);
            IntPoint b = new IntPoint(-2, -2);

            double distance = Geometry.EuclideanDistance(a, b);
            Assert.AreEqual(Math.Sqrt(2), distance);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:GeometryTests.cs


示例13: TestEuclideanDistance3

        public void TestEuclideanDistance3()
        {
            //Non-unit lengths test
            IntPoint a = new IntPoint(324, 12);
            IntPoint b = new IntPoint(12, 123);

            double distance = Geometry.EuclideanDistance(a, b);
            Assert.AreEqual(3 * Math.Sqrt(12185), distance);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:GeometryTests.cs


示例14: TestEuclideanDistance2

        public void TestEuclideanDistance2()
        {
            //Parameter order doesn't matter
            IntPoint a = new IntPoint(2, 2);
            IntPoint b = new IntPoint(1, 1);

            double distance = Geometry.EuclideanDistance(a, b);
            Assert.AreEqual(Math.Sqrt(2), distance);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:GeometryTests.cs


示例15: AreaQuadrilateral

        public static double AreaQuadrilateral(IntPoint[] points)
        {
            if(!IsQuadrilateral(points))
            {
                throw new InvalidShapeException("Expected Quadrilateral");
            }

            return Area(points[0], points[1], points[2], points[3]);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:Geometry.cs


示例16: TestEuclideanDistance1

        public void TestEuclideanDistance1()
        {
            //Basic test
            IntPoint a = new IntPoint(1, 1);
            IntPoint b = new IntPoint(2, 2);

            double distance = Geometry.EuclideanDistance(a, b);
            Assert.AreEqual(Math.Sqrt(2), distance);
        }
开发者ID:JoshKeegan,项目名称:CVWS.NET,代码行数:9,代码来源:GeometryTests.cs


示例17: GetAngleBetweenVectorsTest

        public void GetAngleBetweenVectorsTest( int sx, int sy, int ex1, int ey1, int ex2, int ey2, float expectedAngle )
        {
            IntPoint startPoint = new IntPoint( sx, sy );
            IntPoint vector1end = new IntPoint( ex1, ey1 );
            IntPoint vector2end = new IntPoint( ex2, ey2 );

            float angle = GeometryTools.GetAngleBetweenVectors( startPoint, vector1end, vector2end );

            Assert.AreApproximatelyEqual<float, float>( expectedAngle,  angle, 0.00001f );
        }
开发者ID:rpwjanzen,项目名称:blinken,代码行数:10,代码来源:GeometryToolsTest.cs


示例18: dessinePoint

 public void dessinePoint(IntPoint point, UnmanagedImage img,int nbPixel,Color col)
 {
     for (int i = point.X - nbPixel / 2; i < point.X + nbPixel / 2 + 1; i++)
     {
         for (int j = point.Y - nbPixel / 2; j < point.Y + nbPixel / 2 + 1; j++)
         {
             img.SetPixel(i, j, col);
         }
     }
 }
开发者ID:KiLMaN,项目名称:LPIE_Robot_Color,代码行数:10,代码来源:ImgWebCam.cs


示例19: GetAngleBetweenLinesTest

        public void GetAngleBetweenLinesTest( int sx1, int sy1, int ex1, int ey1, int sx2, int sy2, int ex2, int ey2, float expectedAngle )
        {
            IntPoint line1start = new IntPoint( sx1, sy1 );
            IntPoint line1end   = new IntPoint( ex1, ey1 );
            IntPoint line2start = new IntPoint( sx2, sy2 );
            IntPoint line2end   = new IntPoint( ex2, ey2 );

            float angle = GeometryTools.GetAngleBetweenLines( line1start, line1end, line2start, line2end );

            Assert.AreApproximatelyEqual<float, float>( expectedAngle, angle, 0.00001f );
        }
开发者ID:rpwjanzen,项目名称:blinken,代码行数:11,代码来源:GeometryToolsTest.cs


示例20: Card

        private Suit suit; //Suit of card

        #endregion Fields

        #region Constructors

        //Constructor
        public Card(Bitmap cardImg, IntPoint[] cornerIntPoints)
        {
            this.image = cardImg;

            //Convert AForge.IntPoint Array to System.Drawing.Point Array
            int total = cornerIntPoints.Length;
            corners = new Point[total];

            for(int i = 0 ; i < total ; i++)
            {
                this.corners[i].X = cornerIntPoints[i].X;
                this.corners[i].Y = cornerIntPoints[i].Y;
            }
        }
开发者ID:wesleyteixeira,项目名称:Cards,代码行数:21,代码来源:Card.cs



注:本文中的AForge.IntPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Imaging.BlobCounter类代码示例发布时间:2022-05-24
下一篇:
C# AForge.DoubleRange类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap