Standard_Model = {
'Version': 1.0,
'KeelFrontPoint': [0,5,0],
'KeelRearPoint': [0,-5,0],
'WingTipPoint': [15,-3,0.2],
'TrailingEdgePercentKeel': 80,
'RearWirePercentKeel': 82,
'ControlBar': {
'Height': 3.5,
'Width': 3.2,
'ApexPercentKeel': 40,
'RakeDistance': 1.0,
},
'CrossBar': {
'PercentKeel': 33,
'PercentLeadingEdge': 60,
'HeightAboveKeel': 0.1,
},
'KingPost': {
'PercentKeel': 40,
'Height': 3,
'RakeDistance': 0.1,
},
'Battens': {
'NumPerSide': 2,
'BattenList': [
{
'PercentLeadingEdge': 0,
'Segments': 20,
'LeadingEdge': [50.0,165.0],
'LeadingEdgeControl': [125.0,20.0],
'TrailingEdgeControl': [275.0,150.0],
'TrailingEdge': [685.0,160.0]
},
{
'PercentLeadingEdge': 100,
'Segments': 20,
'LeadingEdge': [225.0,305.0],
'LeadingEdgeControl': [240.0,295.0],
'TrailingEdgeControl': [260.0,300.0],
'TrailingEdge': [350.0,315.0]
}
]
}
}
# These are pixel measurements taken from the standard glider
# The resulting glider is nearly identical to the standard glider
# So the conversion from Raw to Percent seems to work.
LenLE_Meas = [512,3] # 452x241 pixels = 512.2352974952039
LenKeel_Meas = [301,0]
KeelFrontY_Meas = [242,0]
KeelRearY_Meas = [60,0]
WingTipX_Meas = [452,0]
WingTipZ_Meas = [3,0]
CtlBarH_Meas = [107,0]
CtlBarW_Meas = [96,0]
CtlBarLoc_Meas = [122,0]
CtlBarRake_Meas = [31,0]
CrossBarLE_Meas = [305,7] #>>> math.sqrt((269*269)+(145*145)) = 305.5912302406599
CrossBarKeel_Meas = [102,0]
CrossBarZ_Meas = [3,0]
KingPostKeel_Meas = [121,0]
KingPostH_Meas = [91,0]
KingPostRake_Meas = [4,0]
TrailingEdge_Meas = [242,0]
RearWire_Meas = [246,0]
# These are pixel measurements taken from the standard glider multiplied by 0.038716814
# The values have been scaled to match the Predator's 35' 4" span (35.33')
# The model appears to be correct, which indicates that Convert_Raw_to_Percent.py is good.
LenLE_Meas = [19,9.88]
LenKeel_Meas = [11,7.85]
KeelFrontY_Meas = [9,4.43]
KeelRearY_Meas = [2,3.88]
WingTipX_Meas = [17,8] # Predator span of 35' 4" / 2 = 17' 8"
WingTipZ_Meas = [0,1.39]
CtlBarH_Meas = [4,1.71]
CtlBarW_Meas = [3,8.6]
CtlBarLoc_Meas = [4,8.68]
CtlBarRake_Meas = [1,2.4]
CrossBarLE_Meas = [11,9.7]
CrossBarKeel_Meas = [3,11.39]
CrossBarZ_Meas = [0,1.39]
KingPostKeel_Meas = [4,8.22]
KingPostH_Meas = [3,6.28]
KingPostRake_Meas = [0,1.86]
TrailingEdge_Meas = [9,4.43]
RearWire_Meas = [9,6.29]
# These are the pixel measurements from Joe Faust's posted Predator image:
LenLE_Meas = [332,0]
LenKeel_Meas = [213,0]
KeelFrontY_Meas = [154,0]
KeelRearY_Meas = [59,0]
WingTipX_Meas = [291,0] # Predator span of 35' 4" / 2 = 17' 8"
WingTipZ_Meas = [6,0]
CtlBarH_Meas = [70,0]
CtlBarW_Meas = [107,0]
CtlBarLoc_Meas = [180,0]
CtlBarRake_Meas = [65,0]
CrossBarLE_Meas = [195.9,0]
CrossBarKeel_Meas = [68,0]
CrossBarZ_Meas = [7,0]
KingPostKeel_Meas = [181,0]
KingPostH_Meas = [137,0]
KingPostRake_Meas = [7,0]
TrailingEdge_Meas = [112,0]
RearWire_Meas = [120,0]
# Convert [feet,inches] to feet
LenLE = LenLE_Meas[0] + (LenLE_Meas[1]/12.0)
LenKeel = LenKeel_Meas[0] + (LenKeel_Meas[1]/12.0)
KeelFrontY = KeelFrontY_Meas[0] + (KeelFrontY_Meas[1]/12.0)
KeelRearY = - ( KeelRearY_Meas[0] + (KeelRearY_Meas[1]/12.0) )
WingTipX = WingTipX_Meas[0] + (WingTipX_Meas[1]/12.0)
WingTipZ = WingTipZ_Meas[0] + (WingTipZ_Meas[1]/12.0)
CtlBarH = CtlBarH_Meas[0] + (CtlBarH_Meas[1]/12.0)
CtlBarW = CtlBarW_Meas[0] + (CtlBarW_Meas[1]/12.0)
CtlBarLoc = CtlBarLoc_Meas[0] + (CtlBarLoc_Meas[1]/12.0)
CtlBarRake = CtlBarRake_Meas[0] + (CtlBarRake_Meas[1]/12.0)
CrossBarLE = CrossBarLE_Meas[0] + (CrossBarLE_Meas[1]/12.0)
CrossBarKeel = CrossBarKeel_Meas[0] + (CrossBarKeel_Meas[1]/12.0)
CrossBarZ = CrossBarZ_Meas[0] + (CrossBarZ_Meas[1]/12.0)
KingPostKeel = KingPostKeel_Meas[0] + (KingPostKeel_Meas[1]/12.0)
KingPostH = KingPostH_Meas[0] + (KingPostH_Meas[1]/12.0)
KingPostRake = KingPostRake_Meas[0] + (KingPostRake_Meas[1]/12.0)
TrailingEdge = TrailingEdge_Meas[0] + (TrailingEdge_Meas[1]/12.0)
RearWire = RearWire_Meas[0] + (RearWire_Meas[1]/12.0)
# Convert certain values to percents
CtlBarPctKeel = 100.0 * CtlBarLoc / LenKeel
CrossBarPctLE = 100.0 * CrossBarLE / LenLE
CrossBarPctKeel = 100.0 * CrossBarKeel / LenKeel
KingPostPctKeel = 100.0 * KingPostKeel / LenKeel
TrailingEdgePctKeel = 100.0 * TrailingEdge / LenKeel
RearWirePctKeel = 100.0 * RearWire / LenKeel
# Generate and print the model in JSON format
print ( "{" )
print ( " 'Version': 1.0," )
print ( " 'KeelFrontPoint': [0," + str(KeelFrontY) + ",0]," )
print ( " 'KeelRearPoint': [0," + str(KeelRearY) + ",0]," )
print ( " 'WingTipPoint': [" + str(WingTipX) + ",0," + str(WingTipZ) + "]," )
print ( " 'TrailingEdgePercentKeel': " + str(TrailingEdgePctKeel) + "," )
print ( " 'RearWirePercentKeel': " + str(RearWirePctKeel) + "," )
print ( " 'ControlBar': {" )
print ( " 'Height': " + str(CtlBarH) + "," )
print ( " 'Width': " + str(CtlBarW) + "," )
print ( " 'ApexPercentKeel': " + str(CtlBarPctKeel) + "," )
print ( " 'RakeDistance': " + str(CtlBarRake) + "," )
print ( " }," )
print ( " 'CrossBar': {" )
print ( " 'PercentKeel': " + str(CrossBarPctKeel) + "," )
print ( " 'PercentLeadingEdge': " + str(CrossBarPctLE) + "," )
print ( " 'HeightAboveKeel': " + str(CrossBarZ) + "," )
print ( " }," )
print ( " 'KingPost': {" )
print ( " 'PercentKeel': " + str(KingPostPctKeel) + "," )
print ( " 'Height': " + str(KingPostH) + "," )
print ( " 'RakeDistance': " + str(KingPostRake) + "," )
print ( " }," )
print ( " 'Battens': {" )
print ( " 'NumPerSide': 2," )
print ( " 'BattenList': [" )
print ( " {" )
print ( " 'PercentLeadingEdge': 0," )
print ( " 'Segments': 20," )
print ( " 'LeadingEdge': [50.0,165.0]," )
print ( " 'LeadingEdgeControl': [125.0,20.0]," )
print ( " 'TrailingEdgeControl': [275.0,150.0]," )
print ( " 'TrailingEdge': [685.0,160.0]" )
print ( " }," )
print ( " {" )
print ( " 'PercentLeadingEdge': 100," )
print ( " 'Segments': 20," )
print ( " 'LeadingEdge': [225.0,305.0]," )
print ( " 'LeadingEdgeControl': [240.0,295.0]," )
print ( " 'TrailingEdgeControl': [260.0,300.0]," )
print ( " 'TrailingEdge': [350.0,315.0]" )
print ( " }" )
print ( " ]" )
print ( " }" )
print ( "}" )