/
ScnVectorObjects.cs
46 lines (35 loc) · 1.19 KB
/
ScnVectorObjects.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
namespace Trax {
/// <summary>
/// Generic scenery vector object
/// </summary>
public class ScnVectorObject<T> {
public V3D[] Points = null;
public Line[] Lines = null;
public ScnBezier[] Curves = null;
public ScnVectorObject() { }
public string ScnType;
public string SourcePath;
public int SourceIndex;
public int SourceLength;
public double DistanceTo(V3D p) {
throw new NotImplementedException();
}
}
/// <summary>
/// Generic scenery vector object list with search by coordinates capability
/// </summary>
public class ScnVectorObjects<T> : List<T> where T : ScnVectorObject<T> {
/// <summary>
/// Returns scenery vector objects in proximity of given point
/// </summary>
/// <param name="x0"></param>
/// <param name="distance"></param>
/// <returns></returns>
public ScnVectorObjects<T> FindInProximity(V3D p, double distance = 10) {
return (ScnVectorObjects<T>)this.Where(v => v.DistanceTo(p) < distance).ToList();
}
}
}