Added side orbit slide type

This commit is contained in:
Luke Hubmayer-Werner 2021-02-21 21:29:33 +10:30
parent 6fa4c5f34a
commit d8c4c93934
2 changed files with 29 additions and 9 deletions

View File

@ -252,12 +252,12 @@ class RGT:
'1': Note.SlideType.CHORD,
'2': Note.SlideType.ARC_ACW,
'3': Note.SlideType.ARC_CW,
'4': Note.SlideType.COMPLEX, # From nekomatsuri master - Loop ACW around center. Size of loop is roughly inscribed in chords of 0-3, 1-4, 2-5... NB: doesn't loop if directly opposite col
'4': Note.SlideType.COMPLEX, # Orbit around center ACW on the way
'5': Note.SlideType.COMPLEX, # CW of above
'6': Note.SlideType.COMPLEX, # S zigzag through center
'7': Note.SlideType.COMPLEX, # Z zigzag through center
'8': Note.SlideType.COMPLEX, # V into center
'9': Note.SlideType.COMPLEX, # From nekomatsuri master - Seems to loop around to center ACW to make a + to the end
'9': Note.SlideType.COMPLEX, # Go to center then orbit off to the side ACW
'a': Note.SlideType.COMPLEX, # CW of above
'b': Note.SlideType.COMPLEX, # V into column 2 places ACW
'c': Note.SlideType.COMPLEX, # V into column 2 places CW
@ -384,10 +384,10 @@ class RGT:
slide_ids[slide_id].values.curve2d.add_point(RUV[posmod(col_hit-2, Rules.COLS)] * SLIDE_IN_R)
'8': # V into center
slide_ids[slide_id].values.curve2d.add_point(Vector2.ZERO)
'9': # TODO: From nekomatsuri master - Seems to loop around to center ACW to make a + to the end
slide_ids[slide_id].values.curve2d.add_point(Vector2.ZERO)
'a': # TODO: CW of above
slide_ids[slide_id].values.curve2d.add_point(Vector2.ZERO)
'9': # Orbit off-center ACW
Note.curve2d_make_sideorbit(slide_ids[slide_id].values.curve2d, RCA[col_hit], RCA[column], true)
'a': # CW of above
Note.curve2d_make_sideorbit(slide_ids[slide_id].values.curve2d, RCA[col_hit], RCA[column], false)
'b': # V into column 2 places ACW
slide_ids[slide_id].values.curve2d.add_point(RUV[posmod(col_hit-2, Rules.COLS)])
'c': # V into column 2 places CW

View File

@ -264,9 +264,7 @@ static func process_note_list(note_array: Array, check_doubles:=true):
const ORBIT_INNER_RADIUS = sin(deg2rad(22.5)) # ~0.38
const ORBIT_KAPPA = (sqrt(2)-1) * 4.0 / 3.0 # This is the length of control points along a tangent to approximate a circle (multiply by desired radius)
func curve2d_make_orbit(curve2d, rad_in, rad_out, ccw, rad_max_arc:=PI*0.25, kappa:=ORBIT_KAPPA, inner_radius:=ORBIT_INNER_RADIUS): #
# curve2d.clear_points()
# curve2d.bake_interval = 0.05
func curve2d_make_orbit(curve2d, rad_in, rad_out, ccw, rad_max_arc:=PI*0.25, kappa:=ORBIT_KAPPA, inner_radius:=ORBIT_INNER_RADIUS):
var d_sign = -1 if ccw else 1
var rad_2 = rad_in+PI*3/8*d_sign
var rad_2t = rad_2+PI*0.5*d_sign
@ -286,3 +284,25 @@ func curve2d_make_orbit(curve2d, rad_in, rad_out, ccw, rad_max_arc:=PI*0.25, kap
curve2d.add_point(polar2cartesian(inner_radius, rad_3), polar2cartesian(k, rad_3t))
# curve2d.add_point(polar2cartesian(1.0, rad_out))
func curve2d_make_sideorbit(curve2d: Curve2D, rad_in: float, rad_out: float, ccw: bool, rad_max_arc:=PI*0.25, kappa:=ORBIT_KAPPA, inner_radius:=ORBIT_INNER_RADIUS):
var d_sign := -1 if ccw else 1
var sideorbit_center := polar2cartesian(inner_radius, rad_in-PI*0.5*d_sign)
var rad_orbit_in := rad_in + PI*0.5*d_sign
var orbcenter_to_out := polar2cartesian(1.0, rad_out) - sideorbit_center
var rad_orbit_out := orbcenter_to_out.angle() - acos(inner_radius/orbcenter_to_out.length())*d_sign
var pos_orbit_out := sideorbit_center + polar2cartesian(inner_radius, rad_orbit_out)
var a_diff = wrapf((rad_orbit_out-rad_orbit_in)*d_sign, 0.0001, TAU+0.0001)
var n = ceil(a_diff/rad_max_arc)
var ad = a_diff/n
var k = kappa*inner_radius*(2*ad/PI) # Not geometrically correct scaling but reasonable for now
# curve2d.add_point(polar2cartesian(1.0, rad_in))
curve2d.add_point(Vector2.ZERO, Vector2.ZERO, polar2cartesian(k, rad_in+PI))
for i in range(1, n):
var ang = rad_orbit_in + i*ad*d_sign
curve2d.add_point(sideorbit_center + polar2cartesian(inner_radius, ang), polar2cartesian(k, ang-PI/2*d_sign), polar2cartesian(k, ang+PI/2*d_sign))
curve2d.add_point(pos_orbit_out, polar2cartesian(k, rad_orbit_out-PI*0.5*d_sign))
# curve2d.add_point(polar2cartesian(1.0, rad_out))