# Path: airconics/primitives.py
# class Airfoil(object):
#     def __init__(self,
#                  LeadingEdgePoint=[0., 0., 0.],
#                  ChordLength=1,
#                  Rotation=0,
#                  Twist=0,
#                  SeligProfile=None,
#                  Naca4Profile=None,
#                  Naca5Profile=None,
#                  CRMProfile=None,
#                  CRM_Epsilon=0.,
#                  InterpProfile=None,
#                  Epsilon=0, Af1=None, Af2=None, Eps1=0, Eps2=1,
#                  EnforceSharpTE=False):
#     def points(self):
#     def points(self, newpoints):
#     def _make_airfoil(self, SeligProfile, Naca4Profile, Naca5Profile,
#                       CRMProfile, CRM_Epsilon,
#                       InterpProfile, Epsilon, Af1, Af2, Eps1, Eps2):
#     def _fitAirfoiltoPoints(self):
#     def _AirfoilPointsSeligFormat(self, SeligProfile):
#     def _NACA4cambercurve(self, MaxCamberLocTenthChord, MaxCamberPercChord):
#     def _NACA4halfthickness(self, ChordCoord, MaxThicknessPercChord):
#     def _camberplusthickness(self, ChordCoord, zcam, dzcamdx, t):
#     def _mergesurfaces(self, xu, zu, xl, zl):
#     def _NACA4digitPnts(self, MaxCamberPercChord, MaxCamberLocTenthChord,
#                         MaxThicknessPercChord):
#     def _TransformAirfoil(self):
#     def AddAirfoilFromSeligFile(self, SeligProfile, Smoothing=1):
#     def AddNACA4(self, Naca4Profile, Smoothing=1):
#     def AddCRMLinear(self, CRM_Epsilon, Smoothing=1):
#     def AddLinear2(self, Eps, Af1, Af2, Eps1=0, Eps2=1):
#         N = np.shape(self._points)[0]
#         N = len(data)
#         RLE = 1.1019*(MaxThicknessPercChord/100.0)**2.0


import numpy as np
from airconics import primitives
    # User-defined function describing the variation of twist as a function
    # of the leading edge coordinate
    RootTwist = 0
    TipTwist  = 0
    return RootTwist + Epsilon*TipTwist

def myChordFunctionBoxWing(Epsilon):
    # User-defined function describing the variation of chord as a function of 
    # the leading edge coordinate
    return 1

def myAirfoilFunctionBoxWing(Epsilon, LEPoint, ChordFunct, ChordFactor, DihedralFunct, TwistFunct):
    # Defines the variation of cross section as a function of Epsilon
    
    AirfoilChordLength = (ChordFactor*ChordFunct(Epsilon))/np.cos(np.radians(TwistFunct(Epsilon)))

    SmoothingPasses = 1

    Camber1 = 5.0
    Camber2 = -5.0
    Transition1 = 0.45
    Transition2 = 0.55
    
    # Known values of dihedral at start, transition and end locations
    EpsArray = np.array([0, Transition1, Transition2, 1])
    CamberArray = np.array([Camber1, Camber1, Camber2, Camber2])
    
    Camber = np.interp(Epsilon, EpsArray, CamberArray)
    prof = str(int(round(Camber))) + '310'    
    

# Path: airconics/primitives.py
# class Airfoil(object):
#     def __init__(self,
#                  LeadingEdgePoint=[0., 0., 0.],
#                  ChordLength=1,
#                  Rotation=0,
#                  Twist=0,
#                  SeligProfile=None,
#                  Naca4Profile=None,
#                  Naca5Profile=None,
#                  CRMProfile=None,
#                  CRM_Epsilon=0.,
#                  InterpProfile=None,
#                  Epsilon=0, Af1=None, Af2=None, Eps1=0, Eps2=1,
#                  EnforceSharpTE=False):
#     def points(self):
#     def points(self, newpoints):
#     def _make_airfoil(self, SeligProfile, Naca4Profile, Naca5Profile,
#                       CRMProfile, CRM_Epsilon,
#                       InterpProfile, Epsilon, Af1, Af2, Eps1, Eps2):
#     def _fitAirfoiltoPoints(self):
#     def _AirfoilPointsSeligFormat(self, SeligProfile):
#     def _NACA4cambercurve(self, MaxCamberLocTenthChord, MaxCamberPercChord):
#     def _NACA4halfthickness(self, ChordCoord, MaxThicknessPercChord):
#     def _camberplusthickness(self, ChordCoord, zcam, dzcamdx, t):
#     def _mergesurfaces(self, xu, zu, xl, zl):
#     def _NACA4digitPnts(self, MaxCamberPercChord, MaxCamberLocTenthChord,
#                         MaxThicknessPercChord):
#     def _TransformAirfoil(self):
#     def AddAirfoilFromSeligFile(self, SeligProfile, Smoothing=1):
#     def AddNACA4(self, Naca4Profile, Smoothing=1):
#     def AddCRMLinear(self, CRM_Epsilon, Smoothing=1):
#     def AddLinear2(self, Eps, Af1, Af2, Eps1=0, Eps2=1):
#         N = np.shape(self._points)[0]
#         N = len(data)
#         RLE = 1.1019*(MaxThicknessPercChord/100.0)**2.0


# Path: airconics/examples/boxwing.py
import numpy as np
from airconics import primitives

    # User-defined function describing the variation of twist as a function
    # of the leading edge coordinate
    RootTwist = 0
    TipTwist  = 0
    return RootTwist + Epsilon*TipTwist

def myChordFunctionBoxWing(Epsilon):
    # User-defined function describing the variation of chord as a function of 
    # the leading edge coordinate
    return 1

def myAirfoilFunctionBoxWing(Epsilon, LEPoint, ChordFunct, ChordFactor, DihedralFunct, TwistFunct):
    # Defines the variation of cross section as a function of Epsilon
    
    AirfoilChordLength = (ChordFactor*ChordFunct(Epsilon))/np.cos(np.radians(TwistFunct(Epsilon)))

    SmoothingPasses = 1

    Camber1 = 5.0
    Camber2 = -5.0
    Transition1 = 0.45
    Transition2 = 0.55
    
    # Known values of dihedral at start, transition and end locations
    EpsArray = np.array([0, Transition1, Transition2, 1])
    CamberArray = np.array([Camber1, Camber1, Camber2, Camber2])
    
    Camber = np.interp(Epsilon, EpsArray, CamberArray)
    prof = str(int(round(Camber))) + '310'    
    

    Af = primitives.Airfoil(LEPoint,