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

C# IPoint类代码示例

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

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



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

示例1: Create

        public void Create()
        {
            var points = new IPoint[,]
                             {
                                 {new Point(0.0, 1.0), new Point(0.0, 0.0)}, 
                                 {new Point(0.5, 1.5), new Point(1.0, 0.0)}, 
                                 {new Point(1.0, 2.0), new Point(2.0, 2.0)}
                             };


            var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());

            var values = new[,]
                             {
                                 {1.0, 2.0},
                                 {3.0, 4.0},
                                 {5.0, 6.0}
                             };

            coverage.SetValues(values);

/*
            var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true };
            var map = new Map { Layers = { coverageLayer } };
            MapTestHelper.Show(map);
*/

            var value = coverage.Evaluate(points[1, 1].Coordinate);

            const double expectedValue = 4.0;
            Assert.AreEqual(expectedValue, value);
            
            Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
            Assert.AreEqual("new grid point coverage", coverage.Name);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:35,代码来源:DiscreteGridPointCoverageTest.cs


示例2: CalcDistanceBetweenTwoPointsIn2D

    public static double CalcDistanceBetweenTwoPointsIn2D(IPoint firstPoint, IPoint secondPoint)
    {
        double distance = Math.Sqrt((secondPoint.X - firstPoint.X) * (secondPoint.X - firstPoint.X) + 
                                    (secondPoint.Y - firstPoint.Y) * (secondPoint.Y - firstPoint.Y));

        return distance;
    }
开发者ID:IskraNikolova,项目名称:High-Quality-Code,代码行数:7,代码来源:CoordinateSystem.cs


