pythonnumpymatrixtrigonometrymathematical-expressions

isosceles trapezoid building : search mathematical relation between matrix scaling factor transformation and angle


by using the following script, it is possible to compute coordinates of isoceles trapezoid:

    import numpy as np
    
    # given parameters
    long_base = 4
    height = 1
    scale_factor = 0.404229

    # long_base coordinates 
    half_lb = long_base/2
    A =np.array([[-half_lb , 0. , 0.], [half_lb , 0.  ,0.]])
    
    # format matrix to apply transformation
    one = np.ones((A.shape[0],1))
    A= np.append(A, one, axis=1)
    
    # transformatipn matrix 
    
    matrix = np.array([[scale_factor, 0, 0, 0], 
                       [0, 1, 0, 0], 
                       [0, 0, 1, 0], 
                       [0, 0, height, 1]])
    # new coordinates
    B = A @ matrix
    
    A = np.concatenate((A,B), axis=0) 

the following parameters are provided as data:

isocele trapezoid parameters

Resulting angle is function of these parameters. As an example if

then the angle = 40

scale angle relation I would like to know the mathematical relationship that relates these parameters to the resulting angle. I would like to be able to provide as data a factor which makes it possible to obtain a given angle. Does anyone know this mathematical link?


Solution

  • Assuming that "scaling factor" means what the base scales by to get the top, then:

    top = scaling_factor * long_base
    total length cut off at top = long_base - top = (1-scaling_factor) * base
    half total length cut off at top = (long_base - top)/2 = (1-scaling_factor) * long_base / 2
    tan(angle)=height/(half total length cut off at top)
    

    Hence

    angle = math.atan( height / (0.5 * long_base * (1 - scaling_factor)) )
    

    Make sure that you multiply by 180/pi if you want it in degrees.