commit
88bdf256aa
|
@ -124,7 +124,6 @@ public class LinearBezier extends Curve {
|
||||||
if (distanceAt - lastDistanceAt > 1) {
|
if (distanceAt - lastDistanceAt > 1) {
|
||||||
float t = (prefDistance - lastDistanceAt) / (distanceAt - lastDistanceAt);
|
float t = (prefDistance - lastDistanceAt) / (distanceAt - lastDistanceAt);
|
||||||
curve[i] = new Vec2f(lerp(lastCurve.x, thisCurve.x, t), lerp(lastCurve.y, thisCurve.y, t));
|
curve[i] = new Vec2f(lerp(lastCurve.x, thisCurve.x, t), lerp(lastCurve.y, thisCurve.y, t));
|
||||||
// System.out.println("Dis "+i+" "+prefDistance+" "+lastDistanceAt+" "+distanceAt+" "+curPoint+" "+t);
|
|
||||||
} else
|
} else
|
||||||
curve[i] = thisCurve;
|
curve[i] = thisCurve;
|
||||||
}
|
}
|
||||||
|
@ -133,17 +132,17 @@ public class LinearBezier extends Curve {
|
||||||
Vec2f c1 = curve[0];
|
Vec2f c1 = curve[0];
|
||||||
int cnt = 1;
|
int cnt = 1;
|
||||||
Vec2f c2 = curve[cnt++];
|
Vec2f c2 = curve[cnt++];
|
||||||
while (c2.cpy().sub(c1).len() < 1)
|
while (cnt <= ncurve && c2.cpy().sub(c1).len() < 1)
|
||||||
c2 = curve[cnt++];
|
c2 = curve[cnt++];
|
||||||
this.startAngle = (float) (Math.atan2(c2.y - c1.y, c2.x - c1.x) * 180 / Math.PI);
|
this.startAngle = (float) (Math.atan2(c2.y - c1.y, c2.x - c1.x) * 180 / Math.PI);
|
||||||
c1 = curve[ncurve - 1];
|
|
||||||
cnt = ncurve - 2;
|
c1 = curve[ncurve];
|
||||||
c2 = curve[cnt];
|
cnt = ncurve - 1;
|
||||||
while (c2.cpy().sub(c1).len() < 1)
|
c2 = curve[cnt--];
|
||||||
|
while (cnt >= 0 && c2.cpy().sub(c1).len() < 1)
|
||||||
c2 = curve[cnt--];
|
c2 = curve[cnt--];
|
||||||
this.endAngle = (float) (Math.atan2(c2.y - c1.y, c2.x - c1.x) * 180 / Math.PI);
|
this.endAngle = (float) (Math.atan2(c2.y - c1.y, c2.x - c1.x) * 180 / Math.PI);
|
||||||
// }
|
// }
|
||||||
// System.out.println("Total Distance: "+totalDistance+" "+distanceAt+" "+beziers.size()+" "+hitObject.getPixelLength()+" "+OsuHitObject.getXMultiplier());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,7 +150,7 @@ public class LinearBezier extends Curve {
|
||||||
float indexF = t * ncurve;
|
float indexF = t * ncurve;
|
||||||
int index = (int) indexF;
|
int index = (int) indexF;
|
||||||
if (index >= ncurve) {
|
if (index >= ncurve) {
|
||||||
Vec2f poi = curve[ncurve - 1];
|
Vec2f poi = curve[ncurve];
|
||||||
return new float[] { poi.x, poi.y };
|
return new float[] { poi.x, poi.y };
|
||||||
} else {
|
} else {
|
||||||
Vec2f poi = curve[index];
|
Vec2f poi = curve[index];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user