forked from ricardojmendez/UnitySteer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPathway.cs
61 lines (53 loc) · 2.36 KB
/
IPathway.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using UnityEngine;
namespace UnitySteer
{
public struct PathRelativePosition
{
public float Outside;
public Vector3 Tangent;
public int SegmentIndex;
}
public interface IPathway
{
float TotalPathLength { get; }
Vector3 FirstPoint { get; }
Vector3 LastPoint { get; }
int SegmentCount { get; }
float Radius { get; set; }
/// <summary>
/// Given an arbitrary point ("A"), returns the nearest point ("P") on
/// this path. Also returns, via output arguments, the path Tangent at
/// P and a measure of how far A is Outside the Pathway's "tube". Note
/// that a negative distance indicates A is inside the Pathway.
/// </summary>
/// <param name="point">Reference point.</param>
/// <param name="pathRelative">Structure indicating the relative path position.</param>
/// <returns>The closest point to the received reference point.</returns>
Vector3 MapPointToPath(Vector3 point, ref PathRelativePosition pathRelative);
/// <summary>
/// Given a distance along the path, convert it to a specific point on the path.
/// </summary>
/// <param name="pathDistance">Path distance to calculate corresponding point for.</param>
/// <returns>The corresponding path point to the path distance.</returns>
Vector3 MapPathDistanceToPoint(float pathDistance);
/// <summary>
/// Maps the reference point to a distance along the path.
/// </summary>
/// <param name="point">Reference point.</param>
/// <returns>The distance along the path for the point.</returns>
float MapPointToPathDistance(Vector3 point);
/// <summary>
/// Determines whether the received point is inside the path.
/// </summary>
/// <param name="point">Point to evaluate.</param>
/// <returns><c>true</c> if the point is inside the path; otherwise, <c>false</c>.</returns>
bool IsInsidePath(Vector3 point);
/// <summary>
/// Calculates how far Outside the path is the reference point.
/// </summary>
/// <param name="point">Reference point.</param>
/// <returns>How far Outside the path is the reference point.</returns>
float HowFarOutsidePath(Vector3 point);
void DrawGizmos();
}
}