Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows;
|
---|
6 | using System.Windows.Media.Media3D;
|
---|
7 |
|
---|
8 | namespace 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.