当前位置: 首页>>代码示例>>C#>>正文


C# Matrix.Transform方法代码示例

本文整理汇总了C#中Matrix.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.Transform方法的具体用法?C# Matrix.Transform怎么用?C# Matrix.Transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix的用法示例。


在下文中一共展示了Matrix.Transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Transform

		public override Shape Transform(Matrix transform) {
			float[] pts = new float[8];
			float[] dest = new float[8];
			pts[0] = p1.x;
			pts[1] = p1.y;
			pts[2] = c1.x;
			pts[3] = c1.y;
			pts[4] = c2.x;
			pts[5] = c2.y;
			pts[6] = p2.x;
			pts[7] = p2.y;
			transform.Transform(pts, 0, dest, 0, 4);
	
			return new Curve(new Vector2f(dest[0], dest[1]), new Vector2f(dest[2],
					dest[3]), new Vector2f(dest[4], dest[5]), new Vector2f(dest[6],
					dest[7]));
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:17,代码来源:Curve.cs

示例2: DepthTest

        public void DepthTest()
        {
            var matrix = new Matrix<int>(7, 6);

            var writer = new StringWriter();

            var newMatrix = matrix.Transform((r, c) =>
            {
                return new PositionOnMatrix(r, c, matrix.RowCount, matrix.ColumnCount).Depth();
            });

            newMatrix.Write(writer);

            Assert.AreEqual(
@"0 0 0 0 0 0
0 1 1 1 1 0
0 1 2 2 1 0
0 1 2 2 1 0
0 1 2 2 1 0
0 1 1 1 1 0
0 0 0 0 0 0", writer.ToString().Trim());
        }
开发者ID:icalvo,项目名称:HackerrankProblems,代码行数:22,代码来源:MatrixTests.cs

示例3: CycleLengthTest

        public void CycleLengthTest()
        {
            var matrix = new Matrix<int>(7, 6);

            var writer = new StringWriter();

            var newMatrix = matrix.Transform((r, c) => new PositionOnMatrix(r, c, matrix.RowCount, matrix.ColumnCount).CycleLength());

            newMatrix.Write(writer);

            Assert.AreEqual(
@"22 22 22 22 22 22
22 14 14 14 14 22
22 14 6 6 14 22
22 14 6 6 14 22
22 14 6 6 14 22
22 14 14 14 14 22
22 22 22 22 22 22", writer.ToString().Trim());
        }
开发者ID:icalvo,项目名称:HackerrankProblems,代码行数:19,代码来源:MatrixTests.cs

示例4: GetImageTiles

		private List<GeoBitmap> GetImageTiles(Matrix matrix)
		{
			List<GeoBitmap> v_ret = new List<GeoBitmap>();

			BoundingBox viewBounds = GetViewBounds(matrix);
			double[] hgLog = LogicalToGeoLatLon(viewBounds.XMin, viewBounds.YMax);
			double[] bdLog = LogicalToGeoLatLon(viewBounds.XMax, viewBounds.YMin);
			BoundingBox viewPortBbox = new BoundingBox(hgLog[0], bdLog[0]
																								, bdLog[1], hgLog[1]);

			BoundingBox bbox = matrix.Transform(_geomBBox);

			// Get current zoom level
			double mapSizeAtCurrentZoom = 1d * bbox.Width / _geomBBox.Width;

			int zoom = 0;
			uint size = 0;
			while (size <= mapSizeAtCurrentZoom)
			{
				zoom++;
				if (zoom == 24) break;
				size = BingMapsTileSystem.MapSize(zoom);
			}

			// At viewport zoom, what tile size is it ?
			double tileSizeAtZoom = 256 * mapSizeAtCurrentZoom / size;
			Trace.TraceInformation("tileSizeAtZoom: " + tileSizeAtZoom.ToString());
			if (tileSizeAtZoom < 256 && !_baseLayer.UseLowResTiles) Trace.TraceWarning("Error in zoom calculation, tile size should be <256 but it is " + tileSizeAtZoom);
			bool bTakeLowerDef = tileSizeAtZoom < 400;// _baseLayer.UseLowResTiles;
			if (bTakeLowerDef)
			{
				zoom--;
				size = BingMapsTileSystem.MapSize(zoom);
			}



			// Contruct image list
			int startX, startY, endX, endY = 0;
			int tileStartX, tileStartY, tileEndX, tileEndY = 0;
			BingMapsTileSystem.LatLongToPixelXY(viewPortBbox.YMax, viewPortBbox.XMin, zoom, out startX, out startY);
			BingMapsTileSystem.LatLongToPixelXY(viewPortBbox.YMin, viewPortBbox.XMax, zoom, out endX, out endY);
			BingMapsTileSystem.PixelXYToTileXY(startX, startY, out tileStartX, out tileStartY);
			BingMapsTileSystem.PixelXYToTileXY(endX, endY, out tileEndX, out tileEndY);

			bool stop = false;
			for (int x = tileStartX; x <= tileEndX; x++)
			{
				for (int y = tileStartY; y <= tileEndY; y++)
				{
					if (stop) break;
					//GeoBitmap geoBmp = await _tileDownloader.DownloadTileAsync(zoom, x, y, _baseLayer);
					GeoBitmap geoBmp = _tileDownloader.DownloadTile(zoom, x, y, _baseLayer);

					stop = geoBmp != null && geoBmp.Exception != null && _baseLayer.StopDownloadBatchIfException;

					if (!stop)
						v_ret.Add(geoBmp);

				}
				if (stop) break;
			}

			return v_ret;
		}
开发者ID:xfischer,项目名称:SqlServerSpatial.Toolkit,代码行数:65,代码来源:SpatialViewer_GDI.cs


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