示例3: SqlGeometryToGeometryMultiPoint

 private static IGeometry SqlGeometryToGeometryMultiPoint(SqlGeometry geometry, GeometryFactory factory)
 {
     IPoint[] points = new IPoint[geometry.STNumGeometries().Value];
     for (int i = 1; i <= points.Length; i++)
         points[i - 1] = SqlGeometryToGeometryPoint(geometry.STGeometryN(i), factory);
     return factory.CreateMultiPoint(points);
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:7,代码来源:ConvertToGeometry.cs


示例4: GetPositionImprovement

		public static float GetPositionImprovement(IPoint source, IPoint target, int turns)
		{
			float dSource = (float)Goal.Other.GetDistance(source);
			float dTarget = (float)Goal.Other.GetDistance(target);
			var gain = dSource- dTarget;
			return gain / (float)turns;
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:7,代码来源:Evaluator.cs


示例5: addSplitPt

 public void addSplitPt(IPoint startPt, IPoint endPt)
 {
     LineEndPt lineEnd = new LineEndPt();
     lineEnd.startPt = startPt;
     lineEnd.endPt = endPt;
     splitLineEndPtArray.Add(lineEnd);
 }
开发者ID:Leooonard,项目名称:CGXM,代码行数:7,代码来源:Area.cs


示例6: HouseManager

        public HouseManager(IPoint llPt, House h, CommonHouse ch)
        {
            //四个角的点是外面圈的四个顶点, 因为在进行计算时, 一直以外圈为准.
            lowerLeftPt = new PointClass();
            lowerLeftPt.X = llPt.X;
            lowerLeftPt.Y = llPt.Y;
            house = h;
            commonHouse = ch;

            lowerRightPt = new PointClass();
            lowerRightPt.X = lowerLeftPt.X + house.leftGap + house.width + house.rightGap;
            lowerRightPt.Y = lowerLeftPt.Y;

            upperLeftPt = new PointClass();
            upperLeftPt.X = lowerLeftPt.X;
            upperLeftPt.Y = lowerLeftPt.Y + commonHouse.frontGap + commonHouse.height + commonHouse.backGap;

            upperRightPt = new PointClass();
            upperRightPt.X = lowerRightPt.X;
            upperRightPt.Y = upperLeftPt.Y;

            southDirctionPt = new PointClass();
            southDirctionPt.X = (lowerLeftPt.X + lowerRightPt.X) / 2;
            southDirctionPt.Y = lowerLeftPt.Y;

            rotateAngle = 0;
        }
开发者ID:Leooonard,项目名称:CGXM,代码行数:27,代码来源:HouseManager.cs


示例7: Create

        public void Create()
        {
            var points = new IPoint[,]
                             {
                                 {new Point(0, 0), new Point(1, 0)},
                                 {new Point(2, 1), new Point(3, 1.5)},
                                 {new Point(1, 2), new Point(3, 3)}
                             };


            var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());

            var values = new[,]
                             {
                                 {1.0, 2.0},
                                 {3.0, 4.0},
                                 {5.0, 6.0}
                             };

            coverage.SetValues(values);

            var value = coverage.Evaluate(points[1, 1].Coordinate);

            const double expectedValue = 4.0;
            Assert.AreEqual(expectedValue, value);
            
            Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
            Assert.AreEqual("new grid point coverage", coverage.Name);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:29,代码来源:DiscreteGridPointCoverageTest.cs


示例8: IsOnField

		public bool IsOnField(IPoint point) { 
			return
				!IsLeft(point) &&
				!IsRight(point) &&
				!IsAbove(point) &&
				!IsUnder(point);
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:7,代码来源:FieldInfo.cs


示例9: Read

        /// <summary>
        /// Reads a stream and converts the shapefile record to an equilivant geometry object.
        /// </summary>
        /// <param name="file">The stream to read.</param>
        /// <param name="geometryFactory">The geometry factory to use when making the object.</param>
        /// <returns>The Geometry object that represents the shape file record.</returns>
        public override IGeometry Read(BigEndianBinaryReader file, IGeometryFactory geometryFactory)
        {
            int shapeTypeNum = file.ReadInt32();

            type = (ShapeGeometryType) Enum.Parse(typeof(ShapeGeometryType), shapeTypeNum.ToString());
            if (type == ShapeGeometryType.NullShape)
                return geometryFactory.CreateMultiPoint(new IPoint[] { });
            
            if (!(type == ShapeGeometryType.MultiPoint  || type == ShapeGeometryType.MultiPointM ||
                  type == ShapeGeometryType.MultiPointZ || type == ShapeGeometryType.MultiPointZM))	
                throw new ShapefileException("Attempting to load a non-multipoint as multipoint.");

            // Read and for now ignore bounds.
            int bblength = GetBoundingBoxLength();
            bbox = new double[bblength];
            for (; bbindex < 4; bbindex++)
            {
                double d = file.ReadDouble();
                bbox[bbindex] = d;
            }

            // Read points
            int numPoints = file.ReadInt32();
            IPoint[] points = new IPoint[numPoints];
            for (int i = 0; i < numPoints; i++)
            {
                double x = file.ReadDouble();
                double y = file.ReadDouble();
                IPoint point = geometryFactory.CreatePoint(new Coordinate(x, y));                
                points[i] = point;
            }
            geom = geometryFactory.CreateMultiPoint(points);
            GrabZMValues(file);
            return geom;
        }        
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:41,代码来源:MultiPointHandler.cs


示例10: Contains

        public bool Contains(IPoint point)
        {
            var crossProduct = (point.YCoordinate - StartingPoint.YCoordinate)*
                               (EndingPoint.XCoordinate - StartingPoint.XCoordinate) -
                               (point.XCoordinate - StartingPoint.XCoordinate)*
                               (EndingPoint.YCoordinate - StartingPoint.YCoordinate);

            if (Math.Abs(crossProduct) > Double.Epsilon)
                return false;

            var dotProduct = (point.XCoordinate - StartingPoint.XCoordinate)*
                             (EndingPoint.XCoordinate - StartingPoint.XCoordinate) +
                             (point.YCoordinate - StartingPoint.YCoordinate)*
                             (EndingPoint.YCoordinate - StartingPoint.YCoordinate);
            if (dotProduct < 0)
                return false;

            var squaredLength = (EndingPoint.XCoordinate - StartingPoint.XCoordinate)*
                                  (EndingPoint.XCoordinate - StartingPoint.XCoordinate) +
                                  (EndingPoint.YCoordinate - StartingPoint.YCoordinate)*
                                  (EndingPoint.YCoordinate - StartingPoint.YCoordinate);
            if (dotProduct > squaredLength)
                return false;

            return true;
        }
开发者ID:JasonvanBrackel,项目名称:Rectangles,代码行数:26,代码来源:Line.cs


示例11: CreatePartial

 public static IPartialEvaluator CreatePartial(IPoint point)
 {
     // It's important for efficiency that the same objects are reused whenever possible. Thus no compact memory
     // implementation of IPartialEvaluator (like InnerCompactEvaluator; but in that case only primitive types
     // are returned, i.e. doubles).
     return new InnerPartialEvaluator(point);
 }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:7,代码来源:Evaluator.cs


示例12: Rotate

 public static IPoint Rotate( this IPoint point, double degrees, IPoint pivot )
 {
     var translate = new Point( pivot.X * -1, pivot.Y * -1 );
       var translatedPoint = point.Translate( translate );
       var rotatedPoint = translatedPoint.Rotate( degrees );
       return rotatedPoint.Translate( pivot );
 }
开发者ID:nrkn,项目名称:NrknLib,代码行数:7,代码来源:PointExtensions.cs


示例13: DragOperation

 public DragOperation(ICanvasItem child, IPoint startingPoint, ISnappingEngine snappingEngine)
 {
     SnappingEngine = snappingEngine;
     Child = child;                                   
     StartingPoint = startingPoint;            
     ChildStartingPoint = child.GetPosition();
 }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:7,代码来源:DragOperation.cs


示例14: IpoptOptimizerResult

 public IpoptOptimizerResult(bool status, bool hasConverged, IPoint optimalPoint, double optimalValue, IpoptReturnCode returnCode, int iterations)
     : base(status, optimalPoint, optimalValue)
 {
     HasConverged = hasConverged;
     ReturnCode = returnCode;
     Iterations = iterations;
 }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:7,代码来源:IpoptOptimizerResult.cs


示例15: UpdateHandlePosition

        public void UpdateHandlePosition(IPoint newPoint)
        {
            var rect = Child.Rect();

            if (InsideLimitsX(newPoint.X) && CanChangeHorizontalPosition)
            {
                var left = Math.Min(newPoint.X, Opposite.X);
                var right = Math.Max(newPoint.X, Opposite.X);
                rect.X = left;
                rect.SetRightKeepingLeft(right);
            }

            if (InsideLimitsY(newPoint.Y) && CanChangeVerticalPosition)
            {
                var top = Math.Min(newPoint.Y, Opposite.Y);
                var bottom = Math.Max(newPoint.Y, Opposite.Y);
                rect.Y = top;
                rect.SetBottomKeepingTop(bottom);
            }

            if (rect.Width > 0 && rect.Height > 0)
            {
                SnappingEngine.SetSourceRectForResize(rect);                               
            }
            
        }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:26,代码来源:ResizeOperation.cs


示例16: Run

        public void Run(ModuleInfo info, CancellationToken token = default(CancellationToken))
        {
            double a = 0;
            double b = Math.PI/2;
            double h = 0.00000001;
            const int pointsNum = 2;
            var points = new IPoint[pointsNum];
            var channels = new IChannel[pointsNum];
            for (int i = 0; i < pointsNum; ++i)
            {
                points[i] = info.CreatePoint();
                channels[i] = points[i].CreateChannel();
                points[i].ExecuteClass("FirstModule.IntegralModule");
            }

            double y = a;
            for (int i = 0; i < pointsNum; ++i)
            {
                channels[i].WriteData(y);
                channels[i].WriteData(y + (b - a) / pointsNum);
                channels[i].WriteData(h);
                y += (b - a) / pointsNum;
            }
            DateTime time = DateTime.Now;            
            Console.WriteLine("Waiting for result...");

            double res = 0;
            for (int i = pointsNum - 1; i >= 0; --i)
            {
                res += channels[i].ReadData(typeof(double));
            }

            Console.WriteLine("Result found: res = {0}, time = {1}", res, Math.Round((DateTime.Now - time).TotalSeconds,3));
            
        }
开发者ID:AndriyKhavro,项目名称:Parcs.NET,代码行数:35,代码来源:MainIntegralModule.cs


示例17: CanMove

 /// <summary>
 /// Checks if the unit can move during this round to a certain destination.
 /// The destination must be next to the current position,
 /// the unit must have some movement points left,
 /// the tile can't be a sea.
 /// </summary>
 /// <param name="currentPosition">The current position.</param>
 /// <param name="currentTile">The current type of tile.</param>
 /// <param name="destination">The destination to reach.</param>
 /// <param name="tile">The type of tile the destination is.</param>
 /// <returns>True if the unit can move to the destination.</returns>
 public override bool CanMove(IPoint currentPosition, ITile currentTile, IPoint destination, ITile tile, bool occupied)
 {
     return !(tile is ISea)
         && destination.IsNext(currentPosition)
         && (remainingMovementPoints >= MOVEMENT_COST
             // Special case for movement to lowland.
             || ((tile is ILowland) && remainingMovementPoints >= MOVEMENT_COST / 2));
 }
开发者ID:pchaigno,项目名称:smallworld,代码行数:19,代码来源:Gaulois.cs


示例18: Equals2

        /// <summary>
        /// Indicates if the two points are the same.
        /// </summary>
        /// <param name="shape">The current geometry.</param>
        /// <param name="comparisonShape">The geometry to compare with.</param>
        /// <returns>True or false.</returns>
        public static bool Equals2(this IPoint shape, IPoint comparisonShape)
        {
            var tolerance = 0.001;

            return Math.Abs(shape.X - comparisonShape.X) < tolerance
                && Math.Abs(shape.Y - comparisonShape.Y) < tolerance
                && ((IRelationalOperator)shape).Equals(comparisonShape);
        }
开发者ID:niclange,项目名称:Earthworm,代码行数:14,代码来源:RelationalOpExt.cs


示例19: GetCircleGeometry

        //点+半径转圆几何
        public static IGeometry GetCircleGeometry(IPoint pPoint, double radius)
        {
            ICircularArc pCircularArc = new CircularArcClass();
            IConstructCircularArc pConstructCircularArc = pCircularArc as IConstructCircularArc;
            pConstructCircularArc.ConstructCircle(pPoint, radius, true);
            return GetCircleGeometry(pCircularArc);

        }
开发者ID:weepingdog,项目名称:VerticesToCenter,代码行数:9,代码来源:FunctionCommonGeometry.cs


示例20: WriteGeom

        private void WriteGeom(JsonWriter writer, JsonSerializer serializer, IPoint pt)
        {
            if (pt == null)
                throw new ArgumentNullException("pt");

            writer.WritePropertyName("coordinates");
            WriteJsonCoordinate(writer, pt.Coordinate, serializer);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:8,代码来源:TopoFeatureConverter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IPoint2D类代码示例发布时间:2022-05-24
下一篇:
C# IPluginVisitor类代码示例发布时间: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