38 vel0 =
default(Vector3);
39 vel1 =
default(Vector3);
99 float i = ((t -
t0) / (
t1 -
t0)) - 1f;
102 float i = Mathf.Clamp01((t -
t0) / (
t1 -
t0));
106 Vector3 h00 = (2 * i3 - 3 * i2 + 1) *
pos0;
107 Vector3 h10 = (i3 - 2 * i2 + i) * (
t1 -
t0) *
vel0;
108 Vector3 h01 = (-2 * i3 + 3 * i2) *
pos1;
109 Vector3 h11 = (i3 - i2) * (
t1 -
t0) *
vel1;
111 return h00 + h10 + h01 + h11;
122 float C1 = 1.0f / C00;
127 i = Mathf.Clamp01((t -
t0) * C1);
133 i3_ = i2_ * i + i_ * i2;
136 Vector3 h00_ = (i3_ * 2 - i2_ * 3) *
pos0;
137 Vector3 h10_ = (i3_ - 2 * i2_ + i_) * C00 *
vel0;
138 Vector3 h01_ = (i2_ * 3 - 2 * i3_) *
pos1;
139 Vector3 h11_ = (i3_ - i2_) * C00 *
vel1;
141 return h00_ + h01_ + h10_ + h11_;
151 float C1 = 1.0f / C00;
156 i = Mathf.Clamp01((t -
t0) * C1);
163 i3_ = i2_ * i + i_ * i2;
166 Vector3 h00 = (2 * i3 - 3 * i2 + 1) *
pos0;
167 Vector3 h00_ = (i3_ * 2 - i2_ * 3) *
pos0;
169 Vector3 h10 = (i3 - 2 * i2 + i) * C00 *
vel0;
170 Vector3 h10_ = (i3_ - 2 * i2_ + i_) * C00 *
vel0;
172 Vector3 h01 = (3 * i2 - 2 * i3) *
pos1;
173 Vector3 h01_ = (i2_ * 3 - 2 * i3_) *
pos1;
175 Vector3 h11 = (i3 - i2) * C00 *
vel1;
176 Vector3 h11_ = (i3_ - i2_) * C00 *
vel1;
178 position = h00 + h01 + h10 + h11;
179 velocity = h00_ + h01_ + h10_ + h11_;
Represents a spline that travels from one point in space to another over a specified time frame....
Vector3 VelocityAt(float t)
Gets the first derivative of position at time t. The time is clamped within the t0 - t1 range (thus v...
HermiteSpline3(Vector3 pos0, Vector3 pos1, Vector3 vel0, Vector3 vel1)
Constructs a spline by specifying the positions and velocities of the two endpoints....
Vector3 PositionAt(float t)
Gets the position at time t along this spline. The time is clamped to t0, but can extrapolate beyon...
HermiteSpline3(Vector3 pos0, Vector3 pos1)
Constructs a spline by specifying the positions of the two endpoints. The velocity at each endpoint i...
HermiteSpline3(Vector3 pos0, Vector3 pos1, Vector3 vel0, Vector3 vel1, float length)
Constructs a spline by specifying the positions and velocities of the two endpoints....
void PositionAndVelAt(float t, out Vector3 position, out Vector3 velocity)
Gets both the position and the first derivative of position at time ti. The time is clamped within th...
HermiteSpline3(float t0, float t1, Vector3 pos0, Vector3 pos1, Vector3 vel0, Vector3 vel1)
Constructs a spline by specifying the positions, velocities, and times of the endpoints.