Line | |
---|
1 | using System;
|
---|
2 | using Microsoft.Research.DynamicDataDisplay.Common.Auxiliary;
|
---|
3 | using System.Windows;
|
---|
4 |
|
---|
5 | namespace Microsoft.Research.DynamicDataDisplay.Charts.Isolines
|
---|
6 | {
|
---|
7 | /// <summary>
|
---|
8 | /// Represents quadrangle; its points are arranged by round in one direction.
|
---|
9 | /// </summary>
|
---|
10 | internal sealed class Quad
|
---|
11 | {
|
---|
12 | private readonly Point v00;
|
---|
13 | public Point V00
|
---|
14 | {
|
---|
15 | get { return v00; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | private readonly Point v01;
|
---|
19 | public Point V01
|
---|
20 | {
|
---|
21 | get { return v01; }
|
---|
22 | }
|
---|
23 |
|
---|
24 | private readonly Point v10;
|
---|
25 | public Point V10
|
---|
26 | {
|
---|
27 | get { return v10; }
|
---|
28 | }
|
---|
29 |
|
---|
30 | private readonly Point v11;
|
---|
31 | public Point V11
|
---|
32 | {
|
---|
33 | get { return v11; }
|
---|
34 | }
|
---|
35 |
|
---|
36 | public Quad(Point v00, Point v01, Point v11, Point v10)
|
---|
37 | {
|
---|
38 | DebugVerify.IsNotNaN(v00);
|
---|
39 | DebugVerify.IsNotNaN(v01);
|
---|
40 | DebugVerify.IsNotNaN(v11);
|
---|
41 | DebugVerify.IsNotNaN(v10);
|
---|
42 |
|
---|
43 | this.v00 = v00;
|
---|
44 | this.v01 = v01;
|
---|
45 | this.v10 = v10;
|
---|
46 | this.v11 = v11;
|
---|
47 | }
|
---|
48 |
|
---|
49 | /// <summary>
|
---|
50 | /// Determines whether this quad contains the specified point.
|
---|
51 | /// </summary>
|
---|
52 | /// <param name="v">The point</param>
|
---|
53 | /// <returns>
|
---|
54 | /// <c>true</c> if quad contains the specified point; otherwise, <c>false</c>.
|
---|
55 | /// </returns>
|
---|
56 | public bool Contains(Point pt)
|
---|
57 | {
|
---|
58 | // breaking quad into 2 triangles,
|
---|
59 | // points contains in quad, if it contains in at least one half-triangle of it.
|
---|
60 | return TriangleMath.TriangleContains(v00, v01, v11, pt) || TriangleMath.TriangleContains(v00, v10, v11, pt);
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.