38 vel0 =
default(Vector2);
39 vel1 =
default(Vector2);
97 float i = Mathf.Clamp01((t -
t0) / (
t1 -
t0));
101 Vector2 h00 = (2 * i3 - 3 * i2 + 1) *
pos0;
102 Vector2 h10 = (i3 - 2 * i2 + i) * (
t1 -
t0) *
vel0;
103 Vector2 h01 = (-2 * i3 + 3 * i2) *
pos1;
104 Vector2 h11 = (i3 - i2) * (
t1 -
t0) *
vel1;
106 return h00 + h10 + h01 + h11;
115 float C1 = 1.0f / C00;
120 i = Mathf.Clamp01((t -
t0) * C1);
126 i3_ = i2_ * i + i_ * i2;
129 Vector2 h00_ = (i3_ * 2 - i2_ * 3) *
pos0;
130 Vector2 h10_ = (i3_ - 2 * i2_ + i_) * C00 *
vel0;
131 Vector2 h01_ = (i2_ * 3 - 2 * i3_) *
pos1;
132 Vector2 h11_ = (i3_ - i2_) * C00 *
vel1;
134 return h00_ + h01_ + h10_ + h11_;
143 float C1 = 1.0f / C00;
148 i = Mathf.Clamp01((t -
t0) * C1);
155 i3_ = i2_ * i + i_ * i2;
158 Vector2 h00 = (2 * i3 - 3 * i2 + 1) *
pos0;
159 Vector2 h00_ = (i3_ * 2 - i2_ * 3) *
pos0;
161 Vector2 h10 = (i3 - 2 * i2 + i) * C00 *
vel0;
162 Vector2 h10_ = (i3_ - 2 * i2_ + i_) * C00 *
vel0;
164 Vector2 h01 = (3 * i2 - 2 * i3) *
pos1;
165 Vector2 h01_ = (i2_ * 3 - 2 * i3_) *
pos1;
167 Vector2 h11 = (i3 - i2) * C00 *
vel1;
168 Vector2 h11_ = (i3_ - i2_) * C00 *
vel1;
170 position = h00 + h01 + h10 + h11;
171 velocity = h00_ + h01_ + h10_ + h11_;
Represents a spline that travels from one point in space to another over a specified time frame....
Vector2 PositionAt(float t)
Gets the position at time t along this spline. The time is clamped within the t0 - t1 range.
HermiteSpline2(Vector2 pos0, Vector2 pos1, Vector2 vel0, Vector2 vel1, float length)
Constructs a spline by specifying the positions and velocities of the two endpoints....
Vector2 VelocityAt(float t)
Gets the first derivative of position at time t. The time is clamped within the t0 - t1 range.
HermiteSpline2(float t0, float t1, Vector2 pos0, Vector2 pos1, Vector2 vel0, Vector2 vel1)
Constructs a spline by specifying the positions, velocities, and times of the endpoints.
HermiteSpline2(Vector2 pos0, Vector2 pos1, Vector2 vel0, Vector2 vel1)
Constructs a spline by specifying the positions and velocities of the two endpoints....
void PositionAndVelAt(float t, out Vector2 position, out Vector2 velocity)
Gets both the position and the first derivative of position at time ti. The time is clamped within th...
HermiteSpline2(Vector2 pos0, Vector2 pos1)
Constructs a spline by specifying the positions of the two endpoints. The velocity at each endpoint i...