Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/Auxiliary/VectorExtensions.cs @ 13749

Last change on this file since 13749 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 745 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Media.Media3D;
7
8namespace Microsoft.Research.DynamicDataDisplay.Common.Auxiliary
9{
10  internal static class VectorExtensions
11  {
12    public static Point ToPoint(this Vector vector)
13    {
14      return new Point(vector.X, vector.Y);
15    }
16
17    public static Vector DecreaseLength(this Vector vector, double width, double heigth)
18    {
19      vector.X /= width;
20      vector.Y /= heigth;
21
22      return vector;
23    }
24
25    public static Vector Perpendicular(this Vector v)
26    {
27      var result = Vector3D.CrossProduct(new Vector3D(v.X, v.Y, 0), new Vector3D(0, 0, 1));
28      return new Vector(result.X, result.Y);
29    }
30  }
31}
Note: See TracBrowser for help on using the repository browser.