Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 470f290

Browse files
committed
Merge pull request #2282 from dotnet-bot/from-tfs
Merge changes from TFS
2 parents 89dd4fa + 71143cb commit 470f290

File tree

4 files changed

+562
-0
lines changed

4 files changed

+562
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
5+
<PropertyGroup>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>System.Numerics</RootNamespace>
11+
<AssemblyName>System.Numerics.Vectors.WindowsRuntime</AssemblyName>
12+
<AssemblyVersion>4.0.0.0</AssemblyVersion>
13+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
14+
</PropertyGroup>
15+
16+
<!-- Default configurations to help VS understand the configurations -->
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
19+
20+
<ItemGroup>
21+
<Compile Include="System\Numerics\VectorExtensions.cs" />
22+
</ItemGroup>
23+
24+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
25+
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using Windows.Foundation;
5+
6+
namespace System.Numerics
7+
{
8+
/// <summary>
9+
/// Contains conversions from Vector2 to Windows.Foundation.Point and Size, which are all structurally identical.
10+
/// </summary>
11+
public static class VectorExtensions
12+
{
13+
/// <summary>
14+
/// Returns a Point whose coordinates are the same as the vector's.
15+
/// </summary>
16+
/// <param name="vector">The Vector2 to convert.</param>
17+
/// <returns>The Point.</returns>
18+
public static Point ToPoint(this Vector2 vector)
19+
{
20+
return new Point(vector.X, vector.Y);
21+
}
22+
23+
/// <summary>
24+
/// Returns a Size whose width and height are equal to the vector's X and Y coordinates.
25+
/// </summary>
26+
/// <param name="vector">The Vector2 to convert.</param>
27+
/// <returns>The Size.</returns>
28+
public static Size ToSize(this Vector2 vector)
29+
{
30+
return new Size(vector.X, vector.Y);
31+
}
32+
33+
/// <summary>
34+
/// Returns a Vector2 whose coordinates are the same as the Point's.
35+
/// </summary>
36+
/// <param name="point">The Point to convert.</param>
37+
/// <returns>The Vector2.</returns>
38+
public static Vector2 ToVector2(this Point point)
39+
{
40+
return new Vector2((float)point.X, (float)point.Y);
41+
}
42+
43+
/// <summary>
44+
/// Returns a Vector2 whose coordinates are the height and width of the Size.
45+
/// </summary>
46+
/// <param name="size">The Size to convert.</param>
47+
/// <returns>The Vector2.</returns>
48+
public static Vector2 ToVector2(this Size size)
49+
{
50+
return new Vector2((float)size.Width, (float)size.Height);
51+
}
52+
}
53+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"dependencies": {
3+
"System.Diagnostics.Tools": "4.1.0-beta-*",
4+
"System.Numerics.Vectors": "4.1.0-beta-*",
5+
"System.Runtime.WindowsRuntime": "4.0.0-beta-*",
6+
},
7+
"frameworks": {
8+
"dnxcore50": {}
9+
}
10+
}

0 commit comments

Comments
 (0)