本文整理汇总了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]));
}
示例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());
}
示例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());
}
示例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;
}