Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.Pathing.Rails.AbstractRail Class Referenceabstract
Inheritance diagram for essentials.action.Pathing.Rails.AbstractRail:
essentials.action.Pathing.IPathRail essentials.action.Pathing.Rails.LinearRail essentials.action.Pathing.Rails.QuadraticRail

Public Member Functions

 AbstractRail (IEnumerable< Vector3d > path)
 
void Advance (double dst)
 

Protected Member Functions

abstract Vector3d GetPosition (double t)
 

Protected Attributes

readonly Vector3d[] Rail
 

Properties

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]
 

Constructor & Destructor Documentation

essentials.action.Pathing.Rails.AbstractRail.AbstractRail ( IEnumerable< Vector3d >  path)

Attribute: 0

;

Attribute: 1] - this.Rail[0

);

Attribute: Rail.Length

;

Attribute: i] = Math.Max( (Rail[i+1] - Rail[i

).Length, 0.01);

Attribute: Rail.Length-1

= 1.0;

53  {
54  this.Rail = path.ToArray();
55  if (this.Rail.Length > 0)
56  {
57  _prevPos = _position = this.Rail [0];
58  _facing = Vector3d.UnitX;
59  }
60  if (this.Rail.Length > 1)
61  {
62  _facing = Vector3d.Normalize(this.Rail[1] - this.Rail[0]);
63  }
64 
65  //Do a little precomp to help us later
66  _railLengths = new double[Rail.Length];
67  for (int i=0; i<Rail.Length-1; ++i)
68  {
69  _railLengths[i] = Math.Max( (Rail[i+1] - Rail[i]).Length, 0.01);
70  }
71  _railLengths[Rail.Length-1] = 1.0;
72  }
float Length
Gets the length of the vector
Definition: Vector3i.cs:165
readonly Vector3d[] Rail
Definition: AbstractRail.cs:11

Member Function Documentation

void essentials.action.Pathing.Rails.AbstractRail.Advance ( double  dst)

Attribute: (int)_t

;

Implements essentials.action.Pathing.IPathRail.

75  {
76  if (this.Rail.Length <= 1)
77  {
78  return; //Can't do anything
79  }
80 
81  _t += dst / _railLengths [(int)_t];
82  if (_t < 0.0)
83  _t = 0.0;
84  if (_t >= this.Rail.Length - 1)
85  {
86  _t = this.Rail.Length - 1;
87  _done = true;
88  }
89  _position = GetPosition(_t);
90 
91  Vector3d dir = _position - _prevPos;
92  if (dir.LengthFast > 0.01)
93  {
94  _facing = Vector3d.Normalize(dir);
95  _prevPos = _position;
96  }
97  }
abstract Vector3d GetPosition(double t)
readonly Vector3d[] Rail
Definition: AbstractRail.cs:11
abstract Vector3d essentials.action.Pathing.Rails.AbstractRail.GetPosition ( double  t)
protectedpure virtual

Member Data Documentation

readonly Vector3d [] essentials.action.Pathing.Rails.AbstractRail.Rail
protected

Property Documentation

bool essentials.action.Pathing.Rails.AbstractRail.Done
get
Vector3d essentials.action.Pathing.Rails.AbstractRail.LookDirection
get
Vector3d essentials.action.Pathing.Rails.AbstractRail.Position
get
double essentials.action.Pathing.Rails.AbstractRail.Time
getset
double essentials.action.Pathing.Rails.AbstractRail.TimeLength
get

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