Empeld
Empeld plugin documentation.
essentials.action.Pathing.Rails.LinearRail Class Reference

A rail that can be followed, where position between two points is interpolated linearly More...

Inheritance diagram for essentials.action.Pathing.Rails.LinearRail:
essentials.action.Pathing.Rails.AbstractRail essentials.action.Pathing.IPathRail

Public Member Functions

 LinearRail (IEnumerable< Vector3d > path)
 
 LinearRail (Path path, Vector3d offset)
 
 LinearRail (Path path)
 
- Public Member Functions inherited from essentials.action.Pathing.Rails.AbstractRail
 AbstractRail (IEnumerable< Vector3d > path)
 
void Advance (double dst)
 

Protected Member Functions

override Vector3d GetPosition (double t)
 

Additional Inherited Members

- Protected Attributes inherited from essentials.action.Pathing.Rails.AbstractRail
readonly Vector3d [] Rail
 
- Properties inherited from essentials.action.Pathing.Rails.AbstractRail
Vector3d Position [get]
 
Vector3d LookDirection [get]
 
double Time [get, set]
 
double TimeLength [get]
 
bool Done [get]
 
- Properties inherited from essentials.action.Pathing.IPathRail
double Time [get, set]
 
double TimeLength [get]
 
Vector3d Position [get]
 
Vector3d LookDirection [get]
 
bool Done [get]
 

Detailed Description

A rail that can be followed, where position between two points is interpolated linearly

Constructor & Destructor Documentation

◆ LinearRail() [1/3]

essentials.action.Pathing.Rails.LinearRail.LinearRail ( IEnumerable< Vector3d >  path)
15  :base(path)
16  { }

◆ LinearRail() [2/3]

essentials.action.Pathing.Rails.LinearRail.LinearRail ( Path  path,
Vector3d  offset 
)
19  :this(path.Select(x => x + offset))
20  { }

◆ LinearRail() [3/3]

essentials.action.Pathing.Rails.LinearRail.LinearRail ( Path  path)
23  :this(path, new Vector3d(0.5, 0.5, 0.5))
24  {}

Member Function Documentation

◆ GetPosition()

override Vector3d essentials.action.Pathing.Rails.LinearRail.GetPosition ( double  t)
protectedvirtual

Attribute: idx] * (1.0 - f) + this.Rail[nextIdx

* f;

Implements essentials.action.Pathing.Rails.AbstractRail.

28  {
29  int idx = (int)t;
30  int nextIdx = Math.Min(idx+1, this.Rail.Length-1);
31  double f = MExt.Fraction(t);
32  return this.Rail[idx] * (1.0 - f) + this.Rail[nextIdx] * f;
33  }
static float Fraction(float v)
Gets the fractional part of the value
Definition: MathExtensions.cs:247
Math extensions
Definition: MathExtensions.cs:7
readonly Vector3d [] Rail
Definition: AbstractRail.cs:14

The documentation for this class was generated from the following file